From e9e496caeea51529545a53c4b5dea0f73eec1202 Mon Sep 17 00:00:00 2001 From: Guanghao Zhang Date: Fri, 9 Mar 2018 11:30:25 +0800 Subject: [PATCH] HBASE-19999 Remove the SYNC_REPLICATION_ENABLED flag --- .../org/apache/hadoop/hbase/replication/ReplicationUtils.java | 2 -- .../java/org/apache/hadoop/hbase/regionserver/HRegionServer.java | 9 +++------ .../src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java | 6 ++++-- .../org/apache/hadoop/hbase/replication/TestSyncReplication.java | 3 ++- .../hbase/replication/master/TestRecoverStandbyProcedure.java | 1 - .../apache/hadoop/hbase/wal/TestSyncReplicationWALProvider.java | 2 +- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationUtils.java b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationUtils.java index 9699e7b..6bbfbf9 100644 --- a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationUtils.java +++ b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationUtils.java @@ -37,8 +37,6 @@ import org.apache.yetus.audience.InterfaceAudience; @InterfaceAudience.Private public final class ReplicationUtils { - public static final String SYNC_REPLICATION_ENABLED = "hbase.replication.sync.enabled"; - public static final String REPLICATION_ATTR_NAME = "__rep__"; public static final String REMOTE_WAL_DIR_NAME = "remoteWALs"; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 34e362b..44e4ae4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1804,7 +1804,7 @@ public class HRegionServer extends HasThread implements boolean isMasterNoTableOrSystemTableOnly = this instanceof HMaster && (!LoadBalancer.isTablesOnMaster(conf) || LoadBalancer.isSystemTablesOnlyOnMaster(conf)); if (isMasterNoTableOrSystemTableOnly) { - conf.setBoolean(ReplicationUtils.SYNC_REPLICATION_ENABLED, false); + conf.setBoolean(WALFactory.SYNC_REPLICATION_WAL_PROVIDER_ENABLED, false); } WALFactory factory = new WALFactory(conf, serverName.toString()); if (!isMasterNoTableOrSystemTableOnly) { @@ -1925,11 +1925,8 @@ public class HRegionServer extends HasThread implements } this.executorService.startExecutorService(ExecutorType.RS_REFRESH_PEER, conf.getInt("hbase.regionserver.executor.refresh.peer.threads", 2)); - - if (conf.getBoolean(ReplicationUtils.SYNC_REPLICATION_ENABLED, false)) { - this.executorService.startExecutorService(ExecutorType.RS_REPLAY_SYNC_REPLICATION_WAL, - conf.getInt("hbase.regionserver.executor.replay.sync.replication.wal.threads", 2)); - } + this.executorService.startExecutorService(ExecutorType.RS_REPLAY_SYNC_REPLICATION_WAL, + conf.getInt("hbase.regionserver.executor.replay.sync.replication.wal.threads", 1)); Threads.setDaemonThreadRunning(this.walRoller.getThread(), getName() + ".logRoller", uncaughtExceptionHandler); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java index 1b8f52e..a6e6031 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java @@ -27,7 +27,6 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; import org.apache.hadoop.hbase.regionserver.wal.ProtobufLogReader; -import org.apache.hadoop.hbase.replication.ReplicationUtils; import org.apache.hadoop.hbase.util.CancelableProgressable; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.LeaseNotRecoveredException; @@ -83,6 +82,9 @@ public class WALFactory { public static final String META_WAL_PROVIDER = "hbase.wal.meta_provider"; static final String DEFAULT_META_WAL_PROVIDER = Providers.defaultProvider.name(); + public static final String SYNC_REPLICATION_WAL_PROVIDER_ENABLED = + "hbase.sync.replication.wal.provider.enabled"; + final String factoryId; private final WALProvider provider; // The meta updates are written to a different wal. If this @@ -160,7 +162,7 @@ public class WALFactory { // end required early initialization if (conf.getBoolean("hbase.regionserver.hlog.enabled", true)) { WALProvider provider = createProvider(getProviderClass(WAL_PROVIDER, DEFAULT_WAL_PROVIDER)); - if (conf.getBoolean(ReplicationUtils.SYNC_REPLICATION_ENABLED, false)) { + if (conf.getBoolean(SYNC_REPLICATION_WAL_PROVIDER_ENABLED, false)) { provider = new SyncReplicationWALProvider(provider); } provider.init(this, conf, null); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestSyncReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestSyncReplication.java index 196019d..617909d 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestSyncReplication.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestSyncReplication.java @@ -52,6 +52,7 @@ import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.testclassification.ReplicationTests; import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.hbase.wal.WALFactory; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.ClassRule; @@ -84,7 +85,7 @@ public class TestSyncReplication { private static void initTestingUtility(HBaseTestingUtility util, String zkParent) { util.setZkCluster(ZK_UTIL.getZkCluster()); Configuration conf = util.getConfiguration(); - conf.setBoolean(ReplicationUtils.SYNC_REPLICATION_ENABLED, true); + conf.setBoolean(WALFactory.SYNC_REPLICATION_WAL_PROVIDER_ENABLED, true); conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, zkParent); conf.setInt("replication.source.size.capacity", 102400); conf.setLong("replication.source.sleepforretries", 100); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/master/TestRecoverStandbyProcedure.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/master/TestRecoverStandbyProcedure.java index 5afdf7a..1f0eedc 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/master/TestRecoverStandbyProcedure.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/master/TestRecoverStandbyProcedure.java @@ -102,7 +102,6 @@ public class TestRecoverStandbyProcedure { @BeforeClass public static void setupCluster() throws Exception { - UTIL.getConfiguration().setBoolean(ReplicationUtils.SYNC_REPLICATION_ENABLED, true); UTIL.startMiniCluster(RS_NUMBER); UTIL.getHBaseCluster().waitForActiveAndReadyMaster(); conf = UTIL.getConfiguration(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSyncReplicationWALProvider.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSyncReplicationWALProvider.java index 488d9fb..3e8829c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSyncReplicationWALProvider.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestSyncReplicationWALProvider.java @@ -94,7 +94,7 @@ public class TestSyncReplicationWALProvider { @BeforeClass public static void setUpBeforeClass() throws Exception { - UTIL.getConfiguration().setBoolean(ReplicationUtils.SYNC_REPLICATION_ENABLED, true); + UTIL.getConfiguration().setBoolean(WALFactory.SYNC_REPLICATION_WAL_PROVIDER_ENABLED, true); UTIL.startMiniDFSCluster(3); FACTORY = new WALFactory(UTIL.getConfiguration(), "test"); ((SyncReplicationWALProvider) FACTORY.getWALProvider()).setPeerInfoProvider(new InfoProvider()); -- 1.9.1