feat: replicate thread membership and record merges (#41)
Threads replicated without their members: the replica could list a thread but not summarise it. Membership was stored two node-local ways — thread_observations by local observation id, provenance_links by ThreadFP(int id) — so neither could cross a node boundary. The replicated fact is the entry-level edge (thread uid, entry fingerprint), because the fingerprint is already stable across nodes; both local forms are materialised from it on arrival. Unlinks replicate as tombstones, or the next reconcile would resurrect the edge. Merges now record superseded_by = successor uid and replicate both threads, so a peer resolves the merge instead of restoring the absorbed thread. One deadlock fixed along the way: MergeThreads resolved the successor uid inside its transaction, and the pool is pinned to a single connection, so the query waited on itself.
This commit is contained in:
@@ -36,7 +36,11 @@ thread. Re-running is safe: unchanged documents dedupe.`,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("emitted %d thread(s)\n", n)
|
||||
links, err := kdb.EmitAllLinks()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("emitted %d thread(s) and %d link(s)\n", n, links)
|
||||
return nil
|
||||
},
|
||||
}, newThreadCreateCmd(kdb))
|
||||
|
||||
Reference in New Issue
Block a user