ArafatKhan2198 commented on code in PR #7031: URL: https://github.com/apache/ozone/pull/7031#discussion_r1707291991
########## hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/statemachine/background/BlockDeletingTask.java: ########## @@ -424,14 +426,24 @@ private DeleteTransactionStats deleteTransactions( List<DeletedBlocksTransaction> delBlocks, Handler handler, Table<String, BlockData> blockDataTable, Container container) throws IOException { + int blocksProcessed = 0; int blocksDeleted = 0; long bytesReleased = 0; List<DeletedBlocksTransaction> deletedBlocksTxs = new ArrayList<>(); Instant startTime = Instant.now(); + // Track deleted blocks to avoid duplicate deletion + Set<Long> deletedBlockSet = new HashSet<>(); + for (DeletedBlocksTransaction entry : delBlocks) { for (Long blkLong : entry.getLocalIDList()) { + // Check if the block has already been deleted + if (deletedBlockSet.contains(blkLong)) { Review Comment: Thanks for the comment @xichen01 For the the `blocksProcessed` counter in the BlockDeletingTask class wasn't counting all the blocks it processed, especially when there were duplicate blocks. We changed the code so that this counter goes up for every block, even if the block is a duplicate and doesn't get deleted. This should make sure everything consistent and preventing mistakes in tracking deleted blocks. -- 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: issues-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org