From 539a97f91a3927f36b91e9aaec9aa04d9c6a63f4 Mon Sep 17 00:00:00 2001 From: chenheng Date: Wed, 22 Jun 2016 15:07:05 +0800 Subject: [PATCH] HBASE-16040 Remove configuration "hbase.replication" --- .../hbase/client/replication/ReplicationAdmin.java | 5 - .../java/org/apache/hadoop/hbase/HConstants.java | 4 - hbase-common/src/main/resources/hbase-default.xml | 2 - .../IntegrationTestRegionReplicaReplication.java | 1 - .../mapreduce/replication/VerifyReplication.java | 4 - .../hadoop/hbase/regionserver/HRegionServer.java | 6 -- .../master/ReplicationHFileCleaner.java | 7 +- .../replication/master/ReplicationLogCleaner.java | 6 -- .../replication/regionserver/Replication.java | 107 ++++++++------------- .../hadoop/hbase/util/ServerRegionReplicaUtil.java | 2 - .../client/replication/TestReplicationAdmin.java | 1 - ...ReplicationAdminWithTwoDifferentZKClusters.java | 1 - .../hbase/master/cleaner/TestLogsCleaner.java | 1 - .../hadoop/hbase/regionserver/TestClusterId.java | 1 - .../regionserver/TestRegionReplicaFailover.java | 1 - .../hbase/replication/TestMasterReplication.java | 25 ----- .../replication/TestMultiSlaveReplication.java | 1 - .../replication/TestPerTableCFReplication.java | 1 - .../hbase/replication/TestReplicationBase.java | 2 - .../TestRegionReplicaReplicationEndpoint.java | 1 - ...stRegionReplicaReplicationEndpointNoMaster.java | 1 - .../regionserver/TestReplicationSink.java | 2 - .../TestReplicationSourceManagerZkImpl.java | 2 - ...TestTableBasedReplicationSourceManagerImpl.java | 2 - ...tVisibilityLabelReplicationWithExpAsString.java | 2 - .../TestVisibilityLabelsReplication.java | 2 - hbase-shell/src/main/ruby/hbase/admin.rb | 68 ++++++------- src/main/asciidoc/_chapters/architecture.adoc | 2 +- src/main/asciidoc/_chapters/hbase-default.adoc | 3 +- src/main/asciidoc/_chapters/ops_mgt.adoc | 5 - 30 files changed, 76 insertions(+), 192 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java index b04d317..dca1821 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/replication/ReplicationAdmin.java @@ -113,11 +113,6 @@ public class ReplicationAdmin implements Closeable { * @throws RuntimeException if replication isn't enabled. */ public ReplicationAdmin(Configuration conf) throws IOException { - if (!conf.getBoolean(HConstants.REPLICATION_ENABLE_KEY, - HConstants.REPLICATION_ENABLE_DEFAULT)) { - throw new RuntimeException("hbase.replication isn't true, please " + - "enable it in order to use replication"); - } this.connection = ConnectionFactory.createConnection(conf); try { zkw = createZooKeeperWatcher(); 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 b05a520..fa4ce64 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 @@ -839,10 +839,6 @@ public final class HConstants { * cluster replication constants. */ public static final String - REPLICATION_ENABLE_KEY = "hbase.replication"; - public static final boolean - REPLICATION_ENABLE_DEFAULT = true; - public static final String REPLICATION_SOURCE_SERVICE_CLASSNAME = "hbase.replication.source.service"; public static final String REPLICATION_SINK_SERVICE_CLASSNAME = "hbase.replication.sink.service"; diff --git a/hbase-common/src/main/resources/hbase-default.xml b/hbase-common/src/main/resources/hbase-default.xml index 6010b7a..116c7d9 100644 --- a/hbase-common/src/main/resources/hbase-default.xml +++ b/hbase-common/src/main/resources/hbase-default.xml @@ -1518,8 +1518,6 @@ possible configurations would overwhelm and obscure the important. have region replication > 1. If this is enabled once, disabling this replication also requires disabling the replication peer using shell or ReplicationAdmin java class. Replication to secondary region replicas works over standard inter-cluster replication. - So replication, if disabled explicitly, also has to be enabled by setting "hbase.replication" - to true for this feature to work. diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaReplication.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaReplication.java index 33b2554..98d53e9 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaReplication.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaReplication.java @@ -98,7 +98,6 @@ public class IntegrationTestRegionReplicaReplication extends IntegrationTestInge // enable async wal replication to region replicas for unit tests conf.setBoolean(ServerRegionReplicaUtil.REGION_REPLICA_REPLICATION_CONF_KEY, true); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, true); conf.setLong(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, 1024L * 1024 * 4); // flush every 4 MB conf.setInt("hbase.hstore.blockingStoreFiles", 100); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java index f3175fd..16ff6fa 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/replication/VerifyReplication.java @@ -267,10 +267,6 @@ public class VerifyReplication extends Configured implements Tool { if (!doCommandLine(args)) { return null; } - if (!conf.getBoolean(HConstants.REPLICATION_ENABLE_KEY, - HConstants.REPLICATION_ENABLE_DEFAULT)) { - throw new IOException("Replication needs to be enabled to verify it."); - } conf.set(NAME+".peerId", peerId); conf.set(NAME+".tableName", tableName); conf.setLong(NAME+".startTime", startTime); 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 45a1095..1c1000e 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 @@ -2651,12 +2651,6 @@ public class HRegionServer extends HasThread implements static private void createNewReplicationInstance(Configuration conf, HRegionServer server, FileSystem fs, Path logDir, Path oldLogDir) throws IOException{ - // If replication is not enabled, then return immediately. - if (!conf.getBoolean(HConstants.REPLICATION_ENABLE_KEY, - HConstants.REPLICATION_ENABLE_DEFAULT)) { - return; - } - // read in the name of the source replication class from the config file. String sourceClassname = conf.get(HConstants.REPLICATION_SOURCE_SERVICE_CLASSNAME, HConstants.REPLICATION_SERVICE_CLASSNAME_DEFAULT); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationHFileCleaner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationHFileCleaner.java index a7b2f26..4c86244 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationHFileCleaner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationHFileCleaner.java @@ -117,12 +117,11 @@ public class ReplicationHFileCleaner extends BaseHFileCleanerDelegate { @Override public void setConf(Configuration config) { // If either replication or replication of bulk load hfiles is disabled, keep all members null - if (!(config.getBoolean(HConstants.REPLICATION_ENABLE_KEY, - HConstants.REPLICATION_ENABLE_DEFAULT) && config.getBoolean( + if (!(config.getBoolean( HConstants.REPLICATION_BULKLOAD_ENABLE_KEY, HConstants.REPLICATION_BULKLOAD_ENABLE_DEFAULT))) { - LOG.warn(HConstants.REPLICATION_ENABLE_KEY - + " is not enabled so allowing all hfile references to be deleted. Better to remove " + LOG.warn(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY + + " is not enabled. Better to remove " + ReplicationHFileCleaner.class + " from " + HFileCleaner.MASTER_HFILE_CLEANER_PLUGINS + " configuration."); return; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java index 9e724db..074c113 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationLogCleaner.java @@ -91,12 +91,6 @@ public class ReplicationLogCleaner extends BaseLogCleanerDelegate { @Override public void setConf(Configuration config) { - // If replication is disabled, keep all members null - if (!config.getBoolean(HConstants.REPLICATION_ENABLE_KEY, - HConstants.REPLICATION_ENABLE_DEFAULT)) { - LOG.warn("Not configured - allowing all wals to be deleted"); - return; - } // Make my own Configuration. Then I'll have my own connection to zk that // I can close myself when comes time. Configuration conf = new Configuration(config); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/Replication.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/Replication.java index d55472d..4f518bb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/Replication.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/Replication.java @@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.replication.regionserver; import static org.apache.hadoop.hbase.HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS; -import static org.apache.hadoop.hbase.HConstants.REPLICATION_ENABLE_KEY; import java.io.IOException; import java.util.ArrayList; @@ -72,7 +71,6 @@ public class Replication extends WALActionsListener.Base implements ReplicationSourceService, ReplicationSinkService { private static final Log LOG = LogFactory.getLog(Replication.class); - private boolean replication; private boolean replicationForBulkLoadData; private ReplicationSourceManager replicationManager; private ReplicationQueues replicationQueues; @@ -110,7 +108,6 @@ public class Replication extends WALActionsListener.Base implements final Path logDir, final Path oldLogDir) throws IOException { this.server = server; this.conf = this.server.getConfiguration(); - this.replication = isReplication(this.conf); this.replicationForBulkLoadData = isReplicationForBulkLoadDataEnabled(this.conf); this.scheduleThreadPool = Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder() @@ -125,49 +122,34 @@ public class Replication extends WALActionsListener.Base implements + " is set to true."); } } - if (replication) { - try { - this.replicationQueues = - ReplicationFactory.getReplicationQueues(new ReplicationQueuesArguments(conf, this.server, - server.getZooKeeper())); - this.replicationQueues.init(this.server.getServerName().toString()); - this.replicationPeers = - ReplicationFactory.getReplicationPeers(server.getZooKeeper(), this.conf, this.server); - this.replicationPeers.init(); - this.replicationTracker = - ReplicationFactory.getReplicationTracker(server.getZooKeeper(), this.replicationPeers, - this.conf, this.server, this.server); - } catch (Exception e) { - throw new IOException("Failed replication handler create", e); - } - UUID clusterId = null; - try { - clusterId = ZKClusterId.getUUIDForCluster(this.server.getZooKeeper()); - } catch (KeeperException ke) { - throw new IOException("Could not read cluster id", ke); - } - this.replicationManager = - new ReplicationSourceManager(replicationQueues, replicationPeers, replicationTracker, - conf, this.server, fs, logDir, oldLogDir, clusterId); - this.statsThreadPeriod = - this.conf.getInt("replication.stats.thread.period.seconds", 5 * 60); - LOG.debug("ReplicationStatisticsThread " + this.statsThreadPeriod); - this.replicationLoad = new ReplicationLoad(); - } else { - this.replicationManager = null; - this.replicationQueues = null; - this.replicationPeers = null; - this.replicationTracker = null; - this.replicationLoad = null; - } - } - /** - * @param c Configuration to look at - * @return True if replication is enabled. - */ - public static boolean isReplication(final Configuration c) { - return c.getBoolean(REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); + try { + this.replicationQueues = + ReplicationFactory.getReplicationQueues(new ReplicationQueuesArguments(conf, this.server, + server.getZooKeeper())); + this.replicationQueues.init(this.server.getServerName().toString()); + this.replicationPeers = + ReplicationFactory.getReplicationPeers(server.getZooKeeper(), this.conf, this.server); + this.replicationPeers.init(); + this.replicationTracker = + ReplicationFactory.getReplicationTracker(server.getZooKeeper(), this.replicationPeers, + this.conf, this.server, this.server); + } catch (Exception e) { + throw new IOException("Failed replication handler create", e); + } + UUID clusterId = null; + try { + clusterId = ZKClusterId.getUUIDForCluster(this.server.getZooKeeper()); + } catch (KeeperException ke) { + throw new IOException("Could not read cluster id", ke); + } + this.replicationManager = + new ReplicationSourceManager(replicationQueues, replicationPeers, replicationTracker, + conf, this.server, fs, logDir, oldLogDir, clusterId); + this.statsThreadPeriod = + this.conf.getInt("replication.stats.thread.period.seconds", 5 * 60); + LOG.debug("ReplicationStatisticsThread " + this.statsThreadPeriod); + this.replicationLoad = new ReplicationLoad(); } /** @@ -196,11 +178,9 @@ public class Replication extends WALActionsListener.Base implements * Join with the replication threads */ public void join() { - if (this.replication) { - this.replicationManager.join(); - if (this.replicationSink != null) { - this.replicationSink.stopReplicationSinkServices(); - } + this.replicationManager.join(); + if (this.replicationSink != null) { + this.replicationSink.stopReplicationSinkServices(); } scheduleThreadPool.shutdown(); } @@ -221,10 +201,8 @@ public class Replication extends WALActionsListener.Base implements public void replicateLogEntries(List entries, CellScanner cells, String replicationClusterId, String sourceBaseNamespaceDirPath, String sourceHFileArchiveDirPath) throws IOException { - if (this.replication) { - this.replicationSink.replicateEntries(entries, cells, replicationClusterId, - sourceBaseNamespaceDirPath, sourceHFileArchiveDirPath); - } + this.replicationSink.replicateEntries(entries, cells, replicationClusterId, + sourceBaseNamespaceDirPath, sourceHFileArchiveDirPath); } /** @@ -233,17 +211,15 @@ public class Replication extends WALActionsListener.Base implements * @throws IOException */ public void startReplicationService() throws IOException { - if (this.replication) { - try { - this.replicationManager.init(); - } catch (ReplicationException e) { - throw new IOException(e); - } - this.replicationSink = new ReplicationSink(this.conf, this.server); - this.scheduleThreadPool.scheduleAtFixedRate( - new ReplicationStatisticsThread(this.replicationSink, this.replicationManager), - statsThreadPeriod, statsThreadPeriod, TimeUnit.SECONDS); + try { + this.replicationManager.init(); + } catch (ReplicationException e) { + throw new IOException(e); } + this.replicationSink = new ReplicationSink(this.conf, this.server); + this.scheduleThreadPool.scheduleAtFixedRate( + new ReplicationStatisticsThread(this.replicationSink, this.replicationManager), + statsThreadPeriod, statsThreadPeriod, TimeUnit.SECONDS); } /** @@ -335,9 +311,6 @@ public class Replication extends WALActionsListener.Base implements * @param conf */ public static void decorateMasterConfiguration(Configuration conf) { - if (!isReplication(conf)) { - return; - } String plugins = conf.get(HBASE_MASTER_LOGCLEANER_PLUGINS); String cleanerClass = ReplicationLogCleaner.class.getCanonicalName(); if (!plugins.contains(cleanerClass)) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java index 2ba1b47..0655a0f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java @@ -47,8 +47,6 @@ public class ServerRegionReplicaUtil extends RegionReplicaUtil { * have region replication > 1. If this is enabled once, disabling this replication also * requires disabling the replication peer using shell or ReplicationAdmin java class. * Replication to secondary region replicas works over standard inter-cluster replication.· - * So replication, if disabled explicitly, also has to be enabled by setting "hbase.replication"· - * to true for this feature to work. */ public static final String REGION_REPLICA_REPLICATION_CONF_KEY = "hbase.region.replica.replication.enabled"; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.java index 06a3c7e..9c3f23a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.java @@ -76,7 +76,6 @@ public class TestReplicationAdmin { public static void setUpBeforeClass() throws Exception { TEST_UTIL.startMiniZKCluster(); Configuration conf = TEST_UTIL.getConfiguration(); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); admin = new ReplicationAdmin(conf); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithTwoDifferentZKClusters.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithTwoDifferentZKClusters.java index caf0d45..f2a5221 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithTwoDifferentZKClusters.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithTwoDifferentZKClusters.java @@ -45,7 +45,6 @@ public class TestReplicationAdminWithTwoDifferentZKClusters { @BeforeClass public static void setUpBeforeClass() throws Exception { - conf1.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); utility1 = new HBaseTestingUtility(conf1); utility1.startMiniCluster(); admin = new ReplicationAdmin(conf1); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java index eecaae1..b6b5492 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java @@ -92,7 +92,6 @@ public class TestLogsCleaner { // set TTL long ttl = 10000; conf.setLong("hbase.master.logcleaner.ttl", ttl); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); Replication.decorateMasterConfiguration(conf); Server server = new DummyServer(); ReplicationQueues repQueues = diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java index baea563..9c03201 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestClusterId.java @@ -96,7 +96,6 @@ public class TestClusterId { TEST_UTIL.startMiniZKCluster(); TEST_UTIL.startMiniDFSCluster(1); TEST_UTIL.createRootDir(); - TEST_UTIL.getConfiguration().setBoolean("hbase.replication", true); Path rootDir = FSUtils.getRootDir(TEST_UTIL.getConfiguration()); FileSystem fs = rootDir.getFileSystem(TEST_UTIL.getConfiguration()); Path filePath = new Path(rootDir, HConstants.CLUSTER_ID_FILE_NAME); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicaFailover.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicaFailover.java index 2329e9d..b3b04c2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicaFailover.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionReplicaFailover.java @@ -108,7 +108,6 @@ public class TestRegionReplicaFailover { Configuration conf = HTU.getConfiguration(); // Up the handlers; this test needs more than usual. conf.setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 10); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, true); conf.setBoolean(ServerRegionReplicaUtil.REGION_REPLICA_REPLICATION_CONF_KEY, true); conf.setBoolean(ServerRegionReplicaUtil.REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY, true); conf.setInt("replication.stats.thread.period.seconds", 5); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java index 775e4a5..02040e9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java @@ -117,8 +117,6 @@ public class TestMasterReplication { baseConfiguration.setLong("replication.source.sleepforretries", 100); baseConfiguration.setInt("hbase.regionserver.maxlogs", 10); baseConfiguration.setLong("hbase.master.logcleaner.ttl", 10); - baseConfiguration.setBoolean(HConstants.REPLICATION_ENABLE_KEY, - HConstants.REPLICATION_ENABLE_DEFAULT); baseConfiguration.setBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY, true); baseConfiguration.set("hbase.replication.source.fs.conf.provider", TestSourceFSConfigurationProvider.class.getCanonicalName()); @@ -429,29 +427,6 @@ public class TestMasterReplication { } } - /* - * Test RSRpcServices#replicateWALEntry when replication is disabled. This is to simulate - * HBASE-14840 - */ - @Test(timeout = 180000, expected = ServiceException.class) - public void testReplicateWALEntryWhenReplicationIsDisabled() throws Exception { - LOG.info("testSimplePutDelete"); - baseConfiguration.setBoolean(HConstants.REPLICATION_ENABLE_KEY, false); - Table[] htables = null; - try { - startMiniClusters(1); - createTableOnClusters(table); - htables = getHTablesOnClusters(tableName); - - HRegionServer rs = utilities[0].getRSForFirstRegionInTable(tableName); - RSRpcServices rsrpc = new RSRpcServices(rs); - rsrpc.replicateWALEntry(null, null); - } finally { - close(htables); - shutDownMiniClusters(); - } - } - @After public void tearDown() throws IOException { configurations = null; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java index b778864..544006c 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMultiSlaveReplication.java @@ -88,7 +88,6 @@ public class TestMultiSlaveReplication { conf1.setLong("replication.source.sleepforretries", 100); conf1.setInt("hbase.regionserver.maxlogs", 10); conf1.setLong("hbase.master.logcleaner.ttl", 10); - conf1.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); conf1.setBoolean("dfs.support.append", true); conf1.setLong(HConstants.THREAD_WAKE_FREQUENCY, 100); conf1.setStrings(CoprocessorHost.USER_REGION_COPROCESSOR_CONF_KEY, diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestPerTableCFReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestPerTableCFReplication.java index 8b7c0a5..9c314f4 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestPerTableCFReplication.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestPerTableCFReplication.java @@ -102,7 +102,6 @@ public class TestPerTableCFReplication { conf1.setLong("replication.source.sleepforretries", 100); conf1.setInt("hbase.regionserver.maxlogs", 10); conf1.setLong("hbase.master.logcleaner.ttl", 10); - conf1.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); conf1.setBoolean("dfs.support.append", true); conf1.setLong(HConstants.THREAD_WAKE_FREQUENCY, 100); conf1.setStrings(CoprocessorHost.USER_REGION_COPROCESSOR_CONF_KEY, diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java index 297e58f..526bc50 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java @@ -97,7 +97,6 @@ public class TestReplicationBase { conf1.setLong("hbase.master.logcleaner.ttl", 10); conf1.setInt("zookeeper.recovery.retry", 1); conf1.setInt("zookeeper.recovery.retry.intervalmill", 10); - conf1.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); conf1.setBoolean("dfs.support.append", true); conf1.setLong(HConstants.THREAD_WAKE_FREQUENCY, 100); conf1.setInt("replication.stats.thread.period.seconds", 5); @@ -120,7 +119,6 @@ public class TestReplicationBase { conf2 = HBaseConfiguration.create(conf1); conf2.set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/2"); conf2.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6); - conf2.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); conf2.setBoolean("dfs.support.append", true); conf2.setBoolean("hbase.tests.use.shortcircuit.reads", false); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java index 65600ff..5147339 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpoint.java @@ -89,7 +89,6 @@ public class TestRegionReplicaReplicationEndpoint { conf.setLong("hbase.master.logcleaner.ttl", 10); conf.setInt("zookeeper.recovery.retry", 1); conf.setInt("zookeeper.recovery.retry.intervalmill", 10); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, true); conf.setBoolean(ServerRegionReplicaUtil.REGION_REPLICA_REPLICATION_CONF_KEY, true); conf.setLong(HConstants.THREAD_WAKE_FREQUENCY, 100); conf.setInt("replication.stats.thread.period.seconds", 5); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java index 84d3bfc..6759daf 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestRegionReplicaReplicationEndpointNoMaster.java @@ -98,7 +98,6 @@ public class TestRegionReplicaReplicationEndpointNoMaster { @BeforeClass public static void beforeClass() throws Exception { Configuration conf = HTU.getConfiguration(); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, true); conf.setBoolean(ServerRegionReplicaUtil.REGION_REPLICA_REPLICATION_CONF_KEY, true); conf.setBoolean(ServerRegionReplicaUtil.REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY, false); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java index 1e80548..01e7871 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java @@ -116,8 +116,6 @@ public class TestReplicationSink { @BeforeClass public static void setUpBeforeClass() throws Exception { TEST_UTIL.getConfiguration().setBoolean("dfs.support.append", true); - TEST_UTIL.getConfiguration().setBoolean(HConstants.REPLICATION_ENABLE_KEY, - HConstants.REPLICATION_ENABLE_DEFAULT); TEST_UTIL.getConfiguration().set("hbase.replication.source.fs.conf.provider", TestSourceFSConfigurationProvider.class.getCanonicalName()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManagerZkImpl.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManagerZkImpl.java index 72042b1..f47e986 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManagerZkImpl.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSourceManagerZkImpl.java @@ -54,8 +54,6 @@ public class TestReplicationSourceManagerZkImpl extends TestReplicationSourceMan conf = HBaseConfiguration.create(); conf.set("replication.replicationsource.implementation", ReplicationSourceDummy.class.getCanonicalName()); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, - HConstants.REPLICATION_ENABLE_DEFAULT); conf.setLong("replication.sleep.before.failover", 2000); conf.setInt("replication.source.maxretriesmultiplier", 10); utility = new HBaseTestingUtility(conf); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestTableBasedReplicationSourceManagerImpl.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestTableBasedReplicationSourceManagerImpl.java index 59acfb3..b0636de 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestTableBasedReplicationSourceManagerImpl.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestTableBasedReplicationSourceManagerImpl.java @@ -43,8 +43,6 @@ public class TestTableBasedReplicationSourceManagerImpl extends TestReplicationS conf = HBaseConfiguration.create(); conf.set("replication.replicationsource.implementation", ReplicationSourceDummy.class.getCanonicalName()); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, - HConstants.REPLICATION_ENABLE_DEFAULT); conf.setLong("replication.sleep.before.failover", 2000); conf.setInt("replication.source.maxretriesmultiplier", 10); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelReplicationWithExpAsString.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelReplicationWithExpAsString.java index 9483ac9..573fc20 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelReplicationWithExpAsString.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelReplicationWithExpAsString.java @@ -93,7 +93,6 @@ public class TestVisibilityLabelReplicationWithExpAsString extends TestVisibilit conf.setInt("replication.stats.thread.period.seconds", 5); conf.setBoolean("hbase.tests.use.shortcircuit.reads", false); setVisibilityLabelServiceImpl(conf, ExpAsStringVisibilityLabelServiceImpl.class); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); conf.setStrings(HConstants.REPLICATION_CODEC_CONF_KEY, KeyValueCodecWithTags.class.getName()); VisibilityTestUtil.enableVisiblityLabels(conf); conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, @@ -124,7 +123,6 @@ public class TestVisibilityLabelReplicationWithExpAsString extends TestVisibilit conf1.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6); conf1.setBoolean("dfs.support.append", true); conf1.setBoolean("hbase.tests.use.shortcircuit.reads", false); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); conf1.setStrings(HConstants.REPLICATION_CODEC_CONF_KEY, KeyValueCodecWithTags.class.getName()); conf1.setStrings(CoprocessorHost.USER_REGION_COPROCESSOR_CONF_KEY, TestCoprocessorForTagsAtSink.class.getName()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java index 4ed47b0..346347e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java @@ -143,7 +143,6 @@ public class TestVisibilityLabelsReplication { conf.setInt("replication.stats.thread.period.seconds", 5); conf.setBoolean("hbase.tests.use.shortcircuit.reads", false); setVisibilityLabelServiceImpl(conf); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); conf.setStrings(HConstants.REPLICATION_CODEC_CONF_KEY, KeyValueCodecWithTags.class.getName()); VisibilityTestUtil.enableVisiblityLabels(conf); conf.set(CoprocessorHost.REGIONSERVER_COPROCESSOR_CONF_KEY, @@ -173,7 +172,6 @@ public class TestVisibilityLabelsReplication { conf1.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 6); conf1.setBoolean("dfs.support.append", true); conf1.setBoolean("hbase.tests.use.shortcircuit.reads", false); - conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, HConstants.REPLICATION_ENABLE_DEFAULT); conf1.setStrings(HConstants.REPLICATION_CODEC_CONF_KEY, KeyValueCodecWithTags.class.getName()); conf1.setStrings(CoprocessorHost.USER_REGION_COPROCESSOR_CONF_KEY, TestCoprocessorForTagsAtSink.class.getName()); diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb index d66c1d6..73a5863 100644 --- a/hbase-shell/src/main/ruby/hbase/admin.rb +++ b/hbase-shell/src/main/ruby/hbase/admin.rb @@ -709,43 +709,37 @@ module Hbase puts(" %s" % [ server ]) end elsif format == "replication" - #check whether replication is enabled or not - if (!@admin.getConfiguration().getBoolean(org.apache.hadoop.hbase.HConstants::REPLICATION_ENABLE_KEY, - org.apache.hadoop.hbase.HConstants::REPLICATION_ENABLE_DEFAULT)) - puts("Please enable replication first.") - else - puts("version %s" % [ status.getHBaseVersion() ]) - puts("%d live servers" % [ status.getServersSize() ]) - for server in status.getServers() - sl = status.getLoad(server) - rSinkString = " SINK :" - rSourceString = " SOURCE:" - rLoadSink = sl.getReplicationLoadSink() - rSinkString << " AgeOfLastAppliedOp=" + rLoadSink.getAgeOfLastAppliedOp().to_s - rSinkString << ", TimeStampsOfLastAppliedOp=" + - (java.util.Date.new(rLoadSink.getTimeStampsOfLastAppliedOp())).toString() - rLoadSourceList = sl.getReplicationLoadSourceList() - index = 0 - while index < rLoadSourceList.size() - rLoadSource = rLoadSourceList.get(index) - rSourceString << " PeerID=" + rLoadSource.getPeerID() - rSourceString << ", AgeOfLastShippedOp=" + rLoadSource.getAgeOfLastShippedOp().to_s - rSourceString << ", SizeOfLogQueue=" + rLoadSource.getSizeOfLogQueue().to_s - rSourceString << ", TimeStampsOfLastShippedOp=" + - (java.util.Date.new(rLoadSource.getTimeStampOfLastShippedOp())).toString() - rSourceString << ", Replication Lag=" + rLoadSource.getReplicationLag().to_s - index = index + 1 - end - puts(" %s:" % - [ server.getHostname() ]) - if type.casecmp("SOURCE") == 0 - puts("%s" % rSourceString) - elsif type.casecmp("SINK") == 0 - puts("%s" % rSinkString) - else - puts("%s" % rSourceString) - puts("%s" % rSinkString) - end + puts("version %s" % [ status.getHBaseVersion() ]) + puts("%d live servers" % [ status.getServersSize() ]) + for server in status.getServers() + sl = status.getLoad(server) + rSinkString = " SINK :" + rSourceString = " SOURCE:" + rLoadSink = sl.getReplicationLoadSink() + rSinkString << " AgeOfLastAppliedOp=" + rLoadSink.getAgeOfLastAppliedOp().to_s + rSinkString << ", TimeStampsOfLastAppliedOp=" + + (java.util.Date.new(rLoadSink.getTimeStampsOfLastAppliedOp())).toString() + rLoadSourceList = sl.getReplicationLoadSourceList() + index = 0 + while index < rLoadSourceList.size() + rLoadSource = rLoadSourceList.get(index) + rSourceString << " PeerID=" + rLoadSource.getPeerID() + rSourceString << ", AgeOfLastShippedOp=" + rLoadSource.getAgeOfLastShippedOp().to_s + rSourceString << ", SizeOfLogQueue=" + rLoadSource.getSizeOfLogQueue().to_s + rSourceString << ", TimeStampsOfLastShippedOp=" + + (java.util.Date.new(rLoadSource.getTimeStampOfLastShippedOp())).toString() + rSourceString << ", Replication Lag=" + rLoadSource.getReplicationLag().to_s + index = index + 1 + end + puts(" %s:" % + [ server.getHostname() ]) + if type.casecmp("SOURCE") == 0 + puts("%s" % rSourceString) + elsif type.casecmp("SINK") == 0 + puts("%s" % rSinkString) + else + puts("%s" % rSourceString) + puts("%s" % rSinkString) end end elsif format == "simple" diff --git a/src/main/asciidoc/_chapters/architecture.adoc b/src/main/asciidoc/_chapters/architecture.adoc index 9f59cd5..71fcc38 100644 --- a/src/main/asciidoc/_chapters/architecture.adoc +++ b/src/main/asciidoc/_chapters/architecture.adoc @@ -2564,7 +2564,7 @@ Instead you can change the number of region replicas per table to increase or de hbase.region.replica.replication.enabled true - Whether asynchronous WAL replication to the secondary region replicas is enabled or not. If this is enabled, a replication peer named "region_replica_replication" will be created which will tail the logs and replicate the mutations to region replicas for tables that have region replication > 1. If this is enabled once, disabling this replication also requires disabling the replication peer using shell or ReplicationAdmin java class. Replication to secondary region replicas works over standard inter-cluster replication. So replication, if disabled explicitly, also has to be enabled by setting "hbase.replication"· to true for this feature to work. + Whether asynchronous WAL replication to the secondary region replicas is enabled or not. If this is enabled, a replication peer named "region_replica_replication" will be created which will tail the logs and replicate the mutations to region replicas for tables that have region replication > 1. If this is enabled once, disabling this replication also requires disabling the replication peer using shell or ReplicationAdmin java class. Replication to secondary region replicas works over standard inter-cluster replication. diff --git a/src/main/asciidoc/_chapters/hbase-default.adoc b/src/main/asciidoc/_chapters/hbase-default.adoc index 7a65446..60c0849 100644 --- a/src/main/asciidoc/_chapters/hbase-default.adoc +++ b/src/main/asciidoc/_chapters/hbase-default.adoc @@ -2063,8 +2063,7 @@ Fully qualified name of class implementing coordinated state manager. have region replication > 1. If this is enabled once, disabling this replication also requires disabling the replication peer using shell or ReplicationAdmin java class. Replication to secondary region replicas works over standard inter-cluster replication. - So replication, if disabled explicitly, also has to be enabled by setting "hbase.replication" - to true for this feature to work. + + .Default diff --git a/src/main/asciidoc/_chapters/ops_mgt.adoc b/src/main/asciidoc/_chapters/ops_mgt.adoc index 590854e..13449c1 100644 --- a/src/main/asciidoc/_chapters/ops_mgt.adoc +++ b/src/main/asciidoc/_chapters/ops_mgt.adoc @@ -1648,11 +1648,6 @@ The following metrics are exposed at the global region server level and (since H | The name of the rs znode | rs -| hbase.replication -| Whether replication is enabled or disabled on a given - cluster -| true - | replication.sleep.before.failover | How many milliseconds a worker should sleep before attempting to replicate a dead region server's WAL queues. -- 1.9.3 (Apple Git-50)