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



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALRoller.java
##########
@@ -249,4 +247,43 @@ 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;
+    private final AtomicBoolean rollRequest;
+    private long lastRollTime;
+
+    RollController(WAL wal) {
+      this.wal = wal;
+      this.rollRequest = new AtomicBoolean(false);
+      this.lastRollTime = System.currentTimeMillis();
+    }
+
+    public void requestRoll() {
+      this.rollRequest.set(true);
+    }
+
+    public Map<byte[], List<byte[]>> rollWal(long now) throws IOException {
+      this.lastRollTime = now;
+      Map<byte[], List<byte[]>> regionsToFlush = wal.rollWriter(true);
+      this.rollRequest.set(false);

Review comment:
       Hey this is where we need to reset it even before we do actual roll 
work.. We were doing that.  We had a comment also.
   // reset the flag in front to avoid missing roll request before we return 
from rollWriter.
   




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