perf(nodes): reuse client link changes during full reconciliation (#7344)

Reuse client records and successful link diffs during full node snapshot reconciliation. Preserve master-owned comments on existing records while importing new comments; omit comment writes so concurrent operator updates survive. Deduplicate detached IDs across successful inbound savepoints and mark only globally unattached clients in bounded 400-ID batches inside the existing transaction; roll back on orphan-mark write failure.

Integrate against current main while preserving #7314 target-node pending-delete cancellation and cross-node recreation guarantees, #7315 staged traffic and batched baseline writes, and #7308 serialized eligibility checks. Preserve orphan recovery, degraded-inbound safeguards and idempotent snapshot replay.

Validation: all 12 CI jobs passed on 51e627739e (run 46895213148). PostgreSQL logs confirm four new reconciliation tests, both contention/baseline regressions and eight ordering/durable-delete regressions. Author reports focused SQLite/PostgreSQL 18 race tests, make verify and all four mixed-version node E2E pairings.

Author-reported controlled 4096-client PostgreSQL 18 fixture: idle SQL statements 350 -> 270, changing-counter statements 552 -> 472, rows read 151832 -> 102680. Idle writer p50/p95 490/597 -> 430/466 ms; counter writer 489/521 -> 449/519 ms. Idle cycle p50/p95 1118/1277 -> 1015/1050 ms; counter cycle 1121/1172 -> 1046/1135 ms. Worst counter cycle effectively unchanged. These fixture results are not independent production measurements. Production tail latency, shared-client compact-cache reuse and migration coordination remain separate follow-ups.

Refs #7305
This commit is contained in:
Hamed
2026-12-02 17:44:17 +03:30
committed by GitHub
parent 0db9503228
commit 7a5a25fae2
5 changed files with 406 additions and 109 deletions
+16
View File
@@ -214,6 +214,22 @@ jobs:
exit 1
fi
- name: PostgreSQL node client reconciliation
run: |
set -o pipefail
go test ./internal/web/service -run '^Test(NodeFullReconciliation|NodeMerge(BatchesBaselinesForActiveClients|LetsSubscriptionTouchDuringClientReconciliationPostgres)$)' -count=1 -v | tee /tmp/postgres-node-client-reconciliation.log
passed=$(grep -c -- '^--- PASS: TestNodeFullReconciliation' /tmp/postgres-node-client-reconciliation.log || true)
if [ "$passed" -ne 4 ]; then
echo "expected 4 passing node client reconciliation tests, got $passed" >&2
exit 1
fi
for test in TestNodeMergeBatchesBaselinesForActiveClients TestNodeMergeLetsSubscriptionTouchDuringClientReconciliationPostgres; do
if ! grep -q -- "^--- PASS: $test " /tmp/postgres-node-client-reconciliation.log; then
echo "expected PostgreSQL regression to pass: $test" >&2
exit 1
fi
done
- name: PostgreSQL node counter reset regressions
run: |
set -o pipefail