ChenSammi commented on code in PR #9036:
URL: https://github.com/apache/ozone/pull/9036#discussion_r2431076888
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/helpers/KeyValueContainerUtil.java:
##########
@@ -405,6 +362,78 @@ private static void populateContainerMetadata(
populateContainerFinalizeBlock(kvContainerData, store);
}
+ private static PendingDelete populatePendingDeletionMetadata(
+ KeyValueContainerData kvContainerData, Table<String, Long> metadataTable,
+ DatanodeStore store) throws IOException {
+
+ Long pendingDeletionBlockBytes =
metadataTable.get(kvContainerData.getPendingDeleteBlockBytesKey());
+ Long pendingDeleteBlockCount =
metadataTable.get(kvContainerData.getPendingDeleteBlockCountKey());
+
+ if
(!VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.DATA_DISTRIBUTION)) {
+ return handlePreDataDistributionFeature(pendingDeleteBlockCount,
metadataTable, store, kvContainerData);
+ } else if (pendingDeleteBlockCount != null) {
+ return handlePostDataDistributionFeature(pendingDeleteBlockCount,
pendingDeletionBlockBytes,
+ metadataTable, store, kvContainerData);
+ } else {
+ LOG.warn("Missing pendingDeleteBlockCount/size from {}: recalculate them
from delete txn tables",
+ metadataTable.getName());
+ return getAggregatePendingDelete(store, kvContainerData,
kvContainerData.getSchemaVersion());
+ }
+ }
+
+ private static PendingDelete handlePreDataDistributionFeature(
+ Long pendingDeleteBlockCount, Table<String, Long> metadataTable,
+ DatanodeStore store, KeyValueContainerData kvContainerData) throws
IOException {
+
+ if (pendingDeleteBlockCount != null) {
+ return new PendingDelete(pendingDeleteBlockCount, 0L);
+ } else {
+ LOG.warn("Missing pendingDeleteBlockCount/size from {}: recalculate them
from delete txn tables",
+ metadataTable.getName());
+ return getAggregatePendingDelete(store, kvContainerData,
kvContainerData.getSchemaVersion());
+ }
+ }
+
+ private static PendingDelete handlePostDataDistributionFeature(
+ Long pendingDeleteBlockCount, Long pendingDeletionBlockBytes,
+ Table<String, Long> metadataTable, DatanodeStore store,
+ KeyValueContainerData kvContainerData) throws IOException {
+
+ if (pendingDeletionBlockBytes != null) {
+ return new PendingDelete(pendingDeleteBlockCount,
pendingDeletionBlockBytes);
+ } else {
+ LOG.warn("Missing pendingDeleteBlocksize from {}: recalculate them from
delete txn tables",
Review Comment:
pendingDeleteBlocksize -> pendingDeleteBlockSize
--
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]