ChenSammi commented on code in PR #8845:
URL: https://github.com/apache/ozone/pull/8845#discussion_r2227114549


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java:
##########
@@ -229,13 +246,23 @@ private int resetRetryCount(List<Long> txIDs) throws 
IOException {
   }
 
   private DeletedBlocksTransaction constructNewTransaction(
-      long txID, long containerID, List<Long> blocks) {
-    return DeletedBlocksTransaction.newBuilder()
+      long txID, long containerID, List<DeletedBlock> blocks) {
+    List<Long> localIdList = blocks.stream().map(b -> 
b.getBlockID().getLocalID()).collect(Collectors.toList());
+    DeletedBlocksTransaction.Builder builder = 
DeletedBlocksTransaction.newBuilder()
         .setTxID(txID)
         .setContainerID(containerID)
-        .addAllLocalID(blocks)
-        .setCount(0)
-        .build();
+        .addAllLocalID(localIdList)
+        .setCount(0);
+
+    if 
(VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.DATA_DISTRIBUTION)) {
+      long replicatedSize = 
blocks.stream().mapToLong(DeletedBlock::getReplicatedSize).sum();
+      // even when HDDSLayoutFeature.DATA_DISTRIBUTION is finalized, old OM 
can still call the old API
+      if (replicatedSize >= 0) {

Review Comment:
   For legacy OM request, it's default size is better -1, instead of 0.  Will 
refactor that part. 



-- 
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]

Reply via email to