anoopsjohn commented on a change in pull request #2021:
URL: https://github.com/apache/hbase/pull/2021#discussion_r453456133
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALRoller.java
##########
@@ -249,4 +244,42 @@ 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 boolean isRequestRoll;
+ private long lastRollTime;
+
+ RollController(WAL wal) {
+ this.wal = wal;
+ this.isRequestRoll = false;
+ this.lastRollTime = System.currentTimeMillis();
+ }
+
+ public synchronized void requestRoll() {
+ this.isRequestRoll = true;
+ }
+
+ public synchronized Map<byte[], List<byte[]>> rollWal(long lastRollTime)
throws IOException {
Review comment:
This is overall coming good now. Much more clean than what we had
before. Thanks
One issue here though. We have rollWal() and requestRoll() under same lock
now.. That is not good. The requestRoll should not wait for ongoing roll to be
finished. The request call is in hot path.
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALRoller.java
##########
@@ -115,9 +113,9 @@ protected AbstractWALRoller(String name, Configuration
conf, T abortable) {
*/
private void checkLowReplication(long now) {
try {
- for (Entry<WAL, Boolean> entry : walNeedsRoll.entrySet()) {
+ for (Entry<WAL, RollController> entry : wals.entrySet()) {
WAL wal = entry.getKey();
- boolean needRollAlready = entry.getValue();
+ boolean needRollAlready = entry.getValue().isRollRequested();
Review comment:
Previously, when we are going for a roll because of periodic roll, then
also we used to keep the value in Map as TRUE right? Means here we checked
that also. Because of any reason, the WAL is marked for roll, dont do this
check. So here that is missing now.
----------------------------------------------------------------
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]