You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/01/12 14:27:11 UTC
[GitHub] [ozone] captainzmc commented on a change in pull request #1783: HDDS-4674. Bucket usedBytes incorrect when empty key created.
captainzmc commented on a change in pull request #1783:
URL: https://github.com/apache/ozone/pull/1783#discussion_r555810533
##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java
##########
@@ -179,6 +174,20 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
throw new OMException("Failed to commit key, as " + dbOpenKey +
"entry is not found in the OpenKey table", KEY_NOT_FOUND);
}
+
+ List<OmKeyLocationInfo> locationInfoList = new ArrayList<>();
+ long allocatedSize = 0;
+ long blockStorageSize = ozoneManager.getScmBlockSize() *
+ omKeyInfo.getFactor().getNumber();
+ for (KeyLocation keyLocation : commitKeyArgs.getKeyLocationsList()) {
+ OmKeyLocationInfo locationInfo =
+ OmKeyLocationInfo.getFromProtobuf(keyLocation);
+ if (locationInfo.getLength() > 0) {
+ locationInfoList.add(OmKeyLocationInfo.getFromProtobuf(keyLocation));
+ }
+ allocatedSize += blockStorageSize;
+ }
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org