diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java index 664ec6f..dca85a0 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java @@ -794,7 +794,10 @@ public final class HConstants { /** Conf key that enables unflushed WAL edits directly being replayed to region servers */ public static final String DISTRIBUTED_LOG_REPLAY_KEY = "hbase.master.distributed.log.replay"; - public static final boolean DEFAULT_DISTRIBUTED_LOG_REPLAY_CONFIG = false; + /** + * Default 'distributed log replay' as true since hbase 0.99.0 + */ + public static final boolean DEFAULT_DISTRIBUTED_LOG_REPLAY_CONFIG = true; public static final String DISALLOW_WRITES_IN_RECOVERING = "hbase.regionserver.disallow.writes.when.recovering"; public static final boolean DEFAULT_DISALLOW_WRITES_IN_RECOVERING_CONFIG = false; diff --git a/hbase-common/src/main/resources/hbase-default.xml b/hbase-common/src/main/resources/hbase-default.xml index 5be15e2..6b3dc38 100644 --- a/hbase-common/src/main/resources/hbase-default.xml +++ b/hbase-common/src/main/resources/hbase-default.xml @@ -220,6 +220,17 @@ possible configurations would overwhelm and obscure the important. The HLog file writer implementation. + hbase.master.distributed.log.replay + true + Enable 'distributed log replay' as default engine splitting + WAL files on server crash. This default is new in hbase 1.0. To fall + back to the old mode 'distributed log splitter', set the value to + 'false'. 'Disributed log replay' improves MTTR because it does not + write intermediate files. 'DLR' required that 'hfile.format.version' + be set to version 3 or higher. + + + hbase.regionserver.global.memstore.size 0.4 Maximum size of all memstores in a region server before new diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java index d03a96c..a152c39 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java @@ -76,6 +76,7 @@ import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.exceptions.RegionOpeningException; import org.apache.hadoop.hbase.io.HeapSize; +import org.apache.hadoop.hbase.io.hfile.HFile; import org.apache.hadoop.hbase.master.SplitLogManager; import org.apache.hadoop.hbase.monitoring.MonitoredTask; import org.apache.hadoop.hbase.monitoring.TaskMonitor; @@ -1972,7 +1973,13 @@ public class HLogSplitter { * @return true when distributed log replay is turned on */ public static boolean isDistributedLogReplay(Configuration conf) { - return conf.getBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, + boolean dlr = conf.getBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, HConstants.DEFAULT_DISTRIBUTED_LOG_REPLAY_CONFIG); + int version = conf.getInt(HFile.FORMAT_VERSION_KEY, HFile.MAX_FORMAT_VERSION); + if (LOG.isTraceEnabled()) { + LOG.trace("Distributed log replay=" + dlr + ", " + HFile.FORMAT_VERSION_KEY + "=" + version); + } + // For distributed log replay, hfile version must be 3 at least; we need tag support. + return dlr && (version >= 3); } }