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


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMHADBTransactionBufferImpl.java:
##########
@@ -170,18 +205,18 @@ public void init() throws IOException {
     } finally {
       txFlushPending.set(0);
       lastSnapshotTimeMs = scm.getSystemClock().millis();
-      rwLock.writeLock().unlock();
+      releaseAllLocks();
     }
   }
   
   @Override
   public boolean shouldFlush(long snapshotWaitTime) {
-    rwLock.readLock().lock();
+    batchLock.readLock().lock();

Review Comment:
   batchLock was to protect batch update and flush parallel, and even parallel 
flush. Now this is getting handled with tableLock to be taken, so this is not 
required.
   



##########
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:
   Instead of using stripped lock, as index is maintained separately, it can be 
map of tableName vs Lock itself. we may need not sync between 2 objects.



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