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


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogStateManagerImpl.java:
##########
@@ -146,11 +146,18 @@ 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());
+    // Hold the buffer lock across the row-plus-summary write so that a 
concurrent flush() (e.g. from takeSnapshot)
+    // cannot land between the two, which would commit the transaction rows to 
RocksDB without the matching summary.
+    transactionBuffer.lock();

Review Comment:
   Added testAddTransactionsToDBBlocksConcurrentFlushUntilDurable in 
TestSCMHATransactionBufferMonitorTask, next to the remove test.



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