为什么:候选环境改用真实 WeKnora 表结构后,暴露出多处"按猜的列名/形状"的假设, 以及若干 varchar 长度、对象定位符、空索引基线问题,导致真实链路跑不通。 - knowledge_tag_relations 无 tenant_id/KB 列 → 归属走父表;resources 作用域=绑定+chunk 引用。 - 写入顺序按真实外键;无代理键表用内容摘要核对。 - 队列作业 ID / 版本记录 ID 改固定长度摘要(列宽 varchar(36)/varchar(64))。 - 对象定位符拆 storage://<backend>/oss://<bucket>/<key>;provider 可配置。 - 空索引基线全链路一致(Current/Export/Backup/Archive),非空仍严格比对映射。 - finalize 阶段:版本登记失败不报成功;崩溃接管复用已持久化预备份。 - 迁移 000069:同一目标的 sync/restore 跨 kind 互斥。
This commit is contained in:
@@ -90,6 +90,16 @@ type Recorder interface {
|
||||
Stage(ctx context.Context, stage string, state string, detail string)
|
||||
}
|
||||
|
||||
// BackupObserver 让调用方在预备份完成时立刻持久化快照身份:
|
||||
// worker 被杀后重启必须能接管这份预备份,而不是重新备份覆盖它。
|
||||
type BackupObserver interface {
|
||||
BackupPrepared(ctx context.Context, backup BackupRef)
|
||||
}
|
||||
|
||||
// FinalizeStages 是"写入完成之后的收尾":先登记权威版本,再把作业标成功。
|
||||
// 收尾失败不能报告整体成功,否则版本登记与作业状态会分叉。
|
||||
func FinalizeStages() []string { return []string{"finalize"} }
|
||||
|
||||
type recorderFunc func(ctx context.Context, stage, state, detail string)
|
||||
|
||||
func (f recorderFunc) Stage(ctx context.Context, stage, state, detail string) {
|
||||
@@ -167,6 +177,9 @@ func Run(ctx context.Context, request Request, target Target, backups BackupStor
|
||||
return outcome
|
||||
}
|
||||
outcome.Backup = backup
|
||||
if observer, ok := recorder.(BackupObserver); ok {
|
||||
observer.BackupPrepared(ctx, backup)
|
||||
}
|
||||
recorder.Stage(ctx, "prebackup", "succeeded", "预备份 "+backup.ID)
|
||||
|
||||
for _, stage := range Stages() {
|
||||
|
||||
Reference in New Issue
Block a user