Skip to content

Fix common test flakes and improve diagnostics - #30861

Open
dain wants to merge 4 commits into
masterfrom
user/dain/fix-common-test-flakes
Open

Fix common test flakes and improve diagnostics#30861
dain wants to merge 4 commits into
masterfrom
user/dain/fix-common-test-flakes

Conversation

@dain

@dain dain commented Aug 22, 2026

Copy link
Copy Markdown
Member

Description

Reduce several recurring merge-queue test failures:

  • Remove the heartbeat timing race from TestServerAbandonedQueries.
  • Correlate PostgreSQL cancellation statements by backend process ID when logs from multiple processes are interleaved.
  • Run transactional and non-transactional MERGE connection-count checks with explicit session settings, and attach connection-creation stacks to count failures.
  • Give concurrent ADD COLUMN operations one shared deadline and report unfinished SQL with worker stacks before cancelling workers and dropping the table.

Additional context and related issues

Release notes

(x) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`issuenumber`)

dain added 4 commits August 21, 2026 17:45
The test used the same one-second interval for client heartbeats and the
server timeout. A server check could therefore race with an asynchronous
heartbeat and abandon an active client.

Use a heartbeat interval with a clear margin below the timeout, and wait
for the server to report ABANDONED_QUERY instead of relying on a fixed
sleep.
PostgreSQL can interleave output from multiple backend processes between a
cancellation error and its statement log. The global adjacency flag then
loses the cancellation event.

Retain backend process IDs from the log prefix and match cancellation
statements by process. Parse all log frames even when no tracing listener
is active so listener changes cannot leave stale parser state.
The transactional MERGE checks inherited the non-transactional merge
session property, so the labeled mode did not match the query being
tested. Use explicit sessions for both modes and attach connection
creation stacks when a count differs.
Use one deadline for the concurrent operations and report unfinished SQL
with worker stacks before cleanup. Cancel workers before dropping the
table so cleanup is less likely to hide the original flake.
@github-actions github-actions Bot added postgresql PostgreSQL connector cla-signed labels Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed postgresql PostgreSQL connector

Development

Successfully merging this pull request may close these issues.

1 participant