- OpenBaselineStack 用目标库解析出的 profile 校验 schema(134 合法), contract.WeKnoraVersion 取 profile 值 - no-gate 维护参数(IngressMode/IngressAck/HealthURL)从配置透传, 否则 0.9.0 目标会被当成缺闸门拒绝 - 索引写入与校验按 profile 决定是否补 tenant_id(0.9.0 索引无该字段)
This commit is contained in:
@@ -19,7 +19,6 @@ import (
|
||||
"knowledge-governance/internal/librarysnapshot"
|
||||
"knowledge-governance/internal/objectgateway"
|
||||
v071 "knowledge-governance/internal/releaseadapter/v071"
|
||||
"knowledge-governance/internal/releasebundle"
|
||||
)
|
||||
|
||||
// OpenMaintenance 按部署配置装配实例级维护目标;未接线时返回明确原因。
|
||||
@@ -34,6 +33,9 @@ func OpenMaintenance(config appconfig.Config) (*librarymaintenance.Manager, erro
|
||||
Writers: config.LibraryTargetWriters,
|
||||
NonWriters: config.LibraryTargetNonWriters,
|
||||
DockerSocket: config.LibraryTargetDockerSocket,
|
||||
IngressMode: config.LibraryTargetIngressMode,
|
||||
IngressAck: config.LibraryTargetNoIngressAck,
|
||||
HealthURL: config.LibraryTargetHealthURL,
|
||||
IngressURL: config.LibraryTargetIngressURL,
|
||||
IngressService: config.LibraryTargetIngressService,
|
||||
IngressDrainFile: config.LibraryTargetIngressDrainFile,
|
||||
@@ -298,10 +300,22 @@ func OpenBaselineStack(ctx context.Context, config appconfig.Config, scope strin
|
||||
target.Close()
|
||||
return nil, nil, fmt.Errorf("读取目标 WeKnora schema 版本失败: %w", err)
|
||||
}
|
||||
if dirty || schemaVersion != releasebundle.WeKnoraMigrationV071 {
|
||||
if dirty {
|
||||
target.Close()
|
||||
return nil, nil, fmt.Errorf("目标 schema 版本 %d(dirty=%v)与受支持的 %d 不一致,拒绝建基线",
|
||||
schemaVersion, dirty, releasebundle.WeKnoraMigrationV071)
|
||||
return nil, nil, fmt.Errorf("目标 schema 版本 %d 处于 dirty 状态,拒绝建基线", schemaVersion)
|
||||
}
|
||||
// 契约按目标库自己的 schema 解析,而不是写死 74:0.9.0 的 schema 是 134,
|
||||
// 它的表集合、索引来源与 Wiki 部件都和 0.7.1 不同,用 74 的常量建基线
|
||||
// 会把另一套栈的记录写进权威版本。
|
||||
profile, err := v071.ResolveSchemaProfile(ctx, target.Pool(), "baseline contract")
|
||||
if err != nil {
|
||||
target.Close()
|
||||
return nil, nil, fmt.Errorf("解析目标 schema profile 失败: %w", err)
|
||||
}
|
||||
if profile.SchemaVersion != schemaVersion {
|
||||
target.Close()
|
||||
return nil, nil, fmt.Errorf("目标 schema 版本 %d 与解析出的 profile %s(%d)不一致,拒绝建基线",
|
||||
schemaVersion, profile.Name, profile.SchemaVersion)
|
||||
}
|
||||
embeddingModel := config.LibraryEmbeddingModel
|
||||
embeddingDimension := config.LibraryEmbeddingDimension
|
||||
@@ -333,7 +347,7 @@ WHERE kb.id = $1 AND kb.deleted_at IS NULL`, scopeCfg.target.KnowledgeBaseID).Sc
|
||||
return nil, nil, fmt.Errorf("读取目标 embedding 模型绑定失败: %w", err)
|
||||
}
|
||||
contract := librarysnapshot.Compatibility{
|
||||
WeKnoraVersion: releasebundle.WeKnoraVersionV071,
|
||||
WeKnoraVersion: profile.WeKnoraVersion,
|
||||
SchemaVersion: schemaVersion,
|
||||
RetrieverEngine: "elasticsearch_v8",
|
||||
EmbeddingModel: embeddingModel,
|
||||
|
||||
Reference in New Issue
Block a user