sarvekshayr commented on code in PR #9115:
URL: https://github.com/apache/ozone/pull/9115#discussion_r2685116012
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java:
##########
@@ -335,18 +333,36 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager, Execut
// and local ID with omKeyInfo blocks'.
// Otherwise, it causes data loss once those shared blocks are added
// to deletedTable and processed by KeyDeletingService for deletion.
- filterOutBlocksStillInUse(omKeyInfo, oldVerKeyInfo);
-
+ Pair<Map<OmKeyInfo, List<OmKeyLocationInfo>>, Integer>
filteredUsedBlockCnt =
+ filterOutBlocksStillInUse(omKeyInfo, oldVerKeyInfo);
+ Map<OmKeyInfo, List<OmKeyLocationInfo>> blocks =
filteredUsedBlockCnt.getLeft();
+ correctedSpace -=
blocks.entrySet().stream().mapToLong(filteredKeyBlocks ->
+ filteredKeyBlocks.getValue().stream().mapToLong(block ->
QuotaUtil.getReplicatedSize(
+ block.getLength(),
filteredKeyBlocks.getKey().getReplicationConfig())).sum()).sum();
+ long totalSize = 0;
+ long totalNamespace = 0;
if (!oldVerKeyInfo.getOmKeyInfoList().isEmpty()) {
oldKeyVersionsToDeleteMap.put(delKeyName, oldVerKeyInfo);
+ for (OmKeyInfo olderKeyVersions : oldVerKeyInfo.getOmKeyInfoList()) {
+ olderKeyVersions.setCommittedKeyDeletedFlag(true);
+ totalSize += sumBlockLengths(olderKeyVersions);
+ totalNamespace += 1;
+ }
}
+ checkBucketQuotaInNamespace(omBucketInfo, 1L);
+ checkBucketQuotaInBytes(omMetadataManager, omBucketInfo,
+ correctedSpace);
+ // Subtract the size of blocks to be overwritten.
+ omBucketInfo.decrUsedNamespace(totalNamespace, true);
+ // Subtract the used namespace of empty overwritten keys.
+ omBucketInfo.decrUsedNamespace(filteredUsedBlockCnt.getRight(), false);
Review Comment:
After this PR, observed an issue where `usedBytes` is high while
`usedNamespace` is 0, even though the bucket has no keys.
It appears that `usedNamespace` is being decremented incorrectly. In the
overwrite case, the namespace seems to be reduced twice, whereas it should only
be reduced once.
Since the bucket has no data, this likely indicates a problem in how
namespace is being updated during the commit or delete flow.
cc: @swamirishi @smengcl @jojochuang
--
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]