Skip to content

[DO NOT MERGE until freeze lifts] TT-9424: Sort aggregate batches by ID to prevent PostgreSQL deadlocks - #1069

Draft
nerdydread wants to merge 1 commit into
masterfrom
TT-9424-reland-sql-aggregate-deadlock
Draft

[DO NOT MERGE until freeze lifts] TT-9424: Sort aggregate batches by ID to prevent PostgreSQL deadlocks#1069
nerdydread wants to merge 1 commit into
masterfrom
TT-9424-reland-sql-aggregate-deadlock

Conversation

@nerdydread

@nerdydread nerdydread commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Based on #1058, which was approved and merged prematurely as eead02ed before QA, so it had to be reverted by #1067 (e43a3b8f).

What this contains

This is a single git revert of #1067's squash commit, so it restores both changes that #1058 carried:

  • The deadlock fix — all four sort.Slice(recs, ...) sites (pumps/sql_aggregate.go, pumps/graph_sql_aggregate.go, pumps/mcp_sql_aggregate.go, pumps/sql.go), giving every replica the same row-lock acquisition order and preventing the circular waits behind SQLSTATE 40P01.
  • The flakey unit test fixOmitIndexCreation: true in TestMCPSQLAggregatePump_WriteData, which stops the background CREATE INDEX CONCURRENTLY goroutine from racing the subtest's DROP TABLE cleanup.

Side benefit

master is currently red at e43a3b8f: TestMCPSQLAggregatePump_WriteData/tracks_errors fails at roughly 1 run in 3, because the revert took the OmitIndexCreation workaround out along with the production change. Merging this fixes that flakey test, since the fix rides along.

Verification

Note for reviewers

The validate (Jira linter) check will fail while TT-9424 sits in Ready for Testing — that status is not in the linter's accepted list. It is not a required check. Required checks are Aggregated CI Status and Unit Tests & Linting.

Full background, test methodology, and the four-call-site verification are on TT-9424.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant