perf(nodes): avoid scanning unchanged membership revisions

Introduce durable per-inbound membership revision tokens to reduce repeated materialization of unchanged client-inbound associations.

Maintain revisions with PostgreSQL statement-level transition-table triggers and SQLite row-level triggers, separate from hot inbound counters. Preserve client revisions, outside ownership and full-digest fallback for missing or malformed tokens. Validate compact membership and cache within the same transaction, retain the PostgreSQL maintenance fence, and revalidate cache admission after commit.

Regression coverage includes direct writes, rollback, concurrent outside attachment, malformed tokens and simulated legacy schema reopen. CI #47194895178 passed all 12 jobs, including 17 required PostgreSQL snapshot regressions.

Merge independently by maintainer request. Shared-claim cache admission remains unchanged and is tracked by #7278. Earlier benchmarks show lower revision-read volume but additional SQLite bulk writer occupancy; combined performance acceptance remains outstanding. No production SLA or full binary downgrade certification is implied.

Refs #7295
This commit is contained in:
Hamed
2026-12-04 00:22:09 +03:30
committed by GitHub
parent 86ccc92875
commit b7998cb334
12 changed files with 987 additions and 45 deletions
+3 -3
View File
@@ -315,10 +315,10 @@ jobs:
- name: PostgreSQL node snapshot regressions
run: |
set -o pipefail
go test -p=1 ./internal/database ./internal/web/service -run '^(TestSnapshotRevisionsDirectWritesAndRollback|TestNodeSnapshotUnchangedAvoidsSettingsAndDetectsDirectEdits|TestNodeSnapshotMergeSkipsUnchangedStructureAndPreservesDeltas|TestNodeSnapshotReadDoesNotHoldTrafficWriter|TestNodeSnapshotCanceledReadReleasesConnection|TestNodeSnapshotReopenInvalidatesCatalog|TestNodeSnapshotCachedAliasPreservesTraffic|TestNodeSnapshotAliasInvalidCacheFallsBack|TestNodeSnapshotAliasValidatesEntireMapping|TestNodeSnapshotAliasQuotaDisableAndRenewal|TestSnapshotRevisionPostgresTypeDDL|TestSnapshotRevisionMigrationRecreationAndReopen)$' -count=1 -v | tee /tmp/postgres-node-snapshot.log
go test -p=1 ./internal/database ./internal/web/service -run '^(TestSnapshotRevisionsDirectWritesAndRollback|TestNodeSnapshotUnchangedAvoidsSettingsAndDetectsDirectEdits|TestNodeSnapshotMergeSkipsUnchangedStructureAndPreservesDeltas|TestNodeSnapshotReadDoesNotHoldTrafficWriter|TestNodeSnapshotCanceledReadReleasesConnection|TestNodeSnapshotReopenInvalidatesCatalog|TestNodeSnapshotCachedAliasPreservesTraffic|TestNodeSnapshotAliasInvalidCacheFallsBack|TestNodeSnapshotAliasValidatesEntireMapping|TestNodeSnapshotAliasQuotaDisableAndRenewal|TestSnapshotRevisionPostgresTypeDDL|TestSnapshotRevisionMigrationRecreationAndReopen|TestMembershipRevisionReopenAfterLegacyWrites|TestNodeMembershipRevisionDirectWrites|TestNodeMembershipRevisionFallsBackAndTracksOutsideOwnership|TestNodeMembershipRevisionConcurrentEditRollsBackDelta|TestNodeMembershipRevisionConcurrentOutsideAttachmentInvalidatesCache)$' -count=1 -v | tee /tmp/postgres-node-snapshot.log
passed=$(grep -c -- '^--- PASS' /tmp/postgres-node-snapshot.log || true)
if [ "$passed" -ne 12 ]; then
echo "expected 12 passing node snapshot tests, got $passed" >&2
if [ "$passed" -ne 17 ]; then
echo "expected 17 passing node snapshot tests, got $passed" >&2
exit 1
fi