smengcl commented on code in PR #11437:
URL: https://github.com/apache/ozone/pull/11437#discussion_r4256028889
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRequest.java:
##########
@@ -1223,11 +1222,11 @@ protected OmKeyInfo wrapUncommittedBlocksAsPseudoKey(
}
LOG.debug("Detect allocated but uncommitted blocks {} in key {}.",
uncommitted, omKeyInfo.getKeyName());
- OmKeyInfo pseudoKeyInfo = omKeyInfo.toBuilder()
- .setObjectID(OBJECT_ID_RECLAIM_BLOCKS)
- .build();
- // This is a special marker to indicate that SnapshotDeletingService
- // can reclaim this key's blocks unconditionally.
+ // The pseudo key keeps the object ID and the hsync metadata of the key,
so callers wrap before they remove the
+ // latter. A block committed by an earlier hsync may be referenced by a
snapshot, and key deletion retains the
+ // pseudo key while the previous snapshot holds an hsync'ed version of the
key with this object ID. That version
+ // may not list the block itself, as an hsync between two snapshots can
drop a block that the older one references.
+ OmKeyInfo pseudoKeyInfo = omKeyInfo.toBuilder().build();
Review Comment:
Ah, they are the same. Removed `OBJECT_ID_RECLAIM_BLOCKS` and its exemption
in `WithObjectID.validate` in f76809e7a87, since nothing uses them after this
change.
Note the marker only worked indirectly: a real key's object ID is never 0,
so `ReclaimableKeyFilter.getPreviousSnapshotKeyInfo` never matched the pseudo
key with the key in the previous snapshot. That is the bug here. The pseudo key
now keeps the key's own object ID (`omKeyInfo.toBuilder()` copies it), so it
matches the snapshot's version of the key.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]