Repository navigation
Preserve named DB transaction outcomes when returning connections - #3311
Merged
jitheshtr merged 5 commits intoNov 25, 2026
Merged
Conversation
Pass the locked versions to a database-local handoff before changing the name. Roll back on publication failure and leave the existing delete path unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3311 +/- ##
=============================================
- Coverage 64.24% 50.67% -13.58%
+ Complexity 10398 8715 -1683
=============================================
Files 840 939 +99
Lines 71755 80948 +9193
Branches 8611 9788 +1177
=============================================
- Hits 46099 41019 -5080
- Misses 23004 36502 +13498
- Partials 2652 3427 +775 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Publish only newly retired versions. Never reset autocommit on an unresolved transaction; discard the connection when rollback fails. Check publication and mutation atomicity from a second MySQL connection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate connection-close errors from the operation result. Exercise confirmed and indeterminate commits and the Hikari eviction path. Leave delete publication and TTL SQL out of this change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore autocommit before releasing a resolved transaction. Keep cleanup failures separate from the write outcome and visible in the per-datacenter connection failure count. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 task
jitheshtr
marked this pull request as ready for review
November 24, 2026 07:42
beijxu
approved these changes
Nov 25, 2026
This was referenced Nov 25, 2026
This was referenced Dec 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The executor now calls back once with the transaction outcome. On
master, a hard delete returned its blob IDs beforeclose()ran. Aclose()failure alone called back a second time with an error and inflatedNamedBlobDBDeleteErrorCount; it did not take the IDs away from the caller. In contrast, an explicitsetAutoCommit(true)failure aftercommit()but before the success callback could prevent the caller from receiving the IDs for an already committed delete.A cleanup failure now leaves the acknowledged result intact.
ConnectionCloseErrorCountcounts autocommit reset andclose()failures. A failed rollback goes directly to eviction and does not increment that counter. Connection-class failures also reachNamedBlobDBConnectionFailureCount.<dc>without counting an acknowledged write as failed.Durability risk: Named PUT and TTL updates rely on autocommit. HikariCP 3.4.5 can recycle a connection with autocommit still off if it encounters a nonfatal reset error inside
close(). After a confirmed commit or a successful rollback, the executor explicitly restores autocommit before returning the connection. If the reset fails, it discards the connection instead of letting Hikari recycle it. A failed rollback also discards the connection, without attempting a reset. A failedcommit()remains indeterminate and its exception remains primary. This PR does not change delete or TTL SQL or implement restart-safe chunk cleanup.Testing Done
./gradlew --offline --no-daemon --max-workers=2 -q :ambry-named-mysql:test --tests '*MySqlNamedBlobDbTest'— 24 passed, none skipped. With a real single-connection Hikari pool backed by mock JDBC connections, the reset-failure test got the original physical connection back before the fix. It now receives both committed blob versions and checks that the next borrower receives a different physical connection. A separate case covers reset failure after rollback and preservation of the original commit error.Generated with GitHub Copilot CLI