Skip to content

Drain named DELETE retirement before a planned frontend stop - #3322

Open
jitheshtr wants to merge 1 commit into
linkedin:masterfrom
jitheshtr:jirajan/drain-named-retirement
Open

jitheshtr wants to merge 1 commit into
linkedin:masterfrom
jitheshtr:jirajan/drain-named-retirement

Conversation

@jitheshtr

@jitheshtr jitheshtr commented Dec 2, 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 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 (you are here) Planned-stop drain Open Adds a pre-stop operation; no rollout wiring or config changes.

Summary

Add RestServer.drainNamedBlobRetirement(timeout, unit) for a future deployment gate. It closes retirement admission on the running frontend before waiting for admitted requests to finish work that can still publish a retirement or recover its receipt, and to reach a terminal HTTP write. A read-only descriptor operation that outlives the preparation deadline cannot lead to publication; drain neither cancels nor waits for it. Timeout or interruption leaves admission closed and does not cancel work. A terminal write failure is logged; draining does not prove that the client received the outcome and must not trigger replay.

Register terminal-write tracking only on the retirement admission path. Use a shared 30-second preparation budget across descriptor waits, checking both before writer checkout and after session setup. Expiry before the manifest transaction body is a known no-write outcome. This does not interrupt an in-progress JDBC call or constrain publication and receipt recovery after publication starts. Keep retirement off until the deployment hook can invoke the blocking drain on a deployment control thread, veto shutdown on timeout or interruption, and complete a rollout rehearsal. Do not call it on a Netty event loop or a worker needed to finish admitted requests. The startup pause remains the setting for replacement frontends.

Land the writer, DELETE wiring, and startup pause first. Review the drain-only diff (before squash) while the dependencies are open.

Testing Done

  • Local code review completed

  • On 1cc43e08, ./gradlew --offline --no-daemon --max-workers=2 --console=plain :ambry-frontend:intTest --tests '*S3NamedBlobRetirementIntegrationTest' passed (9 HTTP tests). Both held-write tests wait for the worker task to return. As a negative control, each failed at the held-write assertion when drain temporarily ignored transport completion.

  • On 39b7d6cf, ./gradlew --offline --no-daemon --max-workers=2 --console=plain :ambry-frontend:test --tests '*NamedBlobDeleteHandlerTest' :ambry-frontend:intTest --tests '*S3NamedBlobRetirementIntegrationTest' passed (7 unit and 9 HTTP tests).

  • On d309be9d, ./gradlew --offline --no-daemon --max-workers=2 --console=plain :ambry-named-mysql:intTest --tests '*NamedBlobManifestStoreIntegrationTest.testRetirementPreservesCommitAndEvictsWhenTimeoutRestoreFails' --tests '*NamedBlobManifestStoreIntegrationTest.testWiredRetirement*' passed (5 tests on isolated MySQL 8.0: timeout-restore eviction, pre- and post-checkout expiry, replacement rejection, and receipt recovery after a lost commit reply). The fixture fix is carried from the writer PR.

  • On a43bb013:

    • Passed: ./gradlew --offline --no-daemon --max-workers=2 --console=plain :ambry-frontend:test --tests '*NamedBlobDeleteHandlerTest' --tests '*S3BatchDeleteHandlerTest' :ambry-rest:test --tests '*NettyResponseChannelTest' (66 selected tests).
    • Passed: ./gradlew --offline --no-daemon --max-workers=2 --console=plain :ambry-frontend:intTest --tests '*S3NamedBlobRetirementIntegrationTest' :ambry-named-mysql:compileIntTestJava (9 HTTP tests, including held 204 and 503 writes and a real socket disconnect while the worker is active; MySQL integration sources compiled).
  • The deployment hook is not wired or rehearsed by this PR.

Generated with GitHub Copilot CLI

@codecov-commenter

codecov-commenter commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.50976% with 159 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.01%. Comparing base (52ba813) to head (7d30b4f).
⚠️ Report is 435 commits behind head on master.

Files with missing lines Patch % Lines
.../java/com/github/ambry/named/MySqlNamedBlobDb.java 76.38% 17 Missing and 17 partials ⚠️
...hub/ambry/frontend/NamedBlobRetirementHandler.java 67.32% 21 Missing and 12 partials ⚠️
...java/com/github/ambry/router/GetBlobOperation.java 42.85% 13 Missing and 3 partials ⚠️
...com/github/ambry/named/NamedBlobManifestStore.java 82.35% 5 Missing and 10 partials ⚠️
...n/java/com/github/ambry/router/GetBlobOptions.java 26.66% 9 Missing and 2 partials ⚠️
...thub/ambry/messageformat/MetadataContentSerDe.java 9.09% 9 Missing and 1 partial ⚠️
...ithub/ambry/messageformat/MessageFormatRecord.java 18.18% 8 Missing and 1 partial ⚠️
...va/com/github/ambry/rest/NettyResponseChannel.java 60.86% 5 Missing and 4 partials ⚠️
...a/com/github/ambry/frontend/DeleteBlobHandler.java 50.00% 5 Missing and 2 partials ⚠️
...n/java/com/github/ambry/config/FrontendConfig.java 33.33% 2 Missing and 2 partials ⚠️
... and 8 more
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #3322       +/-   ##
=============================================
- Coverage     64.24%   51.01%   -13.24%     
+ Complexity    10398     8908     -1490     
=============================================
  Files           840      944      +104     
  Lines         71755    81697     +9942     
  Branches       8611     9948     +1337     
=============================================
- Hits          46099    41677     -4422     
- Misses        23004    36504    +13500     
- Partials       2652     3516      +864     

☔ 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 marked this pull request as ready for review December 3, 2026 01:31
Include the writer, named DELETE wiring, and startup pause. Close admission before waiting for the retirement worker and terminal HTTP write. Bound preparation without interrupting publication or receipt recovery. Expose a pre-stop drain for deployment integration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jitheshtr
jitheshtr force-pushed the jirajan/drain-named-retirement branch from 1cc43e0 to 7d30b4f Compare December 3, 2026 01:33
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.

2 participants