Skip to content

Bound named blob retirement preparation and replay - #3319

Open
jitheshtr wants to merge 3 commits into
linkedin:masterfrom
jitheshtr:jirajan/bounded-named-retirement
Open

jitheshtr wants to merge 3 commits into
linkedin:masterfrom
jitheshtr:jirajan/bounded-named-retirement

Conversation

@jitheshtr

@jitheshtr jitheshtr commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
Order PR Status Runtime effect
1 Transaction executor ✅ Merged Preserves known transaction outcomes.
2 Exact-version manifests ✅ Merged Stores manifests and fences atomically.
3a Migration safety ✅ Merged Verifies migration safeguards.
3b Retirement-aware serving ✅ Merged Gates fence-aware GET, LIST and PUT.
3c (you are here) Bounded retirement Open Adds the exact-intent publication handle.
— Legacy DELETE test ✅ Merged Makes the legacy DELETE ordering fixture deterministic; no runtime effect.
4 Single-object named DELETE Open Adds the default-off frontend caller.
5 Fail-closed pause Open Rejects selected named DELETEs without falling back to physical DELETE.
6 Planned-stop drain Open Adds a pre-stop operation; no rollout wiring or config changes.

Summary

Review the bounded-retirement diff. This is part of the Liquid large-delete work.

  1. Admit one retirement per named DB instance before fetching descriptors. The blocking handle owns the encoded request until closed, without putting its payload on the generic transaction queue.
  2. Capture exact versions and roots once. Publication, receipt checks, and retries share the same intent and start from a fresh transaction on the configured writer. An absent receipt does not prove rollback.

Start with MySqlNamedBlobDb.Retirement for admission and recovery; NamedBlobManifestStore owns the exact-intent encoding. The format and atomic publication are unchanged. The writer needs a fixed Connector/J session with reconnect disabled and REPEATABLE READ. Retirement caps socket read time only on its own checkout and discards broken connections without trying to roll back. Ordinary requests retain the pool's existing timeout. The read timeout does not cap total attempt time, and the admission limit bounds encoded bytes, not peak heap. Public DELETE, production DDL, and reclamation are out of scope.

Retirement transport failures and busy rejections have separate counters. The existing named DB connection-failure counter is unchanged for ordinary operations. The runbook covers payload and replication sizing and explains why manifest removal needs its own retention policy.

Testing Done

  • ./gradlew --offline --no-daemon :ambry-named-mysql:test --tests com.github.ambry.named.MySqlNamedBlobDbTest :ambry-named-mysql:intTest --tests com.github.ambry.named.NamedBlobManifestStoreIntegrationTest — 25 unit tests and 39 of 40 isolated MySQL tests passed; the reconnect test hit a fixture issue.
  • ./gradlew --offline --no-daemon :ambry-named-mysql:intTest --tests 'com.github.ambry.named.NamedBlobManifestStoreIntegrationTest.testRetirementRejectsConnectorJReconnectOptions' — passed after correcting the fixture. The local MySQL run does not verify the deployed writer configuration.

Generated with GitHub Copilot CLI

@codecov-commenter

codecov-commenter commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.25641% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 31.47%. Comparing base (52ba813) to head (edc5038).
⚠️ Report is 435 commits behind head on master.

Files with missing lines Patch % Lines
.../java/com/github/ambry/named/MySqlNamedBlobDb.java 81.44% 6 Missing and 12 partials ⚠️
...com/github/ambry/named/NamedBlobManifestStore.java 90.90% 2 Missing and 3 partials ⚠️

❗ There is a different number of reports uploaded between BASE (52ba813) and HEAD (edc5038). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (52ba813) HEAD (edc5038)
3 2
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #3319       +/-   ##
=============================================
- Coverage     64.24%   31.47%   -32.77%     
+ Complexity    10398     5982     -4416     
=============================================
  Files           840      941      +101     
  Lines         71755    81419     +9664     
  Branches       8611     9899     +1288     
=============================================
- Hits          46099    25628    -20471     
- Misses        23004    53693    +30689     
+ Partials       2652     2098      -554     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jitheshtr
jitheshtr force-pushed the jirajan/bounded-named-retirement branch 2 times, most recently from c31e416 to 593cef4 Compare December 1, 2026 20:13
@jitheshtr
jitheshtr marked this pull request as ready for review December 1, 2026 20:23
@jitheshtr
jitheshtr force-pushed the jirajan/bounded-named-retirement branch from 593cef4 to 4113a55 Compare December 1, 2026 23:27
Bound preparation and publication to one exact retirement intent per named DB instance. Limit the writer checkout read timeout and evict connections that cannot be safely returned. Use synchronous MySQL timeout updates in the fault-injection fixture.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jitheshtr
jitheshtr force-pushed the jirajan/bounded-named-retirement branch from 0c64636 to 574a099 Compare December 3, 2026 01:33
private final MySqlNamedBlobDbConfig config;
private final Metrics metricsRecoder;
// Reserve one worst-case encoded request (32 MiB), including while its caller decides whether to retry.
private final Semaphore retirementSlot = new Semaphore(1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Semaphore(1) (and the single worker in #3320), each frontend host runs only one retirement at a time. The slot is held during descriptor fetches (router IO for up to 32 roots) and the commit, so one DELETE can take seconds, and parallel S3 deletes will mostly get 503. Is that the intended throughput? Would N permits sized by a memory budget (encoded bytes), plus a rejection metric, work instead?

throws SQLException {
root = pending.root.toBytes();
count = pending.expected;
body = encode(pending.descriptors, count, root);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Design question (the format comes from the merged #3313): the full child list is copied into MySQL, about 50 B per child, so roughly 13 KB per 1 GB file and up to about 13 MB (cap 32 MiB) for 262,144 chunks. That affects max_allowed_packet, binlog/replication lag, backups, and transaction size. The root metadata blob already holds this list, and retirement never deletes it. Did we consider storing only root ID + hash and having reclamation read the root, or writing the list to a separate blob? Also, will manifest rows ever be purged after reclamation?

}
if (cur instanceof SQLNonTransientConnectionException || cur instanceof SQLTransientConnectionException) {
if (cur instanceof SQLNonTransientConnectionException || cur instanceof SQLTransientConnectionException
|| cur instanceof SocketTimeoutException || cur instanceof SocketException || cur instanceof EOFException) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding SocketException / EOFException / SocketTimeoutException here also changes connectionFailureCount for all non-retirement paths. Is that intended? Existing alerts or dashboards on this metric may shift.

}

private void returnConnection(Connection connection, boolean autoCommit, Throwable operationFailure) {
private static JdbcConnection requireFixedRetirementSession(Connection connection) throws SQLException {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This relies on Connector/J internals (ConnectionImpl, getServerSession().inTransactionOnServer(), the property set). A driver upgrade could silently break it or make every retirement fail closed. Can we add a test that would catch a driver change here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is the prod writer pool already configured this way (Connector/J, no proxy, autoReconnect=false, REPEATABLE READ)? If not, every retirement in the enabled namespace will 503; can we validate this at startup when the namespace config is set, instead of failing per request?

@SophieGuo410 SophieGuo410 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The exact-intent handle and the "absent receipt is not a rollback" handling look right to me. A few questions and concerns are inline.

jitheshtr and others added 2 commits December 3, 2026 14:43
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

3 participants