swamirishi commented on code in PR #8781:
URL: https://github.com/apache/ozone/pull/8781#discussion_r2212907932


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHADBTransactionBufferImpl.java:
##########
@@ -49,43 +54,57 @@ public class SCMHADBTransactionBufferImpl implements 
SCMHADBTransactionBuffer {
   private SCMMetadataStore metadataStore;
   private BatchOperation currentBatchOperation;
   private TransactionInfo latestTrxInfo;
-  private final AtomicReference<SnapshotInfo> latestSnapshot
-      = new AtomicReference<>();
+  private final AtomicReference<SnapshotInfo> latestSnapshot = new 
AtomicReference<>();
   private final AtomicLong txFlushPending = new AtomicLong(0);
   private long lastSnapshotTimeMs = 0;
-  private final ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
+  private final Map<String, Integer> tableIdxMap;

Review Comment:
   RDBBatchOperation is not supposed to be thread safe by nature. It writes 
entries to HashMap instead of ConcurrentHashMap which makes sense since 
RDBBatchOperation is supposed to be used by only one thread. This 
SCMHADBTransactionBufferImpl is using it incorrectly. The interface design 
should have implemented something similar to OMDoubleBuffer instead of each 
thread updating the batch independently without synchronization. This model can 
also work where we are taking a bare minimum lock to serialize operations on 
the table.



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