anoopsjohn commented on a change in pull request #2021:
URL: https://github.com/apache/hbase/pull/2021#discussion_r456451506



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALRoller.java
##########
@@ -249,4 +247,45 @@ public void close() {
     running = false;
     interrupt();
   }
+
+  /**
+   * Independently control the roll of each wal. When use multiwal,
+   * can avoid all wal roll together. see HBASE-24665 for detail
+   */
+  protected class RollController {
+    private final WAL wal;
+    // avoid missing roll request before we return from rollWriter
+    private final AtomicInteger rollRequestCounter;
+    private long lastRollTime;
+
+    RollController(WAL wal) {
+      this.wal = wal;
+      this.rollRequestCounter = new AtomicInteger(0);
+      this.lastRollTime = System.currentTimeMillis();
+    }
+
+    public void requestRoll() {
+      this.rollRequestCounter.incrementAndGet();

Review comment:
       Am not sure whether this way of count based thing also correct. Like say 
2 times req roll happened before the actual rolling thread picks up this work. 
Effectively we need to do roll only once right. Even if 2 or more times being 
asked. But now as per this change it will try do roll again and again.
   So a boolean based thing is enough
   What we can do is make the requestRoll being synchronized and within rollWal 
have a synchronized block where you can reset it ad then go ahead with actual 
roll call.
   Or we just need an AtomicBoolean only?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to