rich7420 commented on code in PR #11187:
URL: https://github.com/apache/ozone/pull/11187#discussion_r3944856891


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogStateManagerImpl.java:
##########
@@ -146,26 +146,30 @@ public void removeFromDB() {
   @Override
   public void addTransactionsToDB(ArrayList<DeletedBlocksTransaction> txs,
       DeletedBlocksTransactionSummary summary) throws IOException {
-    for (DeletedBlocksTransaction tx : txs) {
-      transactionBuffer.addToBuffer(deletedTable, tx.getTxID(), tx);
-    }
-    if (summary != null) {
-      transactionBuffer.addToBuffer(statefulConfigTable, SERVICE_NAME, 
summary.toByteString());
-    }
+    transactionBuffer.runWithBufferLock(() -> {

Review Comment:
   A stale summary can still be persisted here: `addTransactions()` evaluates 
`getSummary()` before entering `runWithBufferLock()`, so 
`notifyLeaderChanged()` can reload the old DB summary between the counter 
update and this lock. Please cover this update-to-snapshot window (and the 
analogous remove path) and add a regression test. Evidence: 
[addTransactions()](https://github.com/apache/ozone/blob/7ca0072c5c6a804044f58504e9ba465dad922411/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/SCMDeletedBlockTransactionStatusManager.java#L464-L470),
 
[notifyLeaderChanged()](https://github.com/apache/ozone/blob/7ca0072c5c6a804044f58504e9ba465dad922411/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java#L325-L335).



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