首轮到达held时按chunk-target取文档失败:早段数据库阶段失败前索引仍是 发布写入的源码分块,before-image的chunk-target本就不该出现。改为整份 读回等于applied,并显式断言chunk-target未提前回来。
This commit is contained in:
@@ -1006,32 +1006,35 @@ UPDATE knowledge_bases SET embedding_model_id='r38-model',vector_store_id='r38-v
|
|||||||
}
|
}
|
||||||
heldIndex := recoveryIndexReadback(t, fx)
|
heldIndex := recoveryIndexReadback(t, fx)
|
||||||
save("13-index-held.json", heldIndex)
|
save("13-index-held.json", heldIndex)
|
||||||
heldDoc, ok := heldIndex["chunk-target"]
|
|
||||||
if !ok {
|
|
||||||
t.Fatal("chunk-target missing at held boundary")
|
|
||||||
}
|
|
||||||
heldSource := heldDoc["_source"].(map[string]any)
|
|
||||||
heldContent, _ := heldSource["content"].(string)
|
|
||||||
if earlyBranch {
|
if earlyBranch {
|
||||||
// database 阶段失败时索引还没被恢复:既不能有恢复 marker,也不能回到 before-image。
|
// database 阶段失败时索引还没被恢复:整份读回必须仍是发布写入后的那一代,
|
||||||
if strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
|
// before-image 的 chunk-target 不能提前出现。
|
||||||
t.Fatalf("early held index must not carry a restore marker: %q", heldContent)
|
if !reflect.DeepEqual(appliedIndex, heldIndex) {
|
||||||
|
t.Fatalf("early held index must be exactly the applied publish generation (applied=%d docs, held=%d docs)",
|
||||||
|
len(appliedIndex), len(heldIndex))
|
||||||
}
|
}
|
||||||
appliedSource := appliedIndex["chunk-target"]["_source"]
|
if _, ok := heldIndex["chunk-target"]; ok {
|
||||||
if !reflect.DeepEqual(appliedSource, heldSource) {
|
t.Fatal("before-image chunk-target reappeared before the index stage ran")
|
||||||
t.Fatal("early held index must still be the applied publish content")
|
|
||||||
}
|
}
|
||||||
} else if fullShape {
|
} else {
|
||||||
// 对象分支里索引已恢复,marker 不能还在:否则说明失败的其实是 ES 分支。
|
heldDoc, ok := heldIndex["chunk-target"]
|
||||||
if strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
|
if !ok {
|
||||||
t.Fatalf("object branch left the ES restore marker in place: %q", heldContent)
|
t.Fatal("chunk-target missing at held boundary")
|
||||||
}
|
}
|
||||||
oldSource := beforeIndex["chunk-target"]["_source"]
|
heldSource := heldDoc["_source"].(map[string]any)
|
||||||
if !reflect.DeepEqual(oldSource, heldSource) {
|
heldContent, _ := heldSource["content"].(string)
|
||||||
t.Fatalf("object branch index was not restored to its before-image")
|
if fullShape {
|
||||||
|
// 对象/PG wiki 分支里索引已恢复,marker 不能还在:否则说明失败的其实是 ES 分支。
|
||||||
|
if strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
|
||||||
|
t.Fatalf("restored index left the ES restore marker in place: %q", heldContent)
|
||||||
|
}
|
||||||
|
oldSource := beforeIndex["chunk-target"]["_source"]
|
||||||
|
if !reflect.DeepEqual(oldSource, heldSource) {
|
||||||
|
t.Fatalf("index was not restored to its before-image")
|
||||||
|
}
|
||||||
|
} else if !strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
|
||||||
|
t.Fatalf("held index must still carry the restore marker, got %q", heldContent)
|
||||||
}
|
}
|
||||||
} else if !strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
|
|
||||||
t.Fatalf("held index must still carry the restore marker, got %q", heldContent)
|
|
||||||
}
|
}
|
||||||
events, refused := proxy.snapshot()
|
events, refused := proxy.snapshot()
|
||||||
save("14-wire-held.json", map[string]any{"events": events, "refused": refused})
|
save("14-wire-held.json", map[string]any{"events": events, "refused": refused})
|
||||||
|
|||||||
Reference in New Issue
Block a user