执行时真实时钟与持久授权回读(撤销/过期即停并保留预备份)、写集合写前落盘、 租约与 attempt 身份、恢复队列与原发送身份分离、成功收尾必须释放维护后再登记终态。
This commit is contained in:
@@ -58,8 +58,18 @@ func ExportLibraryWithReleases(ctx context.Context, db librarySnapshotDB, identi
|
||||
return PostgresSnapshot{}, errors.New("library has unfinished or failed processing; semantic acceptance is still required after settlement")
|
||||
}
|
||||
}
|
||||
if err := verifyLibraryRelationalClosure(ctx, tx, identity, false); err != nil {
|
||||
return PostgresSnapshot{}, err
|
||||
}
|
||||
exporter := PostgresExporter{db: tx}
|
||||
var snapshot PostgresSnapshot
|
||||
snapshot.Catalog, _, err = captureMigrationCatalog(ctx, tx)
|
||||
if err != nil {
|
||||
return PostgresSnapshot{}, err
|
||||
}
|
||||
if err = validateMigrationCatalog(snapshot.Catalog); err != nil {
|
||||
return PostgresSnapshot{}, err
|
||||
}
|
||||
for _, entry := range libraryContentQueries {
|
||||
rows, err := exporter.queryRows(ctx, entry.sql, identity.TenantID, identity.KnowledgeBaseID)
|
||||
if err != nil {
|
||||
@@ -70,10 +80,13 @@ func ExportLibraryWithReleases(ctx context.Context, db librarySnapshotDB, identi
|
||||
// Resources can be owned by a document/chunk or only referenced in body text.
|
||||
// The latter includes Wiki manual pages, which document bundles used to miss.
|
||||
var bodies []json.RawMessage
|
||||
for _, name := range []string{"knowledges", "chunks", "wiki_pages"} {
|
||||
bodies = append(bodies, snapshot.Table(name).Rows...)
|
||||
for _, table := range snapshot.Tables {
|
||||
bodies = append(bodies, table.Rows...)
|
||||
}
|
||||
handles, err := libraryResourceHandles(bodies)
|
||||
if err != nil {
|
||||
return PostgresSnapshot{}, err
|
||||
}
|
||||
handles := referencedResourceHandles(bodies)
|
||||
resources, err := exporter.queryRows(ctx, libraryResourcesSQL, identity.TenantID, identity.KnowledgeBaseID, handles)
|
||||
if err != nil {
|
||||
return PostgresSnapshot{}, err
|
||||
@@ -104,6 +117,13 @@ func ExportLibraryWithReleases(ctx context.Context, db librarySnapshotDB, identi
|
||||
return PostgresSnapshot{}, errors.New("library binding references an unavailable resource")
|
||||
}
|
||||
}
|
||||
ids := make([]string, 0, len(resourceIDs))
|
||||
for id := range resourceIDs {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
if err := verifyLibraryResourceOwners(ctx, tx, ids); err != nil {
|
||||
return PostgresSnapshot{}, err
|
||||
}
|
||||
snapshot.Tables = append(snapshot.Tables, newTableSnapshot("resources", resources))
|
||||
if err = tx.Commit(ctx); err != nil {
|
||||
return PostgresSnapshot{}, errors.New("commit library snapshot")
|
||||
|
||||
Reference in New Issue
Block a user