ChenSammi commented on code in PR #8827:
URL: https://github.com/apache/ozone/pull/8827#discussion_r2282023422
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/helpers/KeyValueContainerUtil.java:
##########
@@ -313,20 +314,23 @@ private static void populateContainerMetadata(
// Set pending deleted block count.
final long blockPendingDeletion;
+ long blockPendingDeletionBytes = 0L;
+ Long pendingDeletionBlockBytes = metadataTable.get(kvContainerData
+ .getPendingDeleteBlockBytesKey());
Long pendingDeleteBlockCount =
metadataTable.get(kvContainerData
.getPendingDeleteBlockCountKey());
if (pendingDeleteBlockCount != null) {
blockPendingDeletion = pendingDeleteBlockCount;
+ if (pendingDeletionBlockBytes != null) {
+ blockPendingDeletionBytes = pendingDeletionBlockBytes;
+ }
} else {
// Set pending deleted block count.
LOG.warn("Missing pendingDeleteBlockCount from {}: recalculate them from
block table", metadataTable.getName());
- MetadataKeyFilters.KeyPrefixFilter filter =
- kvContainerData.getDeletingBlockKeyFilter();
- blockPendingDeletion = store.getBlockDataTable().getRangeKVs(
- kvContainerData.startKeyEmpty(), Integer.MAX_VALUE,
kvContainerData.containerPrefix(), filter, true)
- // TODO: add a count() method to avoid creating a list
- .size();
+ ObjectNode pendingDeletions = getAggregateValues(store, kvContainerData,
kvContainerData.getSchemaVersion());
+ blockPendingDeletionBytes =
pendingDeletions.get("pendingDeleteBytes").asLong();
Review Comment:
can we use constant filed to replace string pendingDeleteBytes and
pendingDeleteBlocks?
And the log message need a refresh.
--
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]