pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] PR #4116: test: budget terminating Sync in BatchDeadlockTest small-RETURNING branch
Date: Wed, 27 May 2026 06:25:58 +0000
Message-ID: <[email protected]> (raw)
## Summary
- `BatchDeadlockTest.largePreparedBatchWithGeneratedKeysDoesNotDeadlock` for parameter `[6]` (`ReturningInQuery.ID` + `BinaryMode.FORCE`) intermittently fails with `expected: <true> but was: <false>` for the Sync count.
- Root cause is an off-by-one in the test bound, not a driver regression. `flushIfDeadlockRisk` ([`QueryExecutorImpl#L1650`](../blob/master/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L1650)) fires a Sync per mid-batch flush, and pgjdbc always sends one extra terminating Sync at the end of the batch. The formula `BATCH_SIZE * 250 * 2 / 64000 = 3` accounted only for the mid-batch flushes, so an observed `Sync=4` (3 + terminator) tripped `syncs <= 3`.
## What changed
- Single `expectedSyncs = expectedRoundtrips + 1` budget for both Sync and roundtrip assertions.
- Diagnostic messages now include the bound (`expected at most N Syncs, got …`) so future failures show why the bound was set.
- Still catches Sync-per-row regressions: the small-RETURNING budget is `~3`, far below `BATCH_SIZE = 500`.
## Test plan
- [x] `./gradlew :postgresql:test --tests "org.postgresql.test.jdbc2.BatchDeadlockTest"` x3 — 16 passed, 8 skipped (simple query mode), stable across reruns.
Spotted while triaging an unrelated CI failure on https://github.com/pgjdbc/pgjdbc/actions/runs/26447208462/job/77856581962.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] PR #4116: test: budget terminating Sync in BatchDeadlockTest small-RETURNING branch
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox