Repository navigation
Conversation
…hot of an hsync'ed key still references A block committed by an hsync and left out of a later hsync or of the final commit is released as an uncommitted block when the key is closed. Its pseudo key in the deleted table had object ID 0, so ReclaimableKeyFilter never matched it with the key in the previous snapshot and KeyDeletingService deleted the block, even when a snapshot taken after the hsync still listed it. The pseudo key now keeps the object ID of the key. Together with the hsync metadata it already carries, this retains it while the previous snapshot holds an hsync'ed version of the key. The deleted table row name is still derived from the transaction index, so rows do not collide. Tested with TestKeyDeletingService (new testUncommittedBlockOfHsyncedKeyRetainedBySnapshot), TestOMKeyCommitRequest and TestOMKeyCommitRequestWithFSO. The new test fails without the fix, and also with the object ID kept but the hsync metadata removed from the pseudo key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix correctly preserves snapshot identity and includes appropriate regression coverage.
0 open findings
What changed in this PR
Prevents snapshot-referenced hsync blocks from being prematurely reclaimed.
Changes:
- Preserve object IDs and hsync metadata on uncommitted-block pseudo keys.
- Add regression and object-ID preservation tests.
| File | Description |
|---|---|
OMKeyRequest.java |
Preserves pseudo-key identity and hsync metadata. |
TestKeyDeletingService.java |
Tests snapshot-safe block retention and cleanup. |
TestOMKeyCommitRequest.java |
Verifies pseudo keys retain object IDs. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Generated-by: Claude Code (Opus 5.5)
What changes were proposed in this pull request?
A block that an hsync committed and that a later hsync or the final commit leaves out is released as an uncommitted block when the key is closed.
OMKeyRequest.wrapUncommittedBlocksAsPseudoKeywrapped it in a pseudo key with object IDOBJECT_ID_RECLAIM_BLOCKS(0) before putting it indeletedTable.ReclaimableKeyFiltertreats an object ID mismatch with the previous snapshot's key as reclaimable, soKeyDeletingServicedeleted the block even when a snapshot taken after the hsync still listed it. Reads of the key through that snapshot then fail. The active key is not affected.The pseudo key now keeps the object ID of the key. Together with the hsync metadata it already carries (callers wrap before they remove
HSYNC_CLIENT_ID, which the helper now documents),SnapshotUtils.isBlockLocationInfoSameretains the row while the previous snapshot holds an hsync'ed version of the key. This also covers the case where the previous snapshot does not list the block itself: hsync[A, B], snapshot S1, hsync[A, C], snapshot S2, commit[A, C]. The row becomes reclaimable once no previous snapshot holds an hsync'ed version of the key.The
deletedTablerow name is derived from the transaction index, not the object ID, so rows do not collide. The same helper servesOMKeyCommitRequestWithFSOandS3MultipartUploadCommitPartRequest.Notes for reviewers:
OBJECT_ID_RECLAIM_BLOCKSand its exemption inWithObjectID.validateare now unused. They are left in place to keep this patch small and can be removed in a follow up.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16755
How was this patch tested?
TestKeyDeletingService.testUncommittedBlockOfHsyncedKeyRetainedBySnapshotruns the two snapshot sequence above. ThedeletedTablerow for B must stay while S2 is the previous snapshot and after S2 is deleted, and must be purged only after S1 is deleted. It fails without the fix, and also with the object ID kept but the hsync metadata removed from the pseudo key.TestOMKeyCommitRequest.testValidateAndUpdateCacheOnOverwriteWithUncommittedBlocksnow asserts that the pseudo key keeps a non zero object ID, for OBS and FSO. It fails without the fix.TestKeyDeletingService$Normal,TestOMKeyCommitRequest,TestOMKeyCommitRequestWithFSO, bothTestS3MultipartUploadCommitPartRequestvariants,TestOpenKeyCleanupService,TestReclaimableKeyFilterandTestSnapshotUtilslocally, plus checkstyle onozone-manager.