captainzmc commented on a change in pull request #1783:
URL: https://github.com/apache/ozone/pull/1783#discussion_r555813499
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java
##########
@@ -198,15 +207,13 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
new CacheKey<>(dbOzoneKey),
new CacheValue<>(Optional.of(omKeyInfo), trxnLogIndex));
- long scmBlockSize = ozoneManager.getScmBlockSize();
int factor = omKeyInfo.getFactor().getNumber();
omBucketInfo = getBucketInfo(omMetadataManager, volumeName, bucketName);
// Block was pre-requested and UsedBytes updated when createKey and
// AllocatedBlock. The space occupied by the Key shall be based on
// the actual Key size, and the total Block size applied before should
// be subtracted.
- long correctedSpace = omKeyInfo.getDataSize() * factor -
- locationInfoList.size() * scmBlockSize * factor;
+ long correctedSpace = omKeyInfo.getDataSize() * factor - allocatedSize;
Review comment:
Changes of the OMKeyCommitRequest are not required. The original logic
has ensure correctedSpace is correct.
`long correctedSpace = omKeyInfo.getDataSize() * factor - allocatedSize;`
When the key length is 0:
`long correctedSpace = 0 * factor - allocatedSize;`
Just change BlockOutputStreamEntryPool, the added UT should also run
normally.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]