jojochuang commented on code in PR #5183:
URL: https://github.com/apache/ozone/pull/5183#discussion_r1307706300
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequestWithFSO.java:
##########
@@ -180,15 +181,25 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
// creation and key commit, old versions will be just overwritten and
// not kept. Bucket versioning will be effective from the first key
// creation after the knob turned on.
+ boolean isPreviousCommitHsync = false;
Map<String, RepeatedOmKeyInfo> oldKeyVersionsToDeleteMap = null;
OmKeyInfo keyToDelete =
omMetadataManager.getKeyTable(getBucketLayout()).get(dbFileKey);
+ if (null != keyToDelete) {
+ final String clientIdString
+ = String.valueOf(commitKeyRequest.getClientID());
+ isPreviousCommitHsync = java.util.Optional.ofNullable(keyToDelete)
+ .map(WithMetadata::getMetadata)
+ .map(meta -> meta.get(OzoneConsts.HSYNC_CLIENT_ID))
+ .filter(id -> id.equals(clientIdString))
+ .isPresent();
+ }
long correctedSpace = omKeyInfo.getReplicatedSize();
// if keyToDelete isn't null, usedNamespace shouldn't check and
// increase.
- if (keyToDelete != null && isHSync) {
+ if (keyToDelete != null && (isHSync || isPreviousCommitHsync)) {
Review Comment:
How to test this? What if we test by hsync an empy file twice and check
deletedTable is empty?
--
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]