From c4b92c2d0587b2207984a19f44c5303950d345c3 Mon Sep 17 00:00:00 2001 From: maoling Date: Wed, 21 Feb 2018 22:36:40 +0800 Subject: [PATCH 01/19] HBASE-19761:Fix Checkstyle errors in hbase-zookeeper --- hbase-zookeeper/pom.xml | 16 ++++++++++++++++ .../hadoop/hbase/zookeeper/MetaTableLocator.java | 8 ++++---- .../hadoop/hbase/zookeeper/ZKMainServer.java | 6 +++--- .../apache/hadoop/hbase/zookeeper/ZKWatcher.java | 10 ++++++---- .../hbase/zookeeper/TestZKLeaderManager.java | 1 - .../hadoop/hbase/zookeeper/TestZKMainServer.java | 2 +- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/hbase-zookeeper/pom.xml b/hbase-zookeeper/pom.xml index a7cde510a936..d1d1975e4ef4 100644 --- a/hbase-zookeeper/pom.xml +++ b/hbase-zookeeper/pom.xml @@ -91,6 +91,22 @@ org.codehaus.mojo findbugs-maven-plugin + + org.apache.maven.plugins + maven-checkstyle-plugin + + + checkstyle + validate + + check + + + true + + + + net.revelc.code warbucks-maven-plugin diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java index 76c12d0c84e7..4c170f7e744f 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java @@ -388,7 +388,7 @@ private static AdminService.BlockingInterface getCachedConnection(ClusterConnect service = connection.getAdmin(sn); } catch (RetriesExhaustedException e) { if (e.getCause() != null && e.getCause() instanceof ConnectException) { - // Catch this; presume it means the cached connection has gone bad. + LOG.debug("Catch this; presume it means the cached connection has gone bad."); } else { throw e; } @@ -407,12 +407,12 @@ private static AdminService.BlockingInterface getCachedConnection(ClusterConnect } catch (IOException ioe) { Throwable cause = ioe.getCause(); if (ioe instanceof ConnectException) { - // Catch. Connect refused. + LOG.debug("Catch. Connect refused."); } else if (cause != null && cause instanceof EOFException) { - // Catch. Other end disconnected us. + LOG.debug("Catch. Other end disconnected us."); } else if (cause != null && cause.getMessage() != null && cause.getMessage().toLowerCase(Locale.ROOT).contains("connection reset")) { - // Catch. Connection reset. + LOG.debug("Catch. Connection reset."); } else { throw ioe; } diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java index 2488682bcbc4..277c422b2216 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKMainServer.java @@ -57,9 +57,9 @@ public HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(String[] args) /** * Run the command-line args passed. Calls System.exit when done. - * @throws KeeperException - * @throws IOException - * @throws InterruptedException + * @throws KeeperException zookeeper exception + * @throws IOException if fail to runCmdLine + * @throws InterruptedException unexpected thread exception */ void runCmdLine() throws KeeperException, IOException, InterruptedException { processCmd(this.cl); diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java index c3cac5f3d20f..4cd84178c419 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java @@ -76,14 +76,14 @@ public class ZKWatcher implements Watcher, Abortable, Closeable { // Used if abortable is null private boolean aborted = false; - public final ZNodePaths znodePaths; + protected final ZNodePaths znodePaths; // listeners to be notified private final List listeners = new CopyOnWriteArrayList<>(); // Used by ZKUtil:waitForZKConnectionIfAuthenticating to wait for SASL // negotiation to complete - public CountDownLatch saslLatch = new CountDownLatch(1); + private CountDownLatch saslLatch = new CountDownLatch(1); private final Configuration conf; @@ -95,7 +95,7 @@ public class ZKWatcher implements Watcher, Abortable, Closeable { * @param identifier string that is passed to RecoverableZookeeper to be used as * identifier for this instance. Use null for default. * @throws IOException if the connection to ZooKeeper fails - * @throws ZooKeeperConnectionException + * @throws ZooKeeperConnectionException if the client can't connect to zookeeper */ public ZKWatcher(Configuration conf, String identifier, Abortable abortable) throws ZooKeeperConnectionException, IOException { @@ -111,7 +111,7 @@ public ZKWatcher(Configuration conf, String identifier, * context. * @param canCreateBaseZNode true if a base ZNode can be created * @throws IOException if the connection to ZooKeeper fails - * @throws ZooKeeperConnectionException + * @throws ZooKeeperConnectionException if the client can't connect to zookeeper */ public ZKWatcher(Configuration conf, String identifier, Abortable abortable, boolean canCreateBaseZNode) @@ -517,6 +517,8 @@ public void process(WatchedEvent event) { } break; } + default: + throw new IllegalStateException("Received event is not valid: " + event.getState()); } } diff --git a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKLeaderManager.java b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKLeaderManager.java index 8371f91c318b..432779e9ebd9 100644 --- a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKLeaderManager.java +++ b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKLeaderManager.java @@ -18,7 +18,6 @@ package org.apache.hadoop.hbase.zookeeper; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMainServer.java b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMainServer.java index f8052603c1da..d1c18d3548e2 100644 --- a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMainServer.java +++ b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMainServer.java @@ -43,7 +43,7 @@ public class TestZKMainServer { // http://stackoverflow.com/questions/309396/java-how-to-test-methods-that-call-system-exit protected static class ExitException extends SecurityException { private static final long serialVersionUID = 1L; - public final int status; + private final int status; public ExitException(int status) { super("There is no escape!"); this.status = status; From a9c9ed66295287c1d44b50cdce4ad3fecdf95086 Mon Sep 17 00:00:00 2001 From: maoling Date: Sat, 7 Apr 2018 16:23:18 +0800 Subject: [PATCH 02/19] back to public --- .../main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java index 4cd84178c419..47aeee89f9b8 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java @@ -76,7 +76,7 @@ public class ZKWatcher implements Watcher, Abortable, Closeable { // Used if abortable is null private boolean aborted = false; - protected final ZNodePaths znodePaths; + public final ZNodePaths znodePaths; // listeners to be notified private final List listeners = new CopyOnWriteArrayList<>(); From f71ba6950b3bf80cec928f6cbdbe7c80b99ebb60 Mon Sep 17 00:00:00 2001 From: Peter Somogyi Date: Thu, 5 Apr 2018 12:12:14 +0200 Subject: [PATCH 03/19] HBASE-20287 After cluster startup list_regions command fails on disabled table Add is_enabled check for list_regions command Signed-off-by: Mike Drob --- .../src/main/ruby/shell/commands/list_regions.rb | 2 ++ hbase-shell/src/test/ruby/hbase/admin_test.rb | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/hbase-shell/src/main/ruby/shell/commands/list_regions.rb b/hbase-shell/src/main/ruby/shell/commands/list_regions.rb index bcc0c4aaf343..0ce569c0a313 100644 --- a/hbase-shell/src/main/ruby/shell/commands/list_regions.rb +++ b/hbase-shell/src/main/ruby/shell/commands/list_regions.rb @@ -50,6 +50,8 @@ def command(table_name, options = nil, cols = nil) options = { SERVER_NAME => options } end + raise "Table #{table_name} must be enabled." unless admin.enabled?(table_name) + size_hash = {} if cols.nil? size_hash = { 'SERVER_NAME' => 12, 'REGION_NAME' => 12, 'START_KEY' => 10, 'END_KEY' => 10, 'SIZE' => 5, 'REQ' => 5, 'LOCALITY' => 10 } diff --git a/hbase-shell/src/test/ruby/hbase/admin_test.rb b/hbase-shell/src/test/ruby/hbase/admin_test.rb index 929484c51d2b..a27bbc508226 100644 --- a/hbase-shell/src/test/ruby/hbase/admin_test.rb +++ b/hbase-shell/src/test/ruby/hbase/admin_test.rb @@ -319,6 +319,18 @@ def teardown admin.truncate_preserve(@create_test_name, $TEST_CLUSTER.getConfiguration) assert_equal(splits, table(@create_test_name)._get_splits_internal()) end + + #------------------------------------------------------------------------------- + + define_test "list_regions should fail for disabled table" do + drop_test_table(@create_test_name) + admin.create(@create_test_name, 'a') + command(:disable, @create_test_name) + assert(:is_disabled, @create_test_name) + assert_raise(RuntimeError) do + command(:list_regions, @create_test_name) + end + end end # Simple administration methods tests From c016928f185320685684a0012ad15be5b8e0338c Mon Sep 17 00:00:00 2001 From: zhangduo Date: Sun, 8 Apr 2018 15:31:02 +0800 Subject: [PATCH 04/19] HBASE-20362 TestMasterShutdown.testMasterShutdownBeforeStartingAnyRegionServer is flaky --- .../org/apache/hadoop/hbase/client/Admin.java | 15 ++++++++++++--- .../hadoop/hbase/master/TestMasterShutdown.java | 10 +++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java index b8546fa45335..a6a42244e21f 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Admin.java @@ -1,5 +1,4 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -1415,15 +1414,25 @@ Future modifyTableAsync(TableDescriptor td) throws IOException; /** + *

* Shuts down the HBase cluster. - * + *

+ *

+ * Notice that, a success shutdown call may ends with an error since the remote server has already + * been shutdown. + *

* @throws IOException if a remote or network exception occurs */ void shutdown() throws IOException; /** + *

* Shuts down the current HBase master only. Does not shutdown the cluster. - * + *

+ *

+ * Notice that, a success stopMaster call may ends with an error since the remote server has + * already been shutdown. + *

* @throws IOException if a remote or network exception occurs * @see #shutdown() */ diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java index 0844e81f744c..63cfe1f0c9c9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterShutdown.java @@ -55,7 +55,6 @@ public class TestMasterShutdown { *

* Starts with three masters. Tells the active master to shutdown the cluster. * Verifies that all masters are properly shutdown. - * @throws Exception */ @Test public void testMasterShutdown() throws Exception { @@ -130,16 +129,17 @@ public void testMasterShutdownBeforeStartingAnyRegionServer() throws Exception { public void run() { LOG.info("Before call to shutdown master"); try { - try (Connection connection = - ConnectionFactory.createConnection(util.getConfiguration())) { + try ( + Connection connection = ConnectionFactory.createConnection(util.getConfiguration())) { try (Admin admin = connection.getAdmin()) { admin.shutdown(); } } - LOG.info("After call to shutdown master"); - cluster.waitOnMaster(MASTER_INDEX); } catch (Exception e) { + LOG.info("Error while calling Admin.shutdown, which is expected: " + e.getMessage()); } + LOG.info("After call to shutdown master"); + cluster.waitOnMaster(MASTER_INDEX); } }; shutdownThread.start(); From 2eddc9ad54aeeb512ec4dad02c0dfb07f69571dc Mon Sep 17 00:00:00 2001 From: zhangduo Date: Sun, 8 Apr 2018 16:29:01 +0800 Subject: [PATCH 05/19] HBASE-20363 TestNamespaceAuditor.testRegionMerge is flaky --- .../hbase/namespace/TestNamespaceAuditor.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java index 89687eb0f2cd..40aba85e3b01 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java @@ -72,6 +72,7 @@ import org.apache.hadoop.hbase.quotas.MasterQuotaManager; import org.apache.hadoop.hbase.quotas.QuotaExceededException; import org.apache.hadoop.hbase.quotas.QuotaUtil; +import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.Store; import org.apache.hadoop.hbase.regionserver.StoreFile; import org.apache.hadoop.hbase.regionserver.compactions.CompactionLifeCycleTracker; @@ -348,24 +349,24 @@ public void testRegionMerge() throws Exception { UTIL.loadNumericRows(table, Bytes.toBytes("info"), 1000, 1999); } ADMIN.flush(tableTwo); - List hris = ADMIN.getTableRegions(tableTwo); + List hris = ADMIN.getRegions(tableTwo); assertEquals(initialRegions, hris.size()); - Collections.sort(hris); + Collections.sort(hris, RegionInfo.COMPARATOR); Future f = ADMIN.mergeRegionsAsync( hris.get(0).getEncodedNameAsBytes(), hris.get(1).getEncodedNameAsBytes(), false); f.get(10, TimeUnit.SECONDS); - hris = ADMIN.getTableRegions(tableTwo); + hris = ADMIN.getRegions(tableTwo); assertEquals(initialRegions - 1, hris.size()); - Collections.sort(hris); - ADMIN.split(tableTwo, Bytes.toBytes("3")); - // Not much we can do here until we have split return a Future. - Threads.sleep(5000); - hris = ADMIN.getTableRegions(tableTwo); + Collections.sort(hris, RegionInfo.COMPARATOR); + UTIL.compact(tableTwo, true); + ADMIN.splitRegionAsync(hris.get(0).getRegionName(), Bytes.toBytes("3")).get(10, + TimeUnit.SECONDS); + hris = ADMIN.getRegions(tableTwo); assertEquals(initialRegions, hris.size()); - Collections.sort(hris); + Collections.sort(hris, RegionInfo.COMPARATOR); // Fail region merge through Coprocessor hook MiniHBaseCluster cluster = UTIL.getHBaseCluster(); @@ -384,11 +385,10 @@ public void testRegionMerge() throws Exception { } catch (ExecutionException ee) { // Expected. } - hris = ADMIN.getTableRegions(tableTwo); + hris = ADMIN.getRegions(tableTwo); assertEquals(initialRegions, hris.size()); - Collections.sort(hris); + Collections.sort(hris, RegionInfo.COMPARATOR); // verify that we cannot split - HRegionInfo hriToSplit2 = hris.get(1); try { ADMIN.split(tableTwo, Bytes.toBytes("6")); fail(); @@ -396,7 +396,7 @@ public void testRegionMerge() throws Exception { // Expected } Thread.sleep(2000); - assertEquals(initialRegions, ADMIN.getTableRegions(tableTwo).size()); + assertEquals(initialRegions, ADMIN.getRegions(tableTwo).size()); } /* From fb27104ce3655ba93c1eb247222fe86ceccfbaa2 Mon Sep 17 00:00:00 2001 From: Yuki Tawara Date: Sun, 8 Apr 2018 01:46:52 +0900 Subject: [PATCH 06/19] HBASE-20361 Non-successive TableInputSplits may wrongly be merged by auto balancing feature Signed-off-by: tedyu --- .../hbase/mapreduce/TableInputFormatBase.java | 12 +- .../mapreduce/TestTableInputFormatBase.java | 232 ++++++++++++++++++ 2 files changed, 242 insertions(+), 2 deletions(-) diff --git a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java index d8031d91f8e5..24973c941e73 100644 --- a/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java +++ b/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/TableInputFormatBase.java @@ -53,6 +53,7 @@ import org.apache.hadoop.mapreduce.TaskAttemptContext; import org.apache.hadoop.net.DNS; import org.apache.hadoop.util.StringUtils; +import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting; /** * A base for {@link TableInputFormat}s. Receives a {@link Connection}, a {@link TableName}, @@ -291,7 +292,7 @@ public List getSplits(JobContext context) throws IOException { */ private List oneInputSplitPerRegion() throws IOException { RegionSizeCalculator sizeCalculator = - new RegionSizeCalculator(getRegionLocator(), getAdmin()); + createRegionSizeCalculator(getRegionLocator(), getAdmin()); TableName tableName = getTable().getName(); @@ -478,7 +479,8 @@ public List calculateAutoBalancedSplits(List splits, lon while (j < splits.size()) { TableSplit nextRegion = (TableSplit) splits.get(j); long nextRegionSize = nextRegion.getLength(); - if (totalSize + nextRegionSize <= averageRegionSize) { + if (totalSize + nextRegionSize <= averageRegionSize + && Bytes.equals(splitEndKey, nextRegion.getStartRow())) { totalSize = totalSize + nextRegionSize; splitEndKey = nextRegion.getEndRow(); j++; @@ -586,6 +588,12 @@ protected void initializeTable(Connection connection, TableName tableName) throw this.connection = connection; } + @VisibleForTesting + protected RegionSizeCalculator createRegionSizeCalculator(RegionLocator locator, Admin admin) + throws IOException { + return new RegionSizeCalculator(locator, admin); + } + /** * Gets the scan defining the actual details like columns etc. * diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatBase.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatBase.java index 5fa4b5469157..29a92ee75c06 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatBase.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableInputFormatBase.java @@ -18,15 +18,45 @@ package org.apache.hadoop.hbase.mapreduce; import static org.junit.Assert.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyBoolean; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import java.io.IOException; import java.net.Inet6Address; import java.net.InetAddress; import java.net.UnknownHostException; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.ExecutorService; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.HRegionLocation; +import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.client.Admin; +import org.apache.hadoop.hbase.client.BufferedMutator; +import org.apache.hadoop.hbase.client.BufferedMutatorParams; +import org.apache.hadoop.hbase.client.ClusterConnection; +import org.apache.hadoop.hbase.client.Connection; +import org.apache.hadoop.hbase.client.RegionInfo; +import org.apache.hadoop.hbase.client.RegionInfoBuilder; +import org.apache.hadoop.hbase.client.RegionLocator; +import org.apache.hadoop.hbase.client.Table; +import org.apache.hadoop.hbase.client.TableBuilder; +import org.apache.hadoop.hbase.security.User; import org.apache.hadoop.hbase.testclassification.SmallTests; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.hbase.util.Pair; +import org.apache.hadoop.mapreduce.JobContext; import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; @Category({SmallTests.class}) public class TestTableInputFormatBase { @@ -55,4 +85,206 @@ public void testTableInputFormatBaseReverseDNSForIPv6() assertEquals("Should retrun the hostname for this host. Expected : " + localhost + " Actual : " + actualHostName, localhost, actualHostName); } + + @Test + public void testNonSuccessiveSplitsAreNotMerged() throws IOException { + JobContext context = mock(JobContext.class); + Configuration conf = HBaseConfiguration.create(); + conf.set(ClusterConnection.HBASE_CLIENT_CONNECTION_IMPL, + ConnectionForMergeTesting.class.getName()); + conf.set(TableInputFormat.INPUT_TABLE, "testTable"); + conf.setBoolean(TableInputFormatBase.MAPREDUCE_INPUT_AUTOBALANCE, true); + when(context.getConfiguration()).thenReturn(conf); + + TableInputFormat tifExclude = new TableInputFormatForMergeTesting(); + tifExclude.setConf(conf); + // split["b", "c"] is excluded, split["o", "p"] and split["p", "q"] are merged, + // but split["a", "b"] and split["c", "d"] are not merged. + assertEquals(ConnectionForMergeTesting.START_KEYS.length - 1 - 1, + tifExclude.getSplits(context).size()); + } + + /** + * Subclass of {@link TableInputFormat} to use in {@link #testNonSuccessiveSplitsAreNotMerged}. + * This class overrides {@link TableInputFormatBase#includeRegionInSplit} + * to exclude specific splits. + */ + private static class TableInputFormatForMergeTesting extends TableInputFormat { + private byte[] prefixStartKey = Bytes.toBytes("b"); + private byte[] prefixEndKey = Bytes.toBytes("c"); + private RegionSizeCalculator sizeCalculator; + + /** + * Exclude regions which contain rows starting with "b". + */ + @Override + protected boolean includeRegionInSplit(final byte[] startKey, final byte [] endKey) { + if (Bytes.compareTo(startKey, prefixEndKey) < 0 + && (Bytes.compareTo(prefixStartKey, endKey) < 0 + || Bytes.equals(endKey, HConstants.EMPTY_END_ROW))) { + return false; + } else { + return true; + } + } + + @Override + protected void initializeTable(Connection connection, TableName tableName) throws IOException { + super.initializeTable(connection, tableName); + ConnectionForMergeTesting cft = (ConnectionForMergeTesting) connection; + sizeCalculator = cft.getRegionSizeCalculator(); + } + + @Override + protected RegionSizeCalculator createRegionSizeCalculator(RegionLocator locator, Admin admin) + throws IOException { + return sizeCalculator; + } + } + + /** + * Connection class to use in {@link #testNonSuccessiveSplitsAreNotMerged}. + * This class returns mocked {@link Table}, {@link RegionLocator}, {@link RegionSizeCalculator}, + * and {@link Admin}. + */ + private static class ConnectionForMergeTesting implements Connection { + public static final byte[][] SPLITS = new byte[][] { + Bytes.toBytes("a"), Bytes.toBytes("b"), Bytes.toBytes("c"), Bytes.toBytes("d"), + Bytes.toBytes("e"), Bytes.toBytes("f"), Bytes.toBytes("g"), Bytes.toBytes("h"), + Bytes.toBytes("i"), Bytes.toBytes("j"), Bytes.toBytes("k"), Bytes.toBytes("l"), + Bytes.toBytes("m"), Bytes.toBytes("n"), Bytes.toBytes("o"), Bytes.toBytes("p"), + Bytes.toBytes("q"), Bytes.toBytes("r"), Bytes.toBytes("s"), Bytes.toBytes("t"), + Bytes.toBytes("u"), Bytes.toBytes("v"), Bytes.toBytes("w"), Bytes.toBytes("x"), + Bytes.toBytes("y"), Bytes.toBytes("z") + }; + + public static final byte[][] START_KEYS; + public static final byte[][] END_KEYS; + static { + START_KEYS = new byte[SPLITS.length + 1][]; + START_KEYS[0] = HConstants.EMPTY_BYTE_ARRAY; + for (int i = 0; i < SPLITS.length; i++) { + START_KEYS[i + 1] = SPLITS[i]; + } + + END_KEYS = new byte[SPLITS.length + 1][]; + for (int i = 0; i < SPLITS.length; i++) { + END_KEYS[i] = SPLITS[i]; + } + END_KEYS[SPLITS.length] = HConstants.EMPTY_BYTE_ARRAY; + } + + public static final Map SIZE_MAP = new TreeMap<>(Bytes.BYTES_COMPARATOR); + static { + for (byte[] startKey : START_KEYS) { + SIZE_MAP.put(startKey, 1024L * 1024L * 1024L); + } + SIZE_MAP.put(Bytes.toBytes("a"), 200L * 1024L * 1024L); + SIZE_MAP.put(Bytes.toBytes("b"), 200L * 1024L * 1024L); + SIZE_MAP.put(Bytes.toBytes("c"), 200L * 1024L * 1024L); + SIZE_MAP.put(Bytes.toBytes("o"), 200L * 1024L * 1024L); + SIZE_MAP.put(Bytes.toBytes("p"), 200L * 1024L * 1024L); + } + + ConnectionForMergeTesting(Configuration conf, ExecutorService pool, User user) + throws IOException { + } + + @Override + public void abort(String why, Throwable e) { + } + + @Override + public boolean isAborted() { + return false; + } + + @Override + public Configuration getConfiguration() { + throw new UnsupportedOperationException(); + } + + @Override + public Table getTable(TableName tableName) throws IOException { + Table table = mock(Table.class); + when(table.getName()).thenReturn(tableName); + return table; + } + + @Override + public Table getTable(TableName tableName, ExecutorService pool) throws IOException { + throw new UnsupportedOperationException(); + } + + @Override + public BufferedMutator getBufferedMutator(TableName tableName) throws IOException { + throw new UnsupportedOperationException(); + } + + @Override + public BufferedMutator getBufferedMutator(BufferedMutatorParams params) throws IOException { + throw new UnsupportedOperationException(); + } + + @Override + public RegionLocator getRegionLocator(TableName tableName) throws IOException { + final Map locationMap = new TreeMap<>(Bytes.BYTES_COMPARATOR); + for (byte[] startKey : START_KEYS) { + HRegionLocation hrl = new HRegionLocation( + RegionInfoBuilder.newBuilder(tableName).setStartKey(startKey).build(), + ServerName.valueOf("localhost", 0, 0)); + locationMap.put(startKey, hrl); + } + + RegionLocator locator = mock(RegionLocator.class); + when(locator.getRegionLocation(any(byte [].class), anyBoolean())). + thenAnswer(new Answer() { + @Override + public HRegionLocation answer(InvocationOnMock invocationOnMock) throws Throwable { + Object [] args = invocationOnMock.getArguments(); + byte [] key = (byte [])args[0]; + return locationMap.get(key); + } + }); + when(locator.getStartEndKeys()). + thenReturn(new Pair(START_KEYS, END_KEYS)); + return locator; + } + + public RegionSizeCalculator getRegionSizeCalculator() { + RegionSizeCalculator sizeCalculator = mock(RegionSizeCalculator.class); + when(sizeCalculator.getRegionSize(any(byte[].class))). + thenAnswer(new Answer() { + @Override + public Long answer(InvocationOnMock invocationOnMock) throws Throwable { + Object [] args = invocationOnMock.getArguments(); + byte [] regionId = (byte [])args[0]; + byte[] startKey = RegionInfo.getStartKey(regionId); + return SIZE_MAP.get(startKey); + } + }); + return sizeCalculator; + } + + @Override + public Admin getAdmin() throws IOException { + Admin admin = mock(Admin.class); + // return non-null admin to pass null checks + return admin; + } + + @Override + public void close() throws IOException { + } + + @Override + public boolean isClosed() { + return false; + } + + @Override + public TableBuilder getTableBuilder(TableName tableName, ExecutorService pool) { + throw new UnsupportedOperationException(); + } + } } From c84fcfaf2deaa68cf7db9c606920951943e3d920 Mon Sep 17 00:00:00 2001 From: zhangduo Date: Mon, 9 Apr 2018 09:04:32 +0800 Subject: [PATCH 07/19] HBASE-20363 Addendum wait until region is splittable --- .../hadoop/hbase/namespace/TestNamespaceAuditor.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java index 40aba85e3b01..1b4957ad3612 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/namespace/TestNamespaceAuditor.java @@ -361,8 +361,14 @@ public void testRegionMerge() throws Exception { hris = ADMIN.getRegions(tableTwo); assertEquals(initialRegions - 1, hris.size()); Collections.sort(hris, RegionInfo.COMPARATOR); - UTIL.compact(tableTwo, true); - ADMIN.splitRegionAsync(hris.get(0).getRegionName(), Bytes.toBytes("3")).get(10, + byte[] splitKey = Bytes.toBytes("3"); + HRegion regionToSplit = UTIL.getMiniHBaseCluster().getRegions(tableTwo).stream() + .filter(r -> r.getRegionInfo().containsRow(splitKey)).findFirst().get(); + regionToSplit.compact(true); + // the above compact may quit immediately if there is a compaction ongoing, so here we need to + // wait a while to let the ongoing compaction finish. + UTIL.waitFor(10000, regionToSplit::isSplittable); + ADMIN.splitRegionAsync(regionToSplit.getRegionInfo().getRegionName(), splitKey).get(10, TimeUnit.SECONDS); hris = ADMIN.getRegions(tableTwo); assertEquals(initialRegions, hris.size()); From 78636dde112c88f4a3b9cd3c05c86719afdb428d Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Thu, 5 Apr 2018 15:22:41 -0500 Subject: [PATCH 08/19] HBASE-15466 test personality should recognize docs-only patch. * add a new test to build the refguide specifically instead of site * check for changes to src/main/asciidoc or src/main/xslt and run that test and only that test * check for changes to the hbase-default.xml file and build the refguide if found (but maybe other tests too) * fallback to relying on the yetus default for other changes * fix some missing start_clock entries that cause longer-than-actual reported test time. Signed-off-by: Mike Drob --- dev-support/hbase-personality.sh | 92 ++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh index b67777affd56..d34f7613f4f5 100755 --- a/dev-support/hbase-personality.sh +++ b/dev-support/hbase-personality.sh @@ -180,6 +180,26 @@ function personality_modules done } +## @description places where we override the built in assumptions about what tests to run +## @audience private +## @stability evolving +## @param filename of changed file +function personality_file_tests +{ + local filename=$1 + # If the change is to the refguide, then we don't need any builtin yetus tests + # the refguide test (below) will suffice for coverage. + if [[ ${filename} =~ src/main/asciidoc ]] || + [[ ${filename} =~ src/main/xslt ]]; then + yetus_debug "Skipping builtin yetus checks for ${filename}. refguide test should pick it up." + # fallback to checking which tests based on what yetus would do by default + elif declare -f "${BUILDTOOL}_builtin_personality_file_tests" >/dev/null; then + "${BUILDTOOL}_builtin_personality_file_tests" "${filename}" + elif declare -f builtin_personality_file_tests >/dev/null; then + builtin_personality_file_tests "${filename}" + fi +} + ## @description Uses relevant include/exclude env variable to fetch list of included/excluded # tests and sets given variable to arguments to be passes to maven command. ## @audience private @@ -225,6 +245,74 @@ function get_include_exclude_tests_arg ################################################### +add_test_type refguide + +function refguide_initialize +{ + maven_add_install refguide +} + +function refguide_filefilter +{ + local filename=$1 + + if [[ ${filename} =~ src/main/asciidoc ]] || + [[ ${filename} =~ src/main/xslt ]] || + [[ ${filename} =~ hbase-common/src/main/resources/hbase-default.xml ]]; then + add_test refguide + fi +} + +function refguide_rebuild +{ + local repostatus=$1 + local logfile="${PATCH_DIR}/${repostatus}-refguide.log" + declare -i count + + if ! verify_needed_test refguide; then + return 0 + fi + + big_console_header "Checking we can create the ref guide on ${repostatus}" + + start_clock + + echo_and_redirect "${logfile}" \ + "${MAVEN}" "${MAVEN_ARGS[@]}" clean site --batch-mode \ + -pl . \ + -Dtest=NoUnitTests -DHBasePatchProcess -Prelease \ + -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dfindbugs.skip=true + + count=$(${GREP} -c '\[ERROR\]' "${logfile}") + if [[ ${count} -gt 0 ]]; then + add_vote_table -1 refguide "${repostatus} has ${count} errors when building the reference guide." + add_footer_table refguide "@@BASE@@/${repostatus}-refguide.log" + return 1 + fi + + if ! mv target/site "${PATCH_DIR}/${repostatus}-site"; then + add_vote_table -1 refguide "${repostatus} failed to produce a site directory." + add_footer_table refguide "@@BASE@@/${repostatus}-refguide.log" + return 1 + fi + + if [[ ! -f "${PATCH_DIR}/${repostatus}-site/book.html" ]]; then + add_vote_table -1 refguide "${repostatus} failed to produce the html version of the reference guide." + add_footer_table refguide "@@BASE@@/${repostatus}-refguide.log" + return 1 + fi + + if [[ ! -f "${PATCH_DIR}/${repostatus}-site/apache_hbase_reference_guide.pdf" ]]; then + add_vote_table -1 refguide "${repostatus} failed to produce the pdf version of the reference guide." + add_footer_table refguide "@@BASE@@/${repostatus}-refguide.log" + return 1 + fi + + add_vote_table 0 refguide "${repostatus} has no errors when building the reference guide. See footer for rendered docs, which you should manually inspect." + add_footer_table refguide "@@BASE@@/${repostatus}-site/book.html" + return 0 +} + add_test_type shadedjars @@ -262,6 +350,8 @@ function shadedjars_rebuild big_console_header "Checking shaded client builds on ${repostatus}" + start_clock + echo_and_redirect "${logfile}" \ "${MAVEN}" "${MAVEN_ARGS[@]}" clean verify -fae --batch-mode \ -pl hbase-shaded/hbase-shaded-check-invariants -am \ @@ -343,6 +433,8 @@ function hadoopcheck_rebuild big_console_header "Compiling against various Hadoop versions" + start_clock + # All supported Hadoop versions that we want to test the compilation with # See the Hadoop section on prereqs in the HBase Reference Guide hbase_common_hadoop2_versions="2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.1 2.7.2 2.7.3 2.7.4" From 292114e1181b17747f011fd86c92a36044f4c265 Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Mon, 9 Apr 2018 01:07:02 -0500 Subject: [PATCH 09/19] HBASE-20365 add 2.0 docs to menu. Signed-off-by: Mike Drob --- src/site/site.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/site/site.xml b/src/site/site.xml index b5436d477427..ce7f8ae33df6 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -110,6 +110,10 @@ + + + + From 01d9660e23e39bfcdfcac6a1a49173967b3415c7 Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Mon, 9 Apr 2018 11:31:03 -0500 Subject: [PATCH 10/19] HBASE-20371 note hbasecon cfp on landing page. --- src/site/xdoc/index.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index b402e64cef5a..49cb6f745f8d 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -83,7 +83,7 @@ Apache HBase is an open-source, distributed, versioned, non-relational database

-

June 18th, 2018 HBaseCon 2018 @ San Jose Convention Center, San Jose, CA, USA

+

June 18th, 2018 HBaseCon 2018 @ San Jose Convention Center, San Jose, CA, USA. CFP open, see site for details!

August 4th, 2017 HBaseCon Asia 2017 @ the Huawei Campus in Shenzhen, China

June 12th, 2017 HBaseCon2017 at the Crittenden Buildings on the Google Mountain View Campus

April 25th, 2017 Meetup @ Visa in Palo Alto

From 0681f284092d08d4668efcaca427dc5f79255f23 Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Mon, 9 Apr 2018 12:18:27 -0500 Subject: [PATCH 11/19] Revert "HBASE-20371 note hbasecon cfp on landing page." This reverts commit 7fc6968f7d93bda884abd61b72e69b629dce7a1c. missing sign-off --- src/site/xdoc/index.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index 49cb6f745f8d..b402e64cef5a 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -83,7 +83,7 @@ Apache HBase is an open-source, distributed, versioned, non-relational database
-

June 18th, 2018 HBaseCon 2018 @ San Jose Convention Center, San Jose, CA, USA. CFP open, see site for details!

+

June 18th, 2018 HBaseCon 2018 @ San Jose Convention Center, San Jose, CA, USA

August 4th, 2017 HBaseCon Asia 2017 @ the Huawei Campus in Shenzhen, China

June 12th, 2017 HBaseCon2017 at the Crittenden Buildings on the Google Mountain View Campus

April 25th, 2017 Meetup @ Visa in Palo Alto

From c14e5c61b40ad5946863a464b4cbee3c936976e2 Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Mon, 9 Apr 2018 11:31:03 -0500 Subject: [PATCH 12/19] HBASE-20371 note hbasecon cfp on landing page. Signed-off-by: Josh Elser --- src/site/xdoc/index.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index b402e64cef5a..49cb6f745f8d 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -83,7 +83,7 @@ Apache HBase is an open-source, distributed, versioned, non-relational database
-

June 18th, 2018 HBaseCon 2018 @ San Jose Convention Center, San Jose, CA, USA

+

June 18th, 2018 HBaseCon 2018 @ San Jose Convention Center, San Jose, CA, USA. CFP open, see site for details!

August 4th, 2017 HBaseCon Asia 2017 @ the Huawei Campus in Shenzhen, China

June 12th, 2017 HBaseCon2017 at the Crittenden Buildings on the Google Mountain View Campus

April 25th, 2017 Meetup @ Visa in Palo Alto

From 8a574eff12283cda9d09eee6313cef0b9e0265ae Mon Sep 17 00:00:00 2001 From: meiyi Date: Mon, 9 Apr 2018 20:57:18 +0800 Subject: [PATCH 13/19] HBASE-17918 document serial replication Signed-off-by: zhangduo --- src/main/asciidoc/_chapters/ops_mgt.adoc | 34 +++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/asciidoc/_chapters/ops_mgt.adoc b/src/main/asciidoc/_chapters/ops_mgt.adoc index 6d332afe9d82..816773ec0c60 100644 --- a/src/main/asciidoc/_chapters/ops_mgt.adoc +++ b/src/main/asciidoc/_chapters/ops_mgt.adoc @@ -1407,9 +1407,12 @@ If a slave cluster does run out of room, or is inaccessible for other reasons, i .Consistency Across Replicated Clusters [WARNING] ==== -How your application builds on top of the HBase API matters when replication is in play. HBase's replication system provides at-least-once delivery of client edits for an enabled column family to each configured destination cluster. In the event of failure to reach a given destination, the replication system will retry sending edits in a way that might repeat a given message. Further more, there is not a guaranteed order of delivery for client edits. In the event of a RegionServer failing, recovery of the replication queue happens independent of recovery of the individual regions that server was previously handling. This means that it is possible for the not-yet-replicated edits to be serviced by a RegionServer that is currently slower to replicate than the one that handles edits from after the failure. +How your application builds on top of the HBase API matters when replication is in play. HBase's replication system provides at-least-once delivery of client edits for an enabled column family to each configured destination cluster. In the event of failure to reach a given destination, the replication system will retry sending edits in a way that might repeat a given message. HBase provides two ways of replication, one is the original replication and the other is serial replication. In the previous way of replication, there is not a guaranteed order of delivery for client edits. In the event of a RegionServer failing, recovery of the replication queue happens independent of recovery of the individual regions that server was previously handling. This means that it is possible for the not-yet-replicated edits to be serviced by a RegionServer that is currently slower to replicate than the one that handles edits from after the failure. The combination of these two properties (at-least-once delivery and the lack of message ordering) means that some destination clusters may end up in a different state if your application makes use of operations that are not idempotent, e.g. Increments. + +To solve the problem, HBase now supports serial replication, which sends edits to destination cluster as the order of requests from client. See <>. + ==== .Terminology Changes @@ -1450,6 +1453,9 @@ Instead of SQL statements, entire WALEdits (consisting of multiple cell inserts LOG.info("Replicating "+clusterId + " -> " + peerClusterId); ---- +.Serial Replication Configuration +See <> + .Cluster Management Commands add_peer :: Adds a replication relationship between two clusters. + @@ -1471,6 +1477,32 @@ enable_table_replication :: disable_table_replication :: Disable the table replication switch for all its column families. +=== Serial Replication + +Note: this feature is introduced in HBase 2.1 + +.Function of serial replication + +Serial replication supports to push logs to the destination cluster in the same order as logs reach to the source cluster. + +.Why need serial replication? +In replication of HBase, we push mutations to destination cluster by reading WAL in each region server. We have a queue for WAL files so we can read them in order of creation time. However, when region-move or RS failure occurs in source cluster, the hlog entries that are not pushed before region-move or RS-failure will be pushed by original RS(for region move) or another RS which takes over the remained hlog of dead RS(for RS failure), and the new entries for the same region(s) will be pushed by the RS which now serves the region(s), but they push the hlog entries of a same region concurrently without coordination. + +This treatment can possibly lead to data inconsistency between source and destination clusters: + +1. there are put and then delete written to source cluster. + +2. due to region-move / RS-failure, they are pushed by different replication-source threads to peer cluster. + +3. if delete is pushed to peer cluster before put, and flush and major-compact occurs in peer cluster before put is pushed to peer cluster, the delete is collected and the put remains in peer cluster, but in source cluster the put is masked by the delete, hence data inconsistency between source and destination clusters. + + +.Serial replication configuration + +. Set the serial flag to true for a repliation peer. You can either set it to true when creating a replication peer, or change it to true later. + +The serial replication feature had been done firstly in link:https://issues.apache.org/jira/browse/HBASE-9465[HBASE-9465] and then reverted and redone in link:https://issues.apache.org/jira/browse/HBASE-20046[HBASE-20046]. You can find more details in these issues. + === Verifying Replicated Data The `VerifyReplication` MapReduce job, which is included in HBase, performs a systematic comparison of replicated data between two different clusters. Run the VerifyReplication job on the master cluster, supplying it with the peer ID and table name to use for validation. You can limit the verification further by specifying a time range or specific families. The job's short name is `verifyrep`. To run the job, use a command like the following: From eb559e2165ff35c123c7c38b34dba7f26ee6de1e Mon Sep 17 00:00:00 2001 From: maoling Date: Wed, 21 Feb 2018 22:36:40 +0800 Subject: [PATCH 14/19] HBASE-19761:Fix Checkstyle errors in hbase-zookeeper --- .../main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java index 47aeee89f9b8..4cd84178c419 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java @@ -76,7 +76,7 @@ public class ZKWatcher implements Watcher, Abortable, Closeable { // Used if abortable is null private boolean aborted = false; - public final ZNodePaths znodePaths; + protected final ZNodePaths znodePaths; // listeners to be notified private final List listeners = new CopyOnWriteArrayList<>(); From ddda475d5a95b985c8e7271ef7f2b4d4759cfdc7 Mon Sep 17 00:00:00 2001 From: maoling Date: Sat, 7 Apr 2018 16:23:18 +0800 Subject: [PATCH 15/19] back to public --- .../main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java index 4cd84178c419..47aeee89f9b8 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java @@ -76,7 +76,7 @@ public class ZKWatcher implements Watcher, Abortable, Closeable { // Used if abortable is null private boolean aborted = false; - protected final ZNodePaths znodePaths; + public final ZNodePaths znodePaths; // listeners to be notified private final List listeners = new CopyOnWriteArrayList<>(); From 655f045f56128ef9f4c6d97f4cdc58d172a7c466 Mon Sep 17 00:00:00 2001 From: maoling Date: Wed, 11 Apr 2018 17:55:37 +0800 Subject: [PATCH 16/19] 1 --- bin/draining_servers.rb | 6 +-- .../hbase/IntegrationTestMetaReplicas.java | 2 +- .../IntegrationTestZKAndFSPermissions.java | 4 +- .../replication/ReplicationTrackerZKImpl.java | 6 +-- .../replication/ZKReplicationStorageBase.java | 2 +- .../TestReplicationStateZKImpl.java | 4 +- .../hbase/rsgroup/RSGroupInfoManagerImpl.java | 8 ++-- .../rsgroup/VerifyingRSGroupAdminClient.java | 2 +- .../hadoop/hbase/ZKNamespaceManager.java | 4 +- .../org/apache/hadoop/hbase/ZNodeClearer.java | 4 +- .../backup/example/HFileArchiveManager.java | 2 +- .../backup/example/ZKTableArchiveClient.java | 4 +- .../ZKSplitLogManagerCoordination.java | 10 ++--- .../ZkSplitLogWorkerCoordination.java | 20 +++++----- .../hbase/master/ActiveMasterManager.java | 18 ++++----- .../hbase/master/DrainingServerTracker.java | 8 ++-- .../apache/hadoop/hbase/master/HMaster.java | 12 +++--- .../hbase/master/MasterMetaBootstrap.java | 4 +- .../hbase/master/RegionServerTracker.java | 12 +++--- .../hadoop/hbase/master/ServerManager.java | 2 +- .../hbase/master/SplitOrMergeTracker.java | 8 ++-- .../hbase/master/zksyncer/ClientZKSyncer.java | 2 +- .../master/zksyncer/MasterAddressSyncer.java | 2 +- .../master/zksyncer/MetaLocationSyncer.java | 4 +- .../procedure/ZKProcedureCoordinator.java | 2 +- .../procedure/ZKProcedureMemberRpcs.java | 2 +- .../hbase/procedure/ZKProcedureUtil.java | 4 +- .../hbase/regionserver/HRegionServer.java | 4 +- .../replication/HBaseReplicationEndpoint.java | 4 +- .../master/ReplicationPeerConfigUpgrader.java | 4 +- .../security/access/ZKPermissionWatcher.java | 10 ++--- .../AuthenticationTokenSecretManager.java | 2 +- .../hbase/security/token/ZKSecretWatcher.java | 4 +- .../visibility/ZKVisibilityLabelWatcher.java | 6 +-- .../apache/hadoop/hbase/util/HBaseFsck.java | 6 +-- .../hadoop/hbase/util/ZKDataMigrator.java | 6 +-- .../hbase/client/TestMetaWithReplicas.java | 6 +-- .../hbase/master/TestActiveMasterManager.java | 14 +++---- .../hbase/master/TestAssignmentListener.java | 2 +- .../hbase/master/TestHMasterRPCException.java | 4 +- .../hbase/master/TestMasterNoCluster.java | 2 +- .../hbase/master/TestMasterStatusServlet.java | 2 +- .../hbase/master/TestMetaShutdownHandler.java | 4 +- .../TestMirroringTableStateManager.java | 4 +- .../hbase/master/TestSplitLogManager.java | 14 +++---- .../TestCompactionInDeadRegionServer.java | 2 +- .../TestMasterAddressTracker.java | 6 +-- .../TestRegionServerHostname.java | 4 +- .../regionserver/TestSplitLogWorker.java | 28 ++++++------- .../replication/TestMasterReplication.java | 2 +- .../TestReplicationTrackerZKImpl.java | 18 ++++----- .../token/TestZKSecretWatcherRefreshKeys.java | 2 +- .../hbase/zookeeper/ClusterStatusTracker.java | 10 ++--- .../hbase/zookeeper/LoadBalancerTracker.java | 8 ++-- .../hbase/zookeeper/MasterAddressTracker.java | 12 +++--- .../MasterMaintenanceModeTracker.java | 5 ++- .../hbase/zookeeper/MetaTableLocator.java | 11 ++--- .../zookeeper/RegionNormalizerTracker.java | 8 ++-- .../hadoop/hbase/zookeeper/ZKAclReset.java | 4 +- .../hadoop/hbase/zookeeper/ZKClusterId.java | 6 +-- .../hadoop/hbase/zookeeper/ZKNodeTracker.java | 4 +- .../hadoop/hbase/zookeeper/ZKSplitLog.java | 4 +- .../apache/hadoop/hbase/zookeeper/ZKUtil.java | 23 ++++++----- .../hadoop/hbase/zookeeper/ZKWatcher.java | 4 +- .../hadoop/hbase/zookeeper/TestZKMulti.java | 40 +++++++++---------- .../hbase/zookeeper/TestZKNodeTracker.java | 6 +-- .../hbase/zookeeper/TestZKUtilNoServer.java | 4 +- 67 files changed, 235 insertions(+), 232 deletions(-) diff --git a/bin/draining_servers.rb b/bin/draining_servers.rb index 0d29c19e49e2..8c9b28fe49f9 100644 --- a/bin/draining_servers.rb +++ b/bin/draining_servers.rb @@ -86,7 +86,7 @@ def addServers(_options, hostOrServers) servers = getServerNames(hostOrServers, config) zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil) - parentZnode = zkw.znodePaths.drainingZNode + parentZnode = zkw.getZNodePaths().drainingZNode begin for server in servers @@ -103,7 +103,7 @@ def removeServers(_options, hostOrServers) servers = getServerNames(hostOrServers, config) zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil) - parentZnode = zkw.znodePaths.drainingZNode + parentZnode = zkw.getZNodePaths().drainingZNode begin for server in servers @@ -120,7 +120,7 @@ def listServers(_options) config = HBaseConfiguration.create zkw = org.apache.hadoop.hbase.zookeeper.ZKWatcher.new(config, 'draining_servers', nil) - parentZnode = zkw.znodePaths.drainingZNode + parentZnode = zkw.getZNodePaths().drainingZNode servers = ZKUtil.listChildrenNoWatch(zkw, parentZnode) servers.each { |server| puts server } diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestMetaReplicas.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestMetaReplicas.java index 37e26865f39a..f14b9a56756b 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestMetaReplicas.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestMetaReplicas.java @@ -81,7 +81,7 @@ public static void teardown() throws Exception { } private static void waitUntilZnodeAvailable(int replicaId) throws Exception { - String znode = util.getZooKeeperWatcher().znodePaths.getZNodeForReplica(replicaId); + String znode = util.getZooKeeperWatcher().getZNodePaths().getZNodeForReplica(replicaId); int i = 0; while (i < 1000) { if (ZKUtil.checkExists(util.getZooKeeperWatcher(), znode) == -1) { diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestZKAndFSPermissions.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestZKAndFSPermissions.java index 31db2fdb2db2..08edd74bc1a8 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestZKAndFSPermissions.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/test/IntegrationTestZKAndFSPermissions.java @@ -144,7 +144,7 @@ private void testZNodeACLs() throws IOException, KeeperException, InterruptedExc ZKWatcher watcher = new ZKWatcher(conf, "IntegrationTestZnodeACLs", null); RecoverableZooKeeper zk = ZKUtil.connect(this.conf, watcher); - String baseZNode = watcher.znodePaths.baseZNode; + String baseZNode = watcher.getZNodePaths().baseZNode; LOG.info(""); LOG.info("***********************************************************************************"); @@ -160,7 +160,7 @@ private void testZNodeACLs() throws IOException, KeeperException, InterruptedExc private void checkZnodePermsRecursive(ZKWatcher watcher, RecoverableZooKeeper zk, String znode) throws KeeperException, InterruptedException { - boolean expectedWorldReadable = watcher.znodePaths.isClientReadable(znode); + boolean expectedWorldReadable = watcher.getZNodePaths().isClientReadable(znode); assertZnodePerms(zk, znode, expectedWorldReadable); diff --git a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationTrackerZKImpl.java b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationTrackerZKImpl.java index 16a1668c9fc6..a46589236978 100644 --- a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationTrackerZKImpl.java +++ b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ReplicationTrackerZKImpl.java @@ -138,7 +138,7 @@ public void nodeChildrenChanged(String path) { } private boolean refreshListIfRightPath(String path) { - if (!path.startsWith(this.watcher.znodePaths.rsZNode)) { + if (!path.startsWith(this.watcher.getZNodePaths().rsZNode)) { return false; } return refreshOtherRegionServersList(true); @@ -182,9 +182,9 @@ private List getRegisteredRegionServers(boolean watch) { List result = null; try { if (watch) { - result = ZKUtil.listChildrenAndWatchThem(this.zookeeper, this.zookeeper.znodePaths.rsZNode); + result = ZKUtil.listChildrenAndWatchThem(this.zookeeper, this.zookeeper.getZNodePaths().rsZNode); } else { - result = ZKUtil.listChildrenNoWatch(this.zookeeper, this.zookeeper.znodePaths.rsZNode); + result = ZKUtil.listChildrenNoWatch(this.zookeeper, this.zookeeper.getZNodePaths().rsZNode); } } catch (KeeperException e) { this.abortable.abort("Get list of registered region servers", e); diff --git a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationStorageBase.java b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationStorageBase.java index 7190aeb67959..d6e692aef381 100644 --- a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationStorageBase.java +++ b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationStorageBase.java @@ -50,7 +50,7 @@ protected ZKReplicationStorageBase(ZKWatcher zookeeper, Configuration conf) { this.zookeeper = zookeeper; this.conf = conf; - this.replicationZNode = ZNodePaths.joinZNode(this.zookeeper.znodePaths.baseZNode, + this.replicationZNode = ZNodePaths.joinZNode(this.zookeeper.getZNodePaths().baseZNode, conf.get(REPLICATION_ZNODE, REPLICATION_ZNODE_DEFAULT)); } diff --git a/hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateZKImpl.java b/hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateZKImpl.java index 08178f4c3fb0..9b8d4235a659 100644 --- a/hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateZKImpl.java +++ b/hbase-replication/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationStateZKImpl.java @@ -58,7 +58,7 @@ public static void setUpBeforeClass() throws Exception { conf.setBoolean(HConstants.REPLICATION_BULKLOAD_ENABLE_KEY, true); zkw = utility.getZooKeeperWatcher(); String replicationZNodeName = conf.get("zookeeper.znode.replication", "replication"); - replicationZNode = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, replicationZNodeName); + replicationZNode = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, replicationZNodeName); KEY_ONE = initPeerClusterState("/hbase1"); KEY_TWO = initPeerClusterState("/hbase2"); } @@ -69,7 +69,7 @@ private static String initPeerClusterState(String baseZKNode) Configuration testConf = new Configuration(conf); testConf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, baseZKNode); ZKWatcher zkw1 = new ZKWatcher(testConf, "test1", null); - String fakeRs = ZNodePaths.joinZNode(zkw1.znodePaths.rsZNode, "hostname1.example.org:1234"); + String fakeRs = ZNodePaths.joinZNode(zkw1.getZNodePaths().rsZNode, "hostname1.example.org:1234"); ZKUtil.createWithParents(zkw1, fakeRs); ZKClusterId.setClusterId(zkw1, new ClusterId()); return ZKConfig.getZooKeeperClusterKey(testConf); diff --git a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java index a9f8284fdd53..6b6d34c10509 100644 --- a/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java +++ b/hbase-rsgroup/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java @@ -77,7 +77,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; @@ -349,7 +349,7 @@ List retrieveGroupListFromGroupTable() throws IOException { } List retrieveGroupListFromZookeeper() throws IOException { - String groupBasePath = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, rsGroupZNode); + String groupBasePath = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, rsGroupZNode); List RSGroupInfoList = Lists.newArrayList(); //Overwrite any info stored by table, this takes precedence try { @@ -493,7 +493,7 @@ private synchronized void flushConfig(Map newGroupMap) resetRSGroupAndTableMaps(newGroupMap, newTableMap); try { - String groupBasePath = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, rsGroupZNode); + String groupBasePath = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, rsGroupZNode); ZKUtil.createAndFailSilent(watcher, groupBasePath, ProtobufMagic.PB_MAGIC); List zkOps = new ArrayList<>(newGroupMap.size()); @@ -554,7 +554,7 @@ private List getOnlineRS() throws IOException { LOG.debug("Reading online RS from zookeeper"); List servers = new LinkedList<>(); try { - for (String el: ZKUtil.listChildrenNoWatch(watcher, watcher.znodePaths.rsZNode)) { + for (String el: ZKUtil.listChildrenNoWatch(watcher, watcher.getZNodePaths().rsZNode)) { servers.add(ServerName.parseServerName(el)); } } catch (KeeperException e) { diff --git a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java index 7c13fc33d387..88a43396d7b6 100644 --- a/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java +++ b/hbase-rsgroup/src/test/java/org/apache/hadoop/hbase/rsgroup/VerifyingRSGroupAdminClient.java @@ -134,7 +134,7 @@ public void verify() throws IOException { Assert.assertEquals(Sets.newHashSet(groupMap.values()), Sets.newHashSet(wrapped.listRSGroups())); try { - String groupBasePath = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "rsgroup"); + String groupBasePath = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "rsgroup"); for(String znode: ZKUtil.listChildrenNoWatch(zkw, groupBasePath)) { byte[] data = ZKUtil.getData(zkw, ZNodePaths.joinZNode(groupBasePath, znode)); if(data.length > 0) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java index 53b24398245b..441354978aea 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java @@ -28,7 +28,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKListener; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; @@ -55,7 +55,7 @@ public class ZKNamespaceManager extends ZKListener { public ZKNamespaceManager(ZKWatcher zkw) throws IOException { super(zkw); - nsZNode = zkw.znodePaths.namespaceZNode; + nsZNode = zkw.getZNodePaths().namespaceZNode; cache = new ConcurrentSkipListMap<>(); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java index f0b3a41b8413..a64d0bfe8449 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java @@ -30,7 +30,7 @@ import org.apache.hadoop.hbase.zookeeper.MasterAddressTracker; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; @@ -186,7 +186,7 @@ public static boolean clear(Configuration conf) { if (ZNodeClearer.tablesOnMaster(conf)) { // In case of master crash also remove rsZnode since master is also regionserver ZKUtil.deleteNodeFailSilent(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, znodeFileContent)); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, znodeFileContent)); return MasterAddressTracker.deleteIfEquals(zkw, ZNodeClearer.parseMasterServerName(znodeFileContent)); } else { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/HFileArchiveManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/HFileArchiveManager.java index c51d4937a143..c35dc72726f6 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/HFileArchiveManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/HFileArchiveManager.java @@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java index 39d95439c06b..edac2b5d447d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java @@ -25,7 +25,7 @@ import org.apache.hadoop.conf.Configured; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.KeeperException; /** @@ -149,7 +149,7 @@ private synchronized HFileArchiveManager createHFileArchiveManager() throws Keep * @return get the znode for long-term archival of a table for */ public static String getArchiveZNode(Configuration conf, ZKWatcher zooKeeper) { - return ZNodePaths.joinZNode(zooKeeper.znodePaths.baseZNode, conf.get( + return ZNodePaths.joinZNode(zooKeeper.getZNodePaths().baseZNode, conf.get( ZOOKEEPER_ZNODE_HFILE_ARCHIVE_KEY, TableHFileArchiveTracker.HFILE_ARCHIVE_ZNODE_PARENT)); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZKSplitLogManagerCoordination.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZKSplitLogManagerCoordination.java index 409cd2621a6a..7087293b1159 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZKSplitLogManagerCoordination.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZKSplitLogManagerCoordination.java @@ -122,7 +122,7 @@ public String prepareTask(String taskname) { public int remainingTasksInCoordination() { int count = 0; try { - List tasks = ZKUtil.listChildrenNoWatch(watcher, watcher.znodePaths.splitLogZNode); + List tasks = ZKUtil.listChildrenNoWatch(watcher, watcher.getZNodePaths().splitLogZNode); if (tasks != null) { int listSize = tasks.size(); for (int i = 0; i < listSize; i++) { @@ -466,13 +466,13 @@ private void heartbeat(String path, int new_version, ServerName workerName) { private void lookForOrphans() { List orphans; try { - orphans = ZKUtil.listChildrenNoWatch(this.watcher, this.watcher.znodePaths.splitLogZNode); + orphans = ZKUtil.listChildrenNoWatch(this.watcher, this.watcher.getZNodePaths().splitLogZNode); if (orphans == null) { - LOG.warn("Could not get children of " + this.watcher.znodePaths.splitLogZNode); + LOG.warn("Could not get children of " + this.watcher.getZNodePaths().splitLogZNode); return; } } catch (KeeperException e) { - LOG.warn("Could not get children of " + this.watcher.znodePaths.splitLogZNode + " " + LOG.warn("Could not get children of " + this.watcher.getZNodePaths().splitLogZNode + " " + StringUtils.stringifyException(e)); return; } @@ -480,7 +480,7 @@ private void lookForOrphans() { int listSize = orphans.size(); for (int i = 0; i < listSize; i++) { String path = orphans.get(i); - String nodepath = ZNodePaths.joinZNode(watcher.znodePaths.splitLogZNode, path); + String nodepath = ZNodePaths.joinZNode(watcher.getZNodePaths().splitLogZNode, path); if (ZKSplitLog.isRescanNode(watcher, nodepath)) { rescan_nodes++; LOG.debug("Found orphan rescan node " + path); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java index 2143f80a69f7..ff555f22addc 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java @@ -97,7 +97,7 @@ public ZkSplitLogWorkerCoordination(ServerName serverName, ZKWatcher watcher) { */ @Override public void nodeChildrenChanged(String path) { - if (path.equals(watcher.znodePaths.splitLogZNode)) { + if (path.equals(watcher.getZNodePaths().splitLogZNode)) { if (LOG.isTraceEnabled()) { LOG.trace("tasks arrived or departed on " + path); } @@ -331,7 +331,7 @@ private int getNumExpectedTasksPerRS(int numTasks) { int availableRSs = 1; try { List regionServers = - ZKUtil.listChildrenNoWatch(watcher, watcher.znodePaths.rsZNode); + ZKUtil.listChildrenNoWatch(watcher, watcher.getZNodePaths().rsZNode); availableRSs = Math.max(availableRSs, (regionServers == null) ? 0 : regionServers.size()); } catch (KeeperException e) { // do nothing @@ -412,7 +412,7 @@ public void taskLoop() throws InterruptedException { List paths; paths = getTaskList(); if (paths == null) { - LOG.warn("Could not get tasks, did someone remove " + watcher.znodePaths.splitLogZNode + LOG.warn("Could not get tasks, did someone remove " + watcher.getZNodePaths().splitLogZNode + " ... worker thread exiting."); return; } @@ -439,7 +439,7 @@ public void taskLoop() throws InterruptedException { // don't call ZKSplitLog.getNodeName() because that will lead to // double encoding of the path name taskGrabbed |= grabTask(ZNodePaths.joinZNode( - watcher.znodePaths.splitLogZNode, paths.get(idx))); + watcher.getZNodePaths().splitLogZNode, paths.get(idx))); break; } else { LOG.debug("Current region server " + server.getServerName() + " has " @@ -472,14 +472,14 @@ private List getTaskList() throws InterruptedException { while (!shouldStop) { try { childrenPaths = ZKUtil.listChildrenAndWatchForNewChildren(watcher, - watcher.znodePaths.splitLogZNode); + watcher.getZNodePaths().splitLogZNode); if (childrenPaths != null) { return childrenPaths; } } catch (KeeperException e) { - LOG.warn("Could not get children of znode " + watcher.znodePaths.splitLogZNode, e); + LOG.warn("Could not get children of znode " + watcher.getZNodePaths().splitLogZNode, e); } - LOG.debug("Retry listChildren of znode " + watcher.znodePaths.splitLogZNode + LOG.debug("Retry listChildren of znode " + watcher.getZNodePaths().splitLogZNode + " after sleep for " + sleepTime + "ms!"); Thread.sleep(sleepTime); } @@ -495,14 +495,14 @@ public void markCorrupted(Path rootDir, String name, FileSystem fs) { public boolean isReady() throws InterruptedException { int result = -1; try { - result = ZKUtil.checkExists(watcher, watcher.znodePaths.splitLogZNode); + result = ZKUtil.checkExists(watcher, watcher.getZNodePaths().splitLogZNode); } catch (KeeperException e) { // ignore - LOG.warn("Exception when checking for " + watcher.znodePaths.splitLogZNode + LOG.warn("Exception when checking for " + watcher.getZNodePaths().splitLogZNode + " ... retrying", e); } if (result == -1) { - LOG.info(watcher.znodePaths.splitLogZNode + LOG.info(watcher.getZNodePaths().splitLogZNode + " znode does not exist, waiting for master to create"); Thread.sleep(1000); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java index 78cb024bdf4c..50798ed60a0a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java @@ -93,7 +93,7 @@ public void nodeDeleted(String path) { // shut down, so that state is now irrelevant. This means that the shutdown // state must be set while we wait on the active master in order // to shutdown this master. See HBASE-8519. - if(path.equals(watcher.znodePaths.clusterStateZNode) && !master.isStopped()) { + if(path.equals(watcher.getZNodePaths().clusterStateZNode) && !master.isStopped()) { clusterShutDown.set(true); } @@ -101,7 +101,7 @@ public void nodeDeleted(String path) { } void handle(final String path) { - if (path.equals(watcher.znodePaths.masterAddressZNode) && !master.isStopped()) { + if (path.equals(watcher.getZNodePaths().masterAddressZNode) && !master.isStopped()) { handleMasterNodeChange(); } } @@ -123,7 +123,7 @@ private void handleMasterNodeChange() { // Watch the node and check if it exists. try { synchronized(clusterHasActiveMaster) { - if (ZKUtil.watchAndCheckExists(watcher, watcher.znodePaths.masterAddressZNode)) { + if (ZKUtil.watchAndCheckExists(watcher, watcher.getZNodePaths().masterAddressZNode)) { // A master node exists, there is an active master LOG.trace("A master is now available"); clusterHasActiveMaster.set(true); @@ -157,14 +157,14 @@ private void handleMasterNodeChange() { boolean blockUntilBecomingActiveMaster( int checkInterval, MonitoredTask startupStatus) { String backupZNode = ZNodePaths.joinZNode( - this.watcher.znodePaths.backupMasterAddressesZNode, this.sn.toString()); + this.watcher.getZNodePaths().backupMasterAddressesZNode, this.sn.toString()); while (!(master.isAborted() || master.isStopped())) { startupStatus.setStatus("Trying to register in ZK as active master"); // Try to become the active master, watch if there is another master. // Write out our ServerName as versioned bytes. try { if (MasterAddressTracker.setMasterAddress(this.watcher, - this.watcher.znodePaths.masterAddressZNode, this.sn, infoPort)) { + this.watcher.getZNodePaths().masterAddressZNode, this.sn, infoPort)) { // If we were a backup master before, delete our ZNode from the backup // master directory since we are the active now) @@ -188,7 +188,7 @@ boolean blockUntilBecomingActiveMaster( String msg; byte[] bytes = - ZKUtil.getDataAndWatch(this.watcher, this.watcher.znodePaths.masterAddressZNode); + ZKUtil.getDataAndWatch(this.watcher, this.watcher.getZNodePaths().masterAddressZNode); if (bytes == null) { msg = ("A master was detected, but went down before its address " + "could be read. Attempting to become the next active master"); @@ -205,7 +205,7 @@ boolean blockUntilBecomingActiveMaster( msg = ("Current master has this master's address, " + currentMaster + "; master was restarted? Deleting node."); // Hurry along the expiration of the znode. - ZKUtil.deleteNode(this.watcher, this.watcher.znodePaths.masterAddressZNode); + ZKUtil.deleteNode(this.watcher, this.watcher.getZNodePaths().masterAddressZNode); // We may have failed to delete the znode at the previous step, but // we delete the file anyway: a second attempt to delete the znode is likely to fail again. @@ -245,7 +245,7 @@ boolean blockUntilBecomingActiveMaster( */ boolean hasActiveMaster() { try { - if (ZKUtil.checkExists(watcher, watcher.znodePaths.masterAddressZNode) >= 0) { + if (ZKUtil.checkExists(watcher, watcher.getZNodePaths().masterAddressZNode) >= 0) { return true; } } @@ -271,7 +271,7 @@ public void stop() { LOG.warn("Failed get of master address: " + e.toString()); } if (activeMaster != null && activeMaster.equals(this.sn)) { - ZKUtil.deleteNode(watcher, watcher.znodePaths.masterAddressZNode); + ZKUtil.deleteNode(watcher, watcher.getZNodePaths().masterAddressZNode); // We may have failed to delete the znode at the previous step, but // we delete the file anyway: a second attempt to delete the znode is likely to fail again. ZNodeClearer.deleteMyEphemeralNodeOnDisk(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DrainingServerTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DrainingServerTracker.java index a9e579629c1d..14c4a3ec85f6 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DrainingServerTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DrainingServerTracker.java @@ -83,7 +83,7 @@ public void serverAdded(ServerName sn) { } }); List servers = - ZKUtil.listChildrenAndWatchThem(watcher, watcher.znodePaths.drainingZNode); + ZKUtil.listChildrenAndWatchThem(watcher, watcher.getZNodePaths().drainingZNode); add(servers); } @@ -110,7 +110,7 @@ private void remove(final ServerName sn) { @Override public void nodeDeleted(final String path) { - if(path.startsWith(watcher.znodePaths.drainingZNode)) { + if(path.startsWith(watcher.getZNodePaths().drainingZNode)) { final ServerName sn = ServerName.valueOf(ZKUtil.getNodeName(path)); LOG.info("Draining RS node deleted, removing from list [" + sn + "]"); @@ -120,10 +120,10 @@ public void nodeDeleted(final String path) { @Override public void nodeChildrenChanged(final String path) { - if(path.equals(watcher.znodePaths.drainingZNode)) { + if(path.equals(watcher.getZNodePaths().drainingZNode)) { try { final List newNodes = - ZKUtil.listChildrenAndWatchThem(watcher, watcher.znodePaths.drainingZNode); + ZKUtil.listChildrenAndWatchThem(watcher, watcher.getZNodePaths().drainingZNode); add(newNodes); } catch (KeeperException e) { abortable.abort("Unexpected zk exception getting RS nodes", e); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 9dd685daa766..67166069df44 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -196,7 +196,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKClusterId; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.eclipse.jetty.server.Server; @@ -2014,7 +2014,7 @@ private static void warnOrThrowExceptionForFailure(boolean logWarn, String confK private void startActiveMasterManager(int infoPort) throws KeeperException { String backupZNode = ZNodePaths.joinZNode( - zooKeeper.znodePaths.backupMasterAddressesZNode, serverName.toString()); + zooKeeper.getZNodePaths().backupMasterAddressesZNode, serverName.toString()); /* * Add a ZNode for ourselves in the backup master directory since we * may not become the active master. If so, we want the actual active @@ -2524,7 +2524,7 @@ private List getBackupMasters() throws InterruptedIOException { List backupMasterStrings; try { backupMasterStrings = ZKUtil.listChildrenNoWatch(this.zooKeeper, - this.zooKeeper.znodePaths.backupMasterAddressesZNode); + this.zooKeeper.getZNodePaths().backupMasterAddressesZNode); } catch (KeeperException e) { LOG.warn(this.zooKeeper.prefix("Unable to list backup servers"), e); backupMasterStrings = null; @@ -2538,7 +2538,7 @@ private List getBackupMasters() throws InterruptedIOException { byte [] bytes; try { bytes = ZKUtil.getData(this.zooKeeper, ZNodePaths.joinZNode( - this.zooKeeper.znodePaths.backupMasterAddressesZNode, s)); + this.zooKeeper.getZNodePaths().backupMasterAddressesZNode, s)); } catch (InterruptedException e) { throw new InterruptedIOException(); } @@ -3484,7 +3484,7 @@ public void decommissionRegionServers(final List servers, final bool throws HBaseIOException { List serversAdded = new ArrayList<>(servers.size()); // Place the decommission marker first. - String parentZnode = getZooKeeper().znodePaths.drainingZNode; + String parentZnode = getZooKeeper().getZNodePaths().drainingZNode; for (ServerName server : servers) { try { String node = ZNodePaths.joinZNode(parentZnode, server.getServerName()); @@ -3533,7 +3533,7 @@ public List listDecommissionedRegionServers() { public void recommissionRegionServer(final ServerName server, final List encodedRegionNames) throws HBaseIOException { // Remove the server from decommissioned (draining) server list. - String parentZnode = getZooKeeper().znodePaths.drainingZNode; + String parentZnode = getZooKeeper().getZNodePaths().drainingZNode; String node = ZNodePaths.joinZNode(parentZnode, server.getServerName()); try { ZKUtil.deleteNodeFailSilent(getZooKeeper(), node); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterMetaBootstrap.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterMetaBootstrap.java index eab937d06818..59f123395be5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterMetaBootstrap.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterMetaBootstrap.java @@ -125,14 +125,14 @@ private void unassignExcessMetaReplica(int numMetaReplicasConfigured) { try { List metaReplicaZnodes = zooKeeper.getMetaReplicaNodes(); for (String metaReplicaZnode : metaReplicaZnodes) { - int replicaId = zooKeeper.znodePaths.getMetaReplicaIdFromZnode(metaReplicaZnode); + int replicaId = zooKeeper.getZNodePaths().getMetaReplicaIdFromZnode(metaReplicaZnode); if (replicaId >= numMetaReplicasConfigured) { RegionState r = MetaTableLocator.getMetaRegionState(zooKeeper, replicaId); LOG.info("Closing excess replica of meta region " + r.getRegion()); // send a close and wait for a max of 30 seconds ServerManager.closeRegionSilentlyAndWait(master.getClusterConnection(), r.getServerName(), r.getRegion(), 30000); - ZKUtil.deleteNode(zooKeeper, zooKeeper.znodePaths.getZNodeForReplica(replicaId)); + ZKUtil.deleteNode(zooKeeper, zooKeeper.getZNodePaths().getZNodeForReplica(replicaId)); } } } catch (Exception ex) { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java index 81fc589f437a..100476bfeb20 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java @@ -72,7 +72,7 @@ public RegionServerTracker(ZKWatcher watcher, public void start() throws KeeperException, IOException { watcher.registerListener(this); List servers = - ZKUtil.listChildrenAndWatchThem(watcher, watcher.znodePaths.rsZNode); + ZKUtil.listChildrenAndWatchThem(watcher, watcher.getZNodePaths().rsZNode); refresh(servers); } @@ -84,7 +84,7 @@ private void refresh(final List servers) throws IOException { if (regionServers.get(sn) == null) { RegionServerInfo.Builder rsInfoBuilder = RegionServerInfo.newBuilder(); try { - String nodePath = ZNodePaths.joinZNode(watcher.znodePaths.rsZNode, n); + String nodePath = ZNodePaths.joinZNode(watcher.getZNodePaths().rsZNode, n); byte[] data = ZKUtil.getData(watcher, nodePath); if (data != null && data.length > 0 && ProtobufUtil.isPBMagicPrefix(data)) { int magicLen = ProtobufUtil.lengthOfPBMagic(); @@ -114,7 +114,7 @@ private void remove(final ServerName sn) { @Override public void nodeCreated(String path) { - if (path.startsWith(watcher.znodePaths.rsZNode)) { + if (path.startsWith(watcher.getZNodePaths().rsZNode)) { String serverName = ZKUtil.getNodeName(path); LOG.info("RegionServer ephemeral node created, adding [" + serverName + "]"); if (server.isInitialized()) { @@ -127,7 +127,7 @@ public void nodeCreated(String path) { @Override public void nodeDeleted(String path) { - if (path.startsWith(watcher.znodePaths.rsZNode)) { + if (path.startsWith(watcher.getZNodePaths().rsZNode)) { String serverName = ZKUtil.getNodeName(path); LOG.info("RegionServer ephemeral node deleted, processing expiration [" + serverName + "]"); @@ -144,11 +144,11 @@ public void nodeDeleted(String path) { @Override public void nodeChildrenChanged(String path) { - if (path.equals(watcher.znodePaths.rsZNode) + if (path.equals(watcher.getZNodePaths().rsZNode) && !server.isAborted() && !server.isStopped()) { try { List servers = - ZKUtil.listChildrenAndWatchThem(watcher, watcher.znodePaths.rsZNode); + ZKUtil.listChildrenAndWatchThem(watcher, watcher.getZNodePaths().rsZNode); refresh(servers); } catch (IOException e) { server.abort("Unexpected zk exception getting RS nodes", e); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java index a65d95f5eebe..4b072447b228 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java @@ -551,7 +551,7 @@ void letRegionServersShutdown() { private List getRegionServersInZK(final ZKWatcher zkw) throws KeeperException { - return ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.rsZNode); + return ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().rsZNode); } /* diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitOrMergeTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitOrMergeTracker.java index 55287d21d71e..c6ca944943e4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitOrMergeTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitOrMergeTracker.java @@ -50,15 +50,15 @@ public class SplitOrMergeTracker { public SplitOrMergeTracker(ZKWatcher watcher, Configuration conf, Abortable abortable) { try { - if (ZKUtil.checkExists(watcher, watcher.znodePaths.switchZNode) < 0) { - ZKUtil.createAndFailSilent(watcher, watcher.znodePaths.switchZNode); + if (ZKUtil.checkExists(watcher, watcher.getZNodePaths().switchZNode) < 0) { + ZKUtil.createAndFailSilent(watcher, watcher.getZNodePaths().switchZNode); } } catch (KeeperException e) { throw new RuntimeException(e); } - splitZnode = ZNodePaths.joinZNode(watcher.znodePaths.switchZNode, + splitZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().switchZNode, conf.get("zookeeper.znode.switch.split", "split")); - mergeZnode = ZNodePaths.joinZNode(watcher.znodePaths.switchZNode, + mergeZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().switchZNode, conf.get("zookeeper.znode.switch.merge", "merge")); splitStateTracker = new SwitchStateTracker(watcher, splitZnode, abortable); mergeStateTracker = new SwitchStateTracker(watcher, mergeZnode, abortable); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java index 8f735bde4dc7..d6dcad1601f8 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java @@ -67,7 +67,7 @@ public void start() throws KeeperException { LOG.debug("Starting " + getClass().getSimpleName()); this.watcher.registerListener(this); // create base znode on remote ZK - ZKUtil.createWithParents(clientZkWatcher, watcher.znodePaths.baseZNode); + ZKUtil.createWithParents(clientZkWatcher, watcher.getZNodePaths().baseZNode); // set meta znodes for client ZK Collection nodes = getNodesToWatch(); LOG.debug("Znodes to watch: " + nodes); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MasterAddressSyncer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MasterAddressSyncer.java index 3da8558cc685..a9aa13cb93d3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MasterAddressSyncer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MasterAddressSyncer.java @@ -35,7 +35,7 @@ public class MasterAddressSyncer extends ClientZKSyncer { public MasterAddressSyncer(ZKWatcher watcher, ZKWatcher clientZkWatcher, Server server) { super(watcher, clientZkWatcher, server); - masterAddressZNode = watcher.znodePaths.masterAddressZNode; + masterAddressZNode = watcher.getZNodePaths().masterAddressZNode; } @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MetaLocationSyncer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MetaLocationSyncer.java index 68f7fc40977c..eb80a2a232b2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MetaLocationSyncer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/MetaLocationSyncer.java @@ -36,11 +36,11 @@ public MetaLocationSyncer(ZKWatcher watcher, ZKWatcher clientZkWatcher, Server s @Override boolean validate(String path) { - return watcher.znodePaths.isAnyMetaReplicaZNode(path); + return watcher.getZNodePaths().isAnyMetaReplicaZNode(path); } @Override Collection getNodesToWatch() { - return watcher.znodePaths.metaReplicaZNodes.values(); + return watcher.getZNodePaths().metaReplicaZNodes.values(); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureCoordinator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureCoordinator.java index 4184e5580bd2..ef9ffbe662eb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureCoordinator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureCoordinator.java @@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.errorhandling.ForeignException; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureMemberRpcs.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureMemberRpcs.java index f29d133d8432..128361235a60 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureMemberRpcs.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureMemberRpcs.java @@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java index 210bc02aaa92..45300ed16947 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java @@ -25,7 +25,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKWatcher; import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -79,7 +79,7 @@ public ZKProcedureUtil(ZKWatcher watcher, String procDescription) // make sure we are listening for events watcher.registerListener(this); // setup paths for the zknodes used in procedures - this.baseZNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, procDescription); + this.baseZNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, procDescription); acquiredZnode = ZNodePaths.joinZNode(baseZNode, ACQUIRED_BARRIER_ZNODE_DEFAULT); reachedZnode = ZNodePaths.joinZNode(baseZNode, REACHED_BARRIER_ZNODE_DEFAULT); abortZnode = ZNodePaths.joinZNode(baseZNode, ABORT_ZNODE_DEFAULT); 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 240de85e7788..12afdaf7e9fc 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 @@ -165,7 +165,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKNodeTracker; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.util.ReflectionUtils; import org.apache.yetus.audience.InterfaceAudience; @@ -3510,7 +3510,7 @@ public boolean isStopped() { } private String getMyEphemeralNodePath() { - return ZNodePaths.joinZNode(this.zooKeeper.znodePaths.rsZNode, getServerName().toString()); + return ZNodePaths.joinZNode(this.zooKeeper.getZNodePaths().rsZNode, getServerName().toString()); } private boolean isHealthCheckerConfigured() { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java index bd5c529092db..807f01a9866f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java @@ -157,7 +157,7 @@ public boolean isAborted() { */ protected static List fetchSlavesAddresses(ZKWatcher zkw) throws KeeperException { - List children = ZKUtil.listChildrenAndWatchForNewChildren(zkw, zkw.znodePaths.rsZNode); + List children = ZKUtil.listChildrenAndWatchForNewChildren(zkw, zkw.getZNodePaths().rsZNode); if (children == null) { return Collections.emptyList(); } @@ -218,7 +218,7 @@ public static class PeerRegionServerListener extends ZKListener { public PeerRegionServerListener(HBaseReplicationEndpoint replicationPeer) { super(replicationPeer.getZkw()); this.replicationEndpoint = replicationPeer; - this.regionServerListNode = replicationEndpoint.getZkw().znodePaths.rsZNode; + this.regionServerListNode = replicationEndpoint.getZkw().getZNodePaths().rsZNode; } @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java index ac1acbe7a63e..b2b00b3cddd3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java @@ -35,7 +35,7 @@ import org.apache.hadoop.hbase.replication.ReplicationStorageFactory; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; import org.apache.zookeeper.KeeperException; @@ -97,7 +97,7 @@ public void copyTableCFs() throws ReplicationException { @VisibleForTesting protected String getTableCFsNode(String peerId) { - String replicationZNode = ZNodePaths.joinZNode(zookeeper.znodePaths.baseZNode, + String replicationZNode = ZNodePaths.joinZNode(zookeeper.getZNodePaths().baseZNode, conf.get(REPLICATION_ZNODE, REPLICATION_ZNODE_DEFAULT)); String peersZNode = ZNodePaths.joinZNode(replicationZNode, conf.get(PEERS_ZNODE, PEERS_ZNODE_DEFAULT)); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java index 92560cd82c37..679d95cb24d2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java @@ -25,7 +25,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKListener; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; @@ -67,7 +67,7 @@ public ZKPermissionWatcher(ZKWatcher watcher, super(watcher); this.authManager = authManager; String aclZnodeParent = conf.get("zookeeper.znode.acl.parent", ACL_NODE); - this.aclZNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, aclZnodeParent); + this.aclZNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, aclZnodeParent); executor = Executors.newSingleThreadExecutor( new DaemonThreadFactory("zk-permission-watcher")); } @@ -260,7 +260,7 @@ private void refreshAuthManager(String entry, byte[] nodeData) throws IOExceptio */ public void writeToZookeeper(byte[] entry, byte[] permsData) { String entryName = Bytes.toString(entry); - String zkNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, ACL_NODE); + String zkNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, ACL_NODE); zkNode = ZNodePaths.joinZNode(zkNode, entryName); try { @@ -278,7 +278,7 @@ public void writeToZookeeper(byte[] entry, byte[] permsData) { * @param tableName */ public void deleteTableACLNode(final TableName tableName) { - String zkNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, ACL_NODE); + String zkNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, ACL_NODE); zkNode = ZNodePaths.joinZNode(zkNode, tableName.getNameAsString()); try { @@ -295,7 +295,7 @@ public void deleteTableACLNode(final TableName tableName) { * Delete the acl notify node of namespace */ public void deleteNamespaceACLNode(final String namespace) { - String zkNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, ACL_NODE); + String zkNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, ACL_NODE); zkNode = ZNodePaths.joinZNode(zkNode, AccessControlLists.NAMESPACE_PREFIX + namespace); try { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java index 59b91a0e4f7b..a0becf04dbb1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java @@ -33,7 +33,7 @@ import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.zookeeper.ZKClusterId; import org.apache.hadoop.hbase.zookeeper.ZKLeaderManager; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.hadoop.io.Text; import org.apache.hadoop.security.token.SecretManager; import org.apache.hadoop.security.token.Token; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java index d86a2f954460..a745194ff312 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java @@ -30,7 +30,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.util.Writables; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,7 +54,7 @@ public ZKSecretWatcher(Configuration conf, super(watcher); this.secretManager = secretManager; String keyZNodeParent = conf.get("zookeeper.znode.tokenauth.parent", DEFAULT_ROOT_NODE); - this.baseKeyZNode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, keyZNodeParent); + this.baseKeyZNode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, keyZNodeParent); this.keysParentZNode = ZNodePaths.joinZNode(baseKeyZNode, DEFAULT_KEYS_PARENT); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java index d428ff4291e0..5b50be37aff6 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java @@ -24,7 +24,7 @@ import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,8 +54,8 @@ public ZKVisibilityLabelWatcher(ZKWatcher watcher, VisibilityLabelsCache labelsC String labelZnodeParent = conf.get(VISIBILITY_LABEL_ZK_PATH, DEFAULT_VISIBILITY_LABEL_NODE); String userAuthsZnodeParent = conf.get(VISIBILITY_USER_AUTHS_ZK_PATH, DEFAULT_VISIBILITY_USER_AUTHS_NODE); - this.labelZnode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, labelZnodeParent); - this.userAuthsZnode = ZNodePaths.joinZNode(watcher.znodePaths.baseZNode, userAuthsZnodeParent); + this.labelZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, labelZnodeParent); + this.userAuthsZnode = ZNodePaths.joinZNode(watcher.getZNodePaths().baseZNode, userAuthsZnodeParent); } public void start() throws KeeperException { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java index 7a2bd00cef1b..e9811f4dbdb0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java @@ -129,7 +129,7 @@ import org.apache.hadoop.hbase.zookeeper.MetaTableLocator; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException; import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.security.UserGroupInformation; @@ -705,7 +705,7 @@ public int onlineConsistencyRepair() throws IOException, KeeperException, private boolean setMasterInMaintenanceMode() throws IOException { RetryCounter retryCounter = createZNodeRetryCounterFactory.create(); hbckEphemeralNodePath = ZNodePaths.joinZNode( - zkw.znodePaths.masterMaintZNode, + zkw.getZNodePaths().masterMaintZNode, "hbck-" + Long.toString(EnvironmentEdgeManager.currentTime())); do { try { @@ -3651,7 +3651,7 @@ boolean checkMetaRegion() throws IOException, KeeperException, InterruptedExcept private void unassignMetaReplica(HbckInfo hi) throws IOException, InterruptedException, KeeperException { undeployRegions(hi); - ZKUtil.deleteNode(zkw, zkw.znodePaths.getZNodeForReplica(hi.metaEntry.getReplicaId())); + ZKUtil.deleteNode(zkw, zkw.getZNodePaths().getZNodeForReplica(hi.metaEntry.getReplicaId())); } private void assignMetaReplica(int replicaId) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java index 129341c8b857..d9d9ec05ee67 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java @@ -29,7 +29,7 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; @@ -60,7 +60,7 @@ private ZKDataMigrator() {} public static Map queryForTableStates(ZKWatcher zkw) throws KeeperException, InterruptedException { Map rv = new HashMap<>(); - List children = ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.tableZNode); + List children = ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().tableZNode); if (children == null) return rv; for (String child: children) { @@ -101,7 +101,7 @@ public static Map queryForTableStates(ZKWatcher zkw private static ZooKeeperProtos.DeprecatedTableState.State getTableState( final ZKWatcher zkw, final TableName tableName) throws KeeperException, InterruptedException { - String znode = ZNodePaths.joinZNode(zkw.znodePaths.tableZNode, tableName.getNameAsString()); + String znode = ZNodePaths.joinZNode(zkw.getZNodePaths().tableZNode, tableName.getNameAsString()); byte [] data = ZKUtil.getData(zkw, znode); if (data == null || data.length <= 0) return null; try { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java index 2da98864d42c..7ca5ac866b7d 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java @@ -59,7 +59,7 @@ import org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.KeeperException; import org.junit.After; import org.junit.Before; @@ -179,7 +179,7 @@ public void testZookeeperNodesForReplicas() throws Exception { for (int i = 1; i < 3; i++) { String secZnode = ZNodePaths.joinZNode(baseZNode, conf.get("zookeeper.znode.metaserver", "meta-region-server") + "-" + i); - String str = zkw.znodePaths.getZNodeForReplica(i); + String str = zkw.getZNodePaths().getZNodeForReplica(i); assertTrue(str.equals(secZnode)); // check that the data in the znode is parseable (this would also mean the znode exists) data = ZKUtil.getData(zkw, secZnode); @@ -413,7 +413,7 @@ public void testHBaseFsckWithFewerMetaReplicaZnodes() throws Exception { HBaseFsckRepair.closeRegionSilentlyAndWait(c, rl.getRegionLocation(2).getServerName(), rl.getRegionLocation(2).getRegionInfo()); ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher(); - ZKUtil.deleteNode(zkw, zkw.znodePaths.getZNodeForReplica(2)); + ZKUtil.deleteNode(zkw, zkw.getZNodePaths().getZNodeForReplica(2)); // check that problem exists HBaseFsck hbck = doFsck(TEST_UTIL.getConfiguration(), false); assertErrors(hbck, new ERROR_CODE[]{ERROR_CODE.UNKNOWN,ERROR_CODE.NO_META_REGION}); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java index 9f68ea59c8ff..ef3376602534 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestActiveMasterManager.java @@ -79,8 +79,8 @@ public static void tearDownAfterClass() throws Exception { ZKWatcher zk = new ZKWatcher(TEST_UTIL.getConfiguration(), "testActiveMasterManagerFromZK", null, true); try { - ZKUtil.deleteNode(zk, zk.znodePaths.masterAddressZNode); - ZKUtil.deleteNode(zk, zk.znodePaths.clusterStateZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().masterAddressZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().clusterStateZNode); } catch(KeeperException.NoNodeException nne) {} // Create the master node with a dummy address @@ -121,8 +121,8 @@ public void testActiveMasterManagerFromZK() throws Exception { ZKWatcher zk = new ZKWatcher(TEST_UTIL.getConfiguration(), "testActiveMasterManagerFromZK", null, true); try { - ZKUtil.deleteNode(zk, zk.znodePaths.masterAddressZNode); - ZKUtil.deleteNode(zk, zk.znodePaths.clusterStateZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().masterAddressZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().clusterStateZNode); } catch(KeeperException.NoNodeException nne) {} // Create the master node with a dummy address @@ -167,11 +167,11 @@ public void testActiveMasterManagerFromZK() throws Exception { ms1.stop("stopping first server"); // Use a listener to capture when the node is actually deleted - NodeDeletionListener listener = new NodeDeletionListener(zk, zk.znodePaths.masterAddressZNode); + NodeDeletionListener listener = new NodeDeletionListener(zk, zk.getZNodePaths().masterAddressZNode); zk.registerListener(listener); LOG.info("Deleting master node"); - ZKUtil.deleteNode(zk, zk.znodePaths.masterAddressZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().masterAddressZNode); // Wait for the node to be deleted LOG.info("Waiting for active master manager to be notified"); @@ -191,7 +191,7 @@ public void testActiveMasterManagerFromZK() throws Exception { assertTrue(t.isActiveMaster); LOG.info("Deleting master node"); - ZKUtil.deleteNode(zk, zk.znodePaths.masterAddressZNode); + ZKUtil.deleteNode(zk, zk.getZNodePaths().masterAddressZNode); } /** diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentListener.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentListener.java index e8f739b4e74d..118346608e8e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentListener.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestAssignmentListener.java @@ -47,7 +47,7 @@ import org.apache.hadoop.hbase.util.JVMClusterUtil; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java index 8630dbb06dcb..5e2b7c033c12 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestHMasterRPCException.java @@ -72,7 +72,7 @@ public void setUp() throws Exception { testUtil.startMiniZKCluster(); ZKWatcher watcher = testUtil.getZooKeeperWatcher(); - ZKUtil.createWithParents(watcher, watcher.znodePaths.masterAddressZNode, Bytes.toBytes("fake:123")); + ZKUtil.createWithParents(watcher, watcher.getZNodePaths().masterAddressZNode, Bytes.toBytes("fake:123")); master = new HMaster(conf); rpcClient = RpcClientFactory.createClient(conf, HConstants.CLUSTER_ID_DEFAULT); } @@ -109,7 +109,7 @@ public void testRPCException() throws IOException, InterruptedException, KeeperE LOG.info("Expected exception: ", ie); if (!fakeZNodeDelete) { testUtil.getZooKeeperWatcher().getRecoverableZooKeeper() - .delete(testUtil.getZooKeeperWatcher().znodePaths.masterAddressZNode, -1); + .delete(testUtil.getZooKeeperWatcher().getZNodePaths().masterAddressZNode, -1); fakeZNodeDelete = true; } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java index 87e45c5c6e06..95ab22952497 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNoCluster.java @@ -120,7 +120,7 @@ public boolean isAborted() { return false; } }); - ZKUtil.deleteNodeRecursively(zkw, zkw.znodePaths.baseZNode); + ZKUtil.deleteNodeRecursively(zkw, zkw.getZNodePaths().baseZNode); zkw.close(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java index cf80d8e355a5..25b390f07c00 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterStatusServlet.java @@ -41,7 +41,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.MasterAddressTracker; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.junit.Before; import org.junit.ClassRule; import org.junit.Test; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java index 7faed1c2b17f..c32d776cb88f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMetaShutdownHandler.java @@ -35,7 +35,7 @@ import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.MetaTableLocator; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.KeeperException; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -102,7 +102,7 @@ public void testExpireMetaRegionServer() throws Exception { // Delete the ephemeral node of the meta-carrying region server. // This is trigger the expire of this region server on the master. String rsEphemeralNodePath = - ZNodePaths.joinZNode(master.getZooKeeper().znodePaths.rsZNode, metaServerName.toString()); + ZNodePaths.joinZNode(master.getZooKeeper().getZNodePaths().rsZNode, metaServerName.toString()); ZKUtil.deleteNode(master.getZooKeeper(), rsEphemeralNodePath); LOG.info("Deleted the znode for the RegionServer hosting hbase:meta; waiting on SSH"); // Wait for SSH to finish diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java index d10c2b4a970a..a837ca344360 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java @@ -25,7 +25,7 @@ import org.apache.hadoop.hbase.testclassification.MasterTests; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; @@ -82,7 +82,7 @@ public void testMirroring() throws Exception { private TableState.State getTableStateInZK(ZKWatcher watcher, final TableName tableName) throws KeeperException, IOException, InterruptedException { - String znode = ZNodePaths.joinZNode(watcher.znodePaths.tableZNode, tableName.getNameAsString()); + String znode = ZNodePaths.joinZNode(watcher.getZNodePaths().tableZNode, tableName.getNameAsString()); byte [] data = ZKUtil.getData(watcher, znode); if (data == null || data.length <= 0) { return null; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java index 533f4dc84a0d..c611bed1d380 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestSplitLogManager.java @@ -127,13 +127,13 @@ public void setup() throws Exception { new ZKWatcher(conf, "split-log-manager-tests" + UUID.randomUUID().toString(), null); master = new DummyMasterServices(zkw, conf); - ZKUtil.deleteChildrenRecursively(zkw, zkw.znodePaths.baseZNode); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.baseZNode); - assertTrue(ZKUtil.checkExists(zkw, zkw.znodePaths.baseZNode) != -1); - LOG.debug(zkw.znodePaths.baseZNode + " created"); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.splitLogZNode); - assertTrue(ZKUtil.checkExists(zkw, zkw.znodePaths.splitLogZNode) != -1); - LOG.debug(zkw.znodePaths.splitLogZNode + " created"); + ZKUtil.deleteChildrenRecursively(zkw, zkw.getZNodePaths().baseZNode); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().baseZNode); + assertTrue(ZKUtil.checkExists(zkw, zkw.getZNodePaths().baseZNode) != -1); + LOG.debug(zkw.getZNodePaths().baseZNode + " created"); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().splitLogZNode); + assertTrue(ZKUtil.checkExists(zkw, zkw.getZNodePaths().splitLogZNode) != -1); + LOG.debug(zkw.getZNodePaths().splitLogZNode + " created"); resetCounters(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionInDeadRegionServer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionInDeadRegionServer.java index 78042cc976fd..8fc08addc3cc 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionInDeadRegionServer.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestCompactionInDeadRegionServer.java @@ -42,7 +42,7 @@ import org.apache.hadoop.hbase.wal.WALFactory; import org.apache.hadoop.hbase.wal.WALProvider; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.junit.After; import org.junit.Before; import org.junit.ClassRule; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressTracker.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressTracker.java index 2a89b99ed566..a0ab23a670b8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressTracker.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMasterAddressTracker.java @@ -87,7 +87,7 @@ private MasterAddressTracker setupMasterTracker(final ServerName sn, final int i throws Exception { ZKWatcher zk = new ZKWatcher(TEST_UTIL.getConfiguration(), name.getMethodName(), null); - ZKUtil.createAndFailSilent(zk, zk.znodePaths.baseZNode); + ZKUtil.createAndFailSilent(zk, zk.getZNodePaths().baseZNode); // Should not have a master yet MasterAddressTracker addressTracker = new MasterAddressTracker(zk, null); @@ -96,12 +96,12 @@ private MasterAddressTracker setupMasterTracker(final ServerName sn, final int i zk.registerListener(addressTracker); // Use a listener to capture when the node is actually created - NodeCreationListener listener = new NodeCreationListener(zk, zk.znodePaths.masterAddressZNode); + NodeCreationListener listener = new NodeCreationListener(zk, zk.getZNodePaths().masterAddressZNode); zk.registerListener(listener); if (sn != null) { LOG.info("Creating master node"); - MasterAddressTracker.setMasterAddress(zk, zk.znodePaths.masterAddressZNode, sn, infoPort); + MasterAddressTracker.setMasterAddress(zk, zk.getZNodePaths().masterAddressZNode, sn, infoPort); // Wait for the node to be created LOG.info("Waiting for master address manager to be notified"); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java index 1b51ae4e3724..131158b29a58 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionServerHostname.java @@ -106,7 +106,7 @@ public void testRegionServerHostname() throws Exception { TEST_UTIL.startMiniCluster(NUM_MASTERS, NUM_RS); try { ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher(); - List servers = ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.rsZNode); + List servers = ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().rsZNode); // there would be NUM_RS+1 children - one for the master assertTrue(servers.size() == NUM_RS + (LoadBalancer.isTablesOnMaster(TEST_UTIL.getConfiguration())? 1: 0)); @@ -167,7 +167,7 @@ public void testRegionServerHostnameReportedToMaster() throws Exception { boolean tablesOnMaster = LoadBalancer.isTablesOnMaster(TEST_UTIL.getConfiguration()); int expectedRS = NUM_RS + (tablesOnMaster? 1: 0); try (ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher()) { - List servers = ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.rsZNode); + List servers = ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().rsZNode); assertEquals(expectedRS, servers.size()); } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java index b3e9e8ceb8c1..30b6f76b3563 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitLogWorker.java @@ -53,7 +53,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKSplitLog; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.ZooDefs.Ids; import org.junit.After; @@ -204,16 +204,16 @@ public void setup() throws Exception { zkw = new ZKWatcher(TEST_UTIL.getConfiguration(), "split-log-worker-tests", null); ds = new DummyServer(zkw, conf); - ZKUtil.deleteChildrenRecursively(zkw, zkw.znodePaths.baseZNode); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.baseZNode); - assertThat(ZKUtil.checkExists(zkw, zkw.znodePaths.baseZNode), not (is(-1))); - LOG.debug(zkw.znodePaths.baseZNode + " created"); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.splitLogZNode); - assertThat(ZKUtil.checkExists(zkw, zkw.znodePaths.splitLogZNode), not (is(-1))); + ZKUtil.deleteChildrenRecursively(zkw, zkw.getZNodePaths().baseZNode); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().baseZNode); + assertThat(ZKUtil.checkExists(zkw, zkw.getZNodePaths().baseZNode), not (is(-1))); + LOG.debug(zkw.getZNodePaths().baseZNode + " created"); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().splitLogZNode); + assertThat(ZKUtil.checkExists(zkw, zkw.getZNodePaths().splitLogZNode), not (is(-1))); - LOG.debug(zkw.znodePaths.splitLogZNode + " created"); - ZKUtil.createAndFailSilent(zkw, zkw.znodePaths.rsZNode); - assertThat(ZKUtil.checkExists(zkw, zkw.znodePaths.rsZNode), not (is(-1))); + LOG.debug(zkw.getZNodePaths().splitLogZNode + " created"); + ZKUtil.createAndFailSilent(zkw, zkw.getZNodePaths().rsZNode); + assertThat(ZKUtil.checkExists(zkw, zkw.getZNodePaths().rsZNode), not (is(-1))); SplitLogCounters.resetCounters(); executorService = new ExecutorService("TestSplitLogWorker"); @@ -430,7 +430,7 @@ public void testRescan() throws Exception { waitForCounter(SplitLogCounters.tot_wkr_preempt_task, 1, 2, WAIT_TIME); waitForCounter(SplitLogCounters.tot_wkr_task_acquired_rescan, 0, 1, WAIT_TIME); - List nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.splitLogZNode); + List nodes = ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().splitLogZNode); LOG.debug(Objects.toString(nodes)); int num = 0; for (String node : nodes) { @@ -438,7 +438,7 @@ public void testRescan() throws Exception { if (node.startsWith("RESCAN")) { String name = ZKSplitLog.getEncodedNodeName(zkw, node); String fn = ZKSplitLog.getFileName(name); - byte [] data = ZKUtil.getData(zkw, ZNodePaths.joinZNode(zkw.znodePaths.splitLogZNode, fn)); + byte [] data = ZKUtil.getData(zkw, ZNodePaths.joinZNode(zkw.getZNodePaths().splitLogZNode, fn)); slt = SplitLogTask.parseFrom(data); assertTrue(slt.toString(), slt.isDone(SRV)); } @@ -494,9 +494,9 @@ public void testAcquireMultiTasksByAvgTasksPerRS() throws Exception { RegionServerServices mockedRS = getRegionServer(RS); // create two RS nodes - String rsPath = ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, RS.getServerName()); + String rsPath = ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, RS.getServerName()); zkw.getRecoverableZooKeeper().create(rsPath, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); - rsPath = ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, RS2.getServerName()); + rsPath = ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, RS2.getServerName()); zkw.getRecoverableZooKeeper().create(rsPath, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); for (int i = 0; i < maxTasks; i++) { 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 de0b94f51ffc..41791b134d08 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 @@ -74,7 +74,7 @@ import org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.junit.After; import org.junit.Before; import org.junit.ClassRule; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java index 77b4c1b0de89..1d132ac2e90e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationTrackerZKImpl.java @@ -40,7 +40,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKClusterId; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.apache.zookeeper.KeeperException; import org.junit.AfterClass; import org.junit.Before; @@ -83,13 +83,13 @@ public static void setUpBeforeClass() throws Exception { utility.startMiniZKCluster(); conf = utility.getConfiguration(); ZKWatcher zk = HBaseTestingUtility.getZooKeeperWatcher(utility); - ZKUtil.createWithParents(zk, zk.znodePaths.rsZNode); + ZKUtil.createWithParents(zk, zk.getZNodePaths().rsZNode); } @Before public void setUp() throws Exception { zkw = HBaseTestingUtility.getZooKeeperWatcher(utility); - String fakeRs1 = ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname1.example.org:1234"); + String fakeRs1 = ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname1.example.org:1234"); try { ZKClusterId.setClusterId(zkw, new ClusterId()); rp = ReplicationFactory.getReplicationPeers(zkw, conf); @@ -115,34 +115,34 @@ public void testGetListOfRegionServers() throws Exception { // 1 region server ZKUtil.createWithParents(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname1.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname1.example.org:1234")); assertEquals(1, rt.getListOfRegionServers().size()); // 2 region servers ZKUtil.createWithParents(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname2.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname2.example.org:1234")); assertEquals(2, rt.getListOfRegionServers().size()); // 1 region server ZKUtil.deleteNode(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname2.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname2.example.org:1234")); assertEquals(1, rt.getListOfRegionServers().size()); // 0 region server ZKUtil.deleteNode(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname1.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname1.example.org:1234")); assertEquals(0, rt.getListOfRegionServers().size()); } @Test public void testRegionServerRemovedEvent() throws Exception { ZKUtil.createAndWatch(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname2.example.org:1234"), + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname2.example.org:1234"), HConstants.EMPTY_BYTE_ARRAY); rt.registerListener(new DummyReplicationListener()); // delete one ZKUtil.deleteNode(zkw, - ZNodePaths.joinZNode(zkw.znodePaths.rsZNode, "hostname2.example.org:1234")); + ZNodePaths.joinZNode(zkw.getZNodePaths().rsZNode, "hostname2.example.org:1234")); // wait for event while (rsRemovedCount.get() < 1) { Thread.sleep(5); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestZKSecretWatcherRefreshKeys.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestZKSecretWatcherRefreshKeys.java index 54e25a23f1d1..bc25ce372fbd 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestZKSecretWatcherRefreshKeys.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/token/TestZKSecretWatcherRefreshKeys.java @@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.util.Writables; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.ZNodePaths; +import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ClusterStatusTracker.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ClusterStatusTracker.java index 730c099c65f2..c337eeeaea73 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ClusterStatusTracker.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ClusterStatusTracker.java @@ -48,7 +48,7 @@ public class ClusterStatusTracker extends ZKNodeTracker { * @param abortable used to abort if a fatal error occurs */ public ClusterStatusTracker(ZKWatcher watcher, Abortable abortable) { - super(watcher, watcher.znodePaths.clusterStateZNode, abortable); + super(watcher, watcher.getZNodePaths().clusterStateZNode, abortable); } /** @@ -68,9 +68,9 @@ public void setClusterUp() throws KeeperException { byte [] upData = toByteArray(); try { - ZKUtil.createAndWatch(watcher, watcher.znodePaths.clusterStateZNode, upData); + ZKUtil.createAndWatch(watcher, watcher.getZNodePaths().clusterStateZNode, upData); } catch(KeeperException.NodeExistsException nee) { - ZKUtil.setData(watcher, watcher.znodePaths.clusterStateZNode, upData); + ZKUtil.setData(watcher, watcher.getZNodePaths().clusterStateZNode, upData); } } @@ -81,10 +81,10 @@ public void setClusterUp() public void setClusterDown() throws KeeperException { try { - ZKUtil.deleteNode(watcher, watcher.znodePaths.clusterStateZNode); + ZKUtil.deleteNode(watcher, watcher.getZNodePaths().clusterStateZNode); } catch(KeeperException.NoNodeException nne) { LOG.warn("Attempted to set cluster as down but already down, cluster " + - "state node (" + watcher.znodePaths.clusterStateZNode + ") not found"); + "state node (" + watcher.getZNodePaths().clusterStateZNode + ") not found"); } } diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/LoadBalancerTracker.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/LoadBalancerTracker.java index d3085b778f6f..5196cd2e2ba2 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/LoadBalancerTracker.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/LoadBalancerTracker.java @@ -39,7 +39,7 @@ public class LoadBalancerTracker extends ZKNodeTracker { public LoadBalancerTracker(ZKWatcher watcher, Abortable abortable) { - super(watcher, watcher.znodePaths.balancerZNode, abortable); + super(watcher, watcher.getZNodePaths().balancerZNode, abortable); } /** @@ -67,11 +67,11 @@ public void setBalancerOn(boolean balancerOn) throws KeeperException { byte [] upData = toByteArray(balancerOn); try { - ZKUtil.setData(watcher, watcher.znodePaths.balancerZNode, upData); + ZKUtil.setData(watcher, watcher.getZNodePaths().balancerZNode, upData); } catch(KeeperException.NoNodeException nne) { - ZKUtil.createAndWatch(watcher, watcher.znodePaths.balancerZNode, upData); + ZKUtil.createAndWatch(watcher, watcher.getZNodePaths().balancerZNode, upData); } - super.nodeDataChanged(watcher.znodePaths.balancerZNode); + super.nodeDataChanged(watcher.getZNodePaths().balancerZNode); } private byte [] toByteArray(boolean isBalancerOn) { diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterAddressTracker.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterAddressTracker.java index 18b81f4de694..c7a208b4dde4 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterAddressTracker.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterAddressTracker.java @@ -65,7 +65,7 @@ public class MasterAddressTracker extends ZKNodeTracker { * @param abortable abortable in case of fatal error */ public MasterAddressTracker(ZKWatcher watcher, Abortable abortable) { - super(watcher, watcher.znodePaths.masterAddressZNode, abortable); + super(watcher, watcher.getZNodePaths().masterAddressZNode, abortable); } /** @@ -101,7 +101,7 @@ public int getMasterInfoPort() { * @return info port or 0 if timed out or exceptions */ public int getBackupMasterInfoPort(final ServerName sn) { - String backupZNode = ZNodePaths.joinZNode(watcher.znodePaths.backupMasterAddressesZNode, + String backupZNode = ZNodePaths.joinZNode(watcher.getZNodePaths().backupMasterAddressesZNode, sn.toString()); try { byte[] data = ZKUtil.getData(watcher, backupZNode); @@ -147,7 +147,7 @@ public static ServerName getMasterAddress(final ZKWatcher zkw) throws KeeperException, IOException { byte [] data; try { - data = ZKUtil.getData(zkw, zkw.znodePaths.masterAddressZNode); + data = ZKUtil.getData(zkw, zkw.getZNodePaths().masterAddressZNode); } catch (InterruptedException e) { throw new InterruptedIOException(); } @@ -178,7 +178,7 @@ public static ServerName getMasterAddress(final ZKWatcher zkw) public static int getMasterInfoPort(final ZKWatcher zkw) throws KeeperException, IOException { byte[] data; try { - data = ZKUtil.getData(zkw, zkw.znodePaths.masterAddressZNode); + data = ZKUtil.getData(zkw, zkw.getZNodePaths().masterAddressZNode); } catch (InterruptedException e) { throw new InterruptedIOException(); } @@ -265,10 +265,10 @@ public static boolean deleteIfEquals(ZKWatcher zkw, final String content) { try { Stat stat = new Stat(); - byte[] data = ZKUtil.getDataNoWatch(zkw, zkw.znodePaths.masterAddressZNode, stat); + byte[] data = ZKUtil.getDataNoWatch(zkw, zkw.getZNodePaths().masterAddressZNode, stat); ServerName sn = ProtobufUtil.parseServerNameFrom(data); if (sn != null && content.equals(sn.toString())) { - return (ZKUtil.deleteNode(zkw, zkw.znodePaths.masterAddressZNode, stat.getVersion())); + return (ZKUtil.deleteNode(zkw, zkw.getZNodePaths().masterAddressZNode, stat.getVersion())); } } catch (KeeperException e) { LOG.warn("Can't get or delete the master znode", e); diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterMaintenanceModeTracker.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterMaintenanceModeTracker.java index 952da6f2e642..8cb541093a3d 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterMaintenanceModeTracker.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MasterMaintenanceModeTracker.java @@ -40,7 +40,7 @@ public boolean isInMaintenanceMode() { } private void update(String path) { - if (path.startsWith(watcher.znodePaths.masterMaintZNode)) { + if (path.startsWith(watcher.getZNodePaths().masterMaintZNode)) { update(); } } @@ -48,7 +48,8 @@ private void update(String path) { private void update() { try { List children = - ZKUtil.listChildrenAndWatchForNewChildren(watcher, watcher.znodePaths.masterMaintZNode); + ZKUtil.listChildrenAndWatchForNewChildren(watcher, + watcher.getZNodePaths().masterMaintZNode); hasChildren = (children != null && children.size() > 0); } catch (KeeperException e) { // Ignore the ZK keeper exception diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java index 4c170f7e744f..423581d8360a 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/MetaTableLocator.java @@ -211,7 +211,7 @@ public ServerName waitMetaRegionLocation(ZKWatcher zkw, long timeout) public ServerName waitMetaRegionLocation(ZKWatcher zkw, int replicaId, long timeout) throws InterruptedException, NotAllMetaRegionsOnlineException { try { - if (ZKUtil.checkExists(zkw, zkw.znodePaths.baseZNode) == -1) { + if (ZKUtil.checkExists(zkw, zkw.getZNodePaths().baseZNode) == -1) { String errorMsg = "Check the value configured in 'zookeeper.znode.parent'. " + "There could be a mismatch with the one configured in the master."; LOG.error(errorMsg); @@ -460,7 +460,7 @@ public static void setMetaLocation(ZKWatcher zookeeper, ServerName serverName, i byte[] data = ProtobufUtil.prependPBMagic(pbrsr.toByteArray()); try { ZKUtil.setData(zookeeper, - zookeeper.znodePaths.getZNodeForReplica(replicaId), data); + zookeeper.getZNodePaths().getZNodeForReplica(replicaId), data); } catch(KeeperException.NoNodeException nne) { if (replicaId == RegionInfo.DEFAULT_REPLICA_ID) { LOG.debug("META region location doesn't exist, create it"); @@ -468,7 +468,8 @@ public static void setMetaLocation(ZKWatcher zookeeper, ServerName serverName, i LOG.debug("META region location doesn't exist for replicaId=" + replicaId + ", create it"); } - ZKUtil.createAndWatch(zookeeper, zookeeper.znodePaths.getZNodeForReplica(replicaId), data); + ZKUtil.createAndWatch(zookeeper, zookeeper.getZNodePaths().getZNodeForReplica(replicaId), + data); } } @@ -492,7 +493,7 @@ public static RegionState getMetaRegionState(ZKWatcher zkw, int replicaId) RegionState.State state = RegionState.State.OPEN; ServerName serverName = null; try { - byte[] data = ZKUtil.getData(zkw, zkw.znodePaths.getZNodeForReplica(replicaId)); + byte[] data = ZKUtil.getData(zkw, zkw.getZNodePaths().getZNodeForReplica(replicaId)); if (data != null && data.length > 0 && ProtobufUtil.isPBMagicPrefix(data)) { try { int prefixLen = ProtobufUtil.lengthOfPBMagic(); @@ -545,7 +546,7 @@ public void deleteMetaLocation(ZKWatcher zookeeper, int replicaId) } try { // Just delete the node. Don't need any watches. - ZKUtil.deleteNode(zookeeper, zookeeper.znodePaths.getZNodeForReplica(replicaId)); + ZKUtil.deleteNode(zookeeper, zookeeper.getZNodePaths().getZNodeForReplica(replicaId)); } catch(KeeperException.NoNodeException nne) { // Has already been deleted } diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/RegionNormalizerTracker.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/RegionNormalizerTracker.java index 7413879b0b83..d69e75094b6b 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/RegionNormalizerTracker.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/RegionNormalizerTracker.java @@ -38,7 +38,7 @@ public class RegionNormalizerTracker extends ZKNodeTracker { private static final Logger LOG = LoggerFactory.getLogger(RegionNormalizerTracker.class); public RegionNormalizerTracker(ZKWatcher watcher, Abortable abortable) { - super(watcher, watcher.znodePaths.regionNormalizerZNode, abortable); + super(watcher, watcher.getZNodePaths().regionNormalizerZNode, abortable); } /** @@ -65,11 +65,11 @@ public boolean isNormalizerOn() { public void setNormalizerOn(boolean normalizerOn) throws KeeperException { byte [] upData = toByteArray(normalizerOn); try { - ZKUtil.setData(watcher, watcher.znodePaths.regionNormalizerZNode, upData); + ZKUtil.setData(watcher, watcher.getZNodePaths().regionNormalizerZNode, upData); } catch(KeeperException.NoNodeException nne) { - ZKUtil.createAndWatch(watcher, watcher.znodePaths.regionNormalizerZNode, upData); + ZKUtil.createAndWatch(watcher, watcher.getZNodePaths().regionNormalizerZNode, upData); } - super.nodeDataChanged(watcher.znodePaths.regionNormalizerZNode); + super.nodeDataChanged(watcher.getZNodePaths().regionNormalizerZNode); } private byte [] toByteArray(boolean isNormalizerOn) { diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKAclReset.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKAclReset.java index 50a6f5e78fed..03a28469c049 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKAclReset.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKAclReset.java @@ -70,8 +70,8 @@ private static void resetAcls(final Configuration conf, boolean eraseAcls) ZKWatcher zkw = new ZKWatcher(conf, "ZKAclReset", null); try { LOG.info((eraseAcls ? "Erase" : "Set") + " HBase ACLs for " + - zkw.getQuorum() + " " + zkw.znodePaths.baseZNode); - resetAcls(zkw, zkw.znodePaths.baseZNode, eraseAcls); + zkw.getQuorum() + " " + zkw.getZNodePaths().baseZNode); + resetAcls(zkw, zkw.getZNodePaths().baseZNode, eraseAcls); } finally { zkw.close(); } diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKClusterId.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKClusterId.java index be2529b054f0..2f0b79e80f68 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKClusterId.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKClusterId.java @@ -62,10 +62,10 @@ public String getId() { public static String readClusterIdZNode(ZKWatcher watcher) throws KeeperException { - if (ZKUtil.checkExists(watcher, watcher.znodePaths.clusterIdZNode) != -1) { + if (ZKUtil.checkExists(watcher, watcher.getZNodePaths().clusterIdZNode) != -1) { byte [] data; try { - data = ZKUtil.getData(watcher, watcher.znodePaths.clusterIdZNode); + data = ZKUtil.getData(watcher, watcher.getZNodePaths().clusterIdZNode); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; @@ -83,7 +83,7 @@ public static String readClusterIdZNode(ZKWatcher watcher) public static void setClusterId(ZKWatcher watcher, ClusterId id) throws KeeperException { - ZKUtil.createSetData(watcher, watcher.znodePaths.clusterIdZNode, id.toByteArray()); + ZKUtil.createSetData(watcher, watcher.getZNodePaths().clusterIdZNode, id.toByteArray()); } /** diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKNodeTracker.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKNodeTracker.java index f76947b2c896..3b6435ec3b20 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKNodeTracker.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKNodeTracker.java @@ -238,11 +238,11 @@ public synchronized void nodeDataChanged(String path) { */ public boolean checkIfBaseNodeAvailable() { try { - if (ZKUtil.checkExists(watcher, watcher.znodePaths.baseZNode) == -1) { + if (ZKUtil.checkExists(watcher, watcher.getZNodePaths().baseZNode) == -1) { return false; } } catch (KeeperException e) { - abortable.abort("Exception while checking if basenode (" + watcher.znodePaths.baseZNode + abortable.abort("Exception while checking if basenode (" + watcher.getZNodePaths().baseZNode + ") exists in ZooKeeper.", e); } diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKSplitLog.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKSplitLog.java index b58c98cde6dd..f93307010a7f 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKSplitLog.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKSplitLog.java @@ -47,7 +47,7 @@ private ZKSplitLog() { * @param filename log file name (only the basename) */ public static String getEncodedNodeName(ZKWatcher zkw, String filename) { - return ZNodePaths.joinZNode(zkw.znodePaths.splitLogZNode, encode(filename)); + return ZNodePaths.joinZNode(zkw.getZNodePaths().splitLogZNode, encode(filename)); } public static String getFileName(String node) { @@ -72,7 +72,7 @@ static String decode(String s) { } public static String getRescanNode(ZKWatcher zkw) { - return ZNodePaths.joinZNode(zkw.znodePaths.splitLogZNode, "RESCAN"); + return ZNodePaths.joinZNode(zkw.getZNodePaths().splitLogZNode, "RESCAN"); } /** diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java index f1cacbf35846..93c43c01b411 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java @@ -891,7 +891,7 @@ private static ArrayList createACL(ZKWatcher zkw, String node) { public static ArrayList createACL(ZKWatcher zkw, String node, boolean isSecureZooKeeper) { - if (!node.startsWith(zkw.znodePaths.baseZNode)) { + if (!node.startsWith(zkw.getZNodePaths().baseZNode)) { return Ids.OPEN_ACL_UNSAFE; } if (isSecureZooKeeper) { @@ -923,7 +923,7 @@ public static ArrayList createACL(ZKWatcher zkw, String node, } // Certain znodes are accessed directly by the client, // so they must be readable by non-authenticated clients - if (zkw.znodePaths.isClientReadable(node)) { + if (zkw.getZNodePaths().isClientReadable(node)) { acls.addAll(Ids.CREATOR_ALL_ACL); acls.addAll(Ids.READ_ACL_UNSAFE); } else { @@ -1735,7 +1735,7 @@ private static void processSequentially(ZKWatcher zkw, List ops) public static String dump(ZKWatcher zkw) { StringBuilder sb = new StringBuilder(); try { - sb.append("HBase is rooted at ").append(zkw.znodePaths.baseZNode); + sb.append("HBase is rooted at ").append(zkw.getZNodePaths().baseZNode); sb.append("\nActive master address: "); try { sb.append(MasterAddressTracker.getMasterAddress(zkw)); @@ -1743,7 +1743,8 @@ public static String dump(ZKWatcher zkw) { sb.append("<>"); } sb.append("\nBackup master addresses:"); - for (String child : listChildrenNoWatch(zkw, zkw.znodePaths.backupMasterAddressesZNode)) { + for (String child : listChildrenNoWatch(zkw, + zkw.getZNodePaths().backupMasterAddressesZNode)) { sb.append("\n ").append(child); } sb.append("\nRegion server holding hbase:meta: " @@ -1756,7 +1757,7 @@ public static String dump(ZKWatcher zkw) { + new MetaTableLocator().getMetaRegionLocation(zkw, i)); } sb.append("\nRegion servers:"); - for (String child : listChildrenNoWatch(zkw, zkw.znodePaths.rsZNode)) { + for (String child : listChildrenNoWatch(zkw, zkw.getZNodePaths().rsZNode)) { sb.append("\n ").append(child); } try { @@ -1799,7 +1800,7 @@ public static String dump(ZKWatcher zkw) { */ private static void getReplicationZnodesDump(ZKWatcher zkw, StringBuilder sb) throws KeeperException { - String replicationZnode = zkw.znodePaths.replicationZNode; + String replicationZnode = zkw.getZNodePaths().replicationZNode; if (ZKUtil.checkExists(zkw, replicationZnode) == -1) { return; @@ -1810,11 +1811,11 @@ private static void getReplicationZnodesDump(ZKWatcher zkw, StringBuilder sb) List children = ZKUtil.listChildrenNoWatch(zkw, replicationZnode); for (String child : children) { String znode = ZNodePaths.joinZNode(replicationZnode, child); - if (znode.equals(zkw.znodePaths.peersZNode)) { + if (znode.equals(zkw.getZNodePaths().peersZNode)) { appendPeersZnodes(zkw, znode, sb); - } else if (znode.equals(zkw.znodePaths.queuesZNode)) { + } else if (znode.equals(zkw.getZNodePaths().queuesZNode)) { appendRSZnodes(zkw, znode, sb); - } else if (znode.equals(zkw.znodePaths.hfileRefsZNode)) { + } else if (znode.equals(zkw.getZNodePaths().hfileRefsZNode)) { appendHFileRefsZnodes(zkw, znode, sb); } } @@ -1989,9 +1990,9 @@ private static void logRetrievedMsg(final ZKWatcher zkw, " byte(s) of data from znode " + znode + (watcherSet? " and set watcher; ": "; data=") + (data == null? "null": data.length == 0? "empty": ( - znode.startsWith(zkw.znodePaths.metaZNodePrefix)? + znode.startsWith(zkw.getZNodePaths().metaZNodePrefix)? getServerNameOrEmptyString(data): - znode.startsWith(zkw.znodePaths.backupMasterAddressesZNode)? + znode.startsWith(zkw.getZNodePaths().backupMasterAddressesZNode)? getServerNameOrEmptyString(data): StringUtils.abbreviate(Bytes.toStringBinary(data), 32))))); } diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java index 47aeee89f9b8..fb36258ed500 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java @@ -76,7 +76,7 @@ public class ZKWatcher implements Watcher, Abortable, Closeable { // Used if abortable is null private boolean aborted = false; - public final ZNodePaths znodePaths; + private final ZNodePaths znodePaths; // listeners to be notified private final List listeners = new CopyOnWriteArrayList<>(); @@ -158,7 +158,7 @@ public ZKWatcher(Configuration conf, String identifier, Abortable abortable, // handle the syncconnect event. this.identifier = identifier + "0x0"; this.abortable = abortable; - this.znodePaths = new ZNodePaths(conf); + this.getZNodePaths() = new ZNodePaths(conf); PendingWatcher pendingWatcher = new PendingWatcher(); this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, pendingWatcher, identifier); pendingWatcher.prepare(this); diff --git a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMulti.java b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMulti.java index 55e7aa8e5d15..0f2472ba9ed6 100644 --- a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMulti.java +++ b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKMulti.java @@ -90,7 +90,7 @@ public void testSimpleMulti() throws Exception { ZKUtil.multiOrSequential(zkw, new LinkedList<>(), false); // single create - String path = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testSimpleMulti"); + String path = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testSimpleMulti"); LinkedList singleCreate = new LinkedList<>(); singleCreate.add(ZKUtilOp.createAndFailSilent(path, new byte[0])); ZKUtil.multiOrSequential(zkw, singleCreate, false); @@ -112,12 +112,12 @@ public void testSimpleMulti() throws Exception { @Test public void testComplexMulti() throws Exception { - String path1 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testComplexMulti1"); - String path2 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testComplexMulti2"); - String path3 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testComplexMulti3"); - String path4 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testComplexMulti4"); - String path5 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testComplexMulti5"); - String path6 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testComplexMulti6"); + String path1 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testComplexMulti1"); + String path2 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testComplexMulti2"); + String path3 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testComplexMulti3"); + String path4 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testComplexMulti4"); + String path5 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testComplexMulti5"); + String path6 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testComplexMulti6"); // create 4 nodes that we'll setData on or delete later LinkedList create4Nodes = new LinkedList<>(); create4Nodes.add(ZKUtilOp.createAndFailSilent(path1, Bytes.toBytes(path1))); @@ -156,7 +156,7 @@ public void testComplexMulti() throws Exception { public void testSingleFailure() throws Exception { // try to delete a node that doesn't exist boolean caughtNoNode = false; - String path = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testSingleFailureZ"); + String path = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testSingleFailureZ"); LinkedList ops = new LinkedList<>(); ops.add(ZKUtilOp.deleteNodeFailSilent(path)); try { @@ -193,9 +193,9 @@ public void testSingleFailure() throws Exception { @Test public void testSingleFailureInMulti() throws Exception { // try a multi where all but one operation succeeds - String pathA = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testSingleFailureInMultiA"); - String pathB = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testSingleFailureInMultiB"); - String pathC = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testSingleFailureInMultiC"); + String pathA = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testSingleFailureInMultiA"); + String pathB = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testSingleFailureInMultiB"); + String pathC = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testSingleFailureInMultiC"); LinkedList ops = new LinkedList<>(); ops.add(ZKUtilOp.createAndFailSilent(pathA, Bytes.toBytes(pathA))); ops.add(ZKUtilOp.createAndFailSilent(pathB, Bytes.toBytes(pathB))); @@ -215,17 +215,17 @@ public void testSingleFailureInMulti() throws Exception { @Test public void testMultiFailure() throws Exception { - String pathX = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testMultiFailureX"); - String pathY = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testMultiFailureY"); - String pathZ = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testMultiFailureZ"); + String pathX = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testMultiFailureX"); + String pathY = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testMultiFailureY"); + String pathZ = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testMultiFailureZ"); // create X that we will use to fail create later LinkedList ops = new LinkedList<>(); ops.add(ZKUtilOp.createAndFailSilent(pathX, Bytes.toBytes(pathX))); ZKUtil.multiOrSequential(zkw, ops, false); // fail one of each create ,setData, delete - String pathV = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testMultiFailureV"); - String pathW = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "testMultiFailureW"); + String pathV = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testMultiFailureV"); + String pathW = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "testMultiFailureW"); ops = new LinkedList<>(); ops.add(ZKUtilOp.createAndFailSilent(pathX, Bytes.toBytes(pathX))); // fail -- already exists ops.add(ZKUtilOp.setData(pathY, Bytes.toBytes(pathY))); // fail -- doesn't exist @@ -269,10 +269,10 @@ public void testMultiFailure() throws Exception { @Test public void testRunSequentialOnMultiFailure() throws Exception { - String path1 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "runSequential1"); - String path2 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "runSequential2"); - String path3 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "runSequential3"); - String path4 = ZNodePaths.joinZNode(zkw.znodePaths.baseZNode, "runSequential4"); + String path1 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "runSequential1"); + String path2 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "runSequential2"); + String path3 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "runSequential3"); + String path4 = ZNodePaths.joinZNode(zkw.getZNodePaths().baseZNode, "runSequential4"); // create some nodes that we will use later LinkedList ops = new LinkedList<>(); diff --git a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKNodeTracker.java b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKNodeTracker.java index 9e90177ea342..8b059bc10131 100644 --- a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKNodeTracker.java +++ b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKNodeTracker.java @@ -99,9 +99,9 @@ public void testNodeTracker() throws Exception { Abortable abortable = new StubAbortable(); ZKWatcher zk = new ZKWatcher(TEST_UTIL.getConfiguration(), "testNodeTracker", abortable); - ZKUtil.createAndFailSilent(zk, zk.znodePaths.baseZNode); + ZKUtil.createAndFailSilent(zk, zk.getZNodePaths().baseZNode); - final String node = ZNodePaths.joinZNode(zk.znodePaths.baseZNode, + final String node = ZNodePaths.joinZNode(zk.getZNodePaths().baseZNode, Long.toString(ThreadLocalRandom.current().nextLong())); final byte [] dataOne = Bytes.toBytes("dataOne"); @@ -322,7 +322,7 @@ public void testCleanZNode() throws Exception { TEST_UTIL.getConfiguration().get(HConstants.ZOOKEEPER_ZNODE_PARENT, HConstants.DEFAULT_ZOOKEEPER_ZNODE_PARENT)); - final String nodeName = zkw.znodePaths.masterAddressZNode; + final String nodeName = zkw.getZNodePaths().masterAddressZNode; // Check that we manage the case when there is no data ZKUtil.createAndFailSilent(zkw, nodeName); diff --git a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKUtilNoServer.java b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKUtilNoServer.java index 99ec35ebab70..c8cc0eb2eeef 100644 --- a/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKUtilNoServer.java +++ b/hbase-zookeeper/src/test/java/org/apache/hadoop/hbase/zookeeper/TestZKUtilNoServer.java @@ -112,7 +112,7 @@ public RecoverableZooKeeper getRecoverableZooKeeper() { } }; Mockito.doThrow(new InterruptedException()).when(recoverableZk) - .getChildren(zkw.znodePaths.baseZNode, null); - ZKUtil.listChildrenNoWatch(zkw, zkw.znodePaths.baseZNode); + .getChildren(zkw.getZNodePaths().baseZNode, null); + ZKUtil.listChildrenNoWatch(zkw, zkw.getZNodePaths().baseZNode); } } From ddba7f90c29a96c599b6bd18e09f06ada3ba1cda Mon Sep 17 00:00:00 2001 From: maoling Date: Wed, 11 Apr 2018 21:42:50 +0800 Subject: [PATCH 17/19] 2 --- .../main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java index fb36258ed500..59f1f272a543 100644 --- a/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java +++ b/hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKWatcher.java @@ -158,7 +158,7 @@ public ZKWatcher(Configuration conf, String identifier, Abortable abortable, // handle the syncconnect event. this.identifier = identifier + "0x0"; this.abortable = abortable; - this.getZNodePaths() = new ZNodePaths(conf); + this.znodePaths = new ZNodePaths(conf); PendingWatcher pendingWatcher = new PendingWatcher(); this.recoverableZooKeeper = ZKUtil.connect(conf, quorum, pendingWatcher, identifier); pendingWatcher.prepare(this); From d934a5a96b109c101d78288ba0a5422ccf8e206e Mon Sep 17 00:00:00 2001 From: maoling Date: Wed, 11 Apr 2018 22:07:28 +0800 Subject: [PATCH 18/19] 3 --- .../main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java | 2 +- .../src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java | 2 +- .../apache/hadoop/hbase/backup/example/HFileArchiveManager.java | 2 +- .../hadoop/hbase/backup/example/ZKTableArchiveClient.java | 2 +- .../src/main/java/org/apache/hadoop/hbase/master/HMaster.java | 2 +- .../apache/hadoop/hbase/procedure/ZKProcedureMemberRpcs.java | 2 +- .../java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java | 2 +- .../org/apache/hadoop/hbase/regionserver/HRegionServer.java | 2 +- .../hbase/replication/master/ReplicationPeerConfigUpgrader.java | 2 +- .../hadoop/hbase/security/access/ZKPermissionWatcher.java | 2 +- .../hbase/security/token/AuthenticationTokenSecretManager.java | 2 +- .../org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java | 2 +- .../hbase/security/visibility/ZKVisibilityLabelWatcher.java | 2 +- .../src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java | 2 +- .../main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java index 441354978aea..101c40ebd86f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZKNamespaceManager.java @@ -28,7 +28,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKListener; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java index a64d0bfe8449..697706507bf0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java @@ -30,7 +30,7 @@ import org.apache.hadoop.hbase.zookeeper.MasterAddressTracker; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/HFileArchiveManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/HFileArchiveManager.java index c35dc72726f6..c51d4937a143 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/HFileArchiveManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/HFileArchiveManager.java @@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java index edac2b5d447d..142788e7618a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/ZKTableArchiveClient.java @@ -25,7 +25,7 @@ import org.apache.hadoop.conf.Configured; import org.apache.hadoop.hbase.client.ClusterConnection; import org.apache.hadoop.hbase.util.Bytes; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.zookeeper.KeeperException; /** diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 67166069df44..85a4eb53fd0f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -196,7 +196,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKClusterId; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.eclipse.jetty.server.Server; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureMemberRpcs.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureMemberRpcs.java index 128361235a60..f29d133d8432 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureMemberRpcs.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureMemberRpcs.java @@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java index 45300ed16947..0e9799977ba1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureUtil.java @@ -25,7 +25,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKWatcher; import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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 12afdaf7e9fc..a46079d252dd 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 @@ -165,7 +165,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKNodeTracker; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.util.ReflectionUtils; import org.apache.yetus.audience.InterfaceAudience; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java index b2b00b3cddd3..4d481239cf0b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/master/ReplicationPeerConfigUpgrader.java @@ -35,7 +35,7 @@ import org.apache.hadoop.hbase.replication.ReplicationStorageFactory; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; import org.apache.zookeeper.KeeperException; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java index 679d95cb24d2..2266e866f4d8 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/ZKPermissionWatcher.java @@ -25,7 +25,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKListener; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java index a0becf04dbb1..59b91a0e4f7b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/AuthenticationTokenSecretManager.java @@ -33,7 +33,7 @@ import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.zookeeper.ZKClusterId; import org.apache.hadoop.hbase.zookeeper.ZKLeaderManager; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.hadoop.io.Text; import org.apache.hadoop.security.token.SecretManager; import org.apache.hadoop.security.token.Token; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java index a745194ff312..f7be45bbfd85 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/token/ZKSecretWatcher.java @@ -30,7 +30,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.util.Writables; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java index 5b50be37aff6..0e16500133de 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/ZKVisibilityLabelWatcher.java @@ -24,7 +24,7 @@ import org.apache.yetus.audience.InterfaceAudience; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.zookeeper.ZKUtil; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java index e9811f4dbdb0..b831ef39d1af 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java @@ -129,7 +129,7 @@ import org.apache.hadoop.hbase.zookeeper.MetaTableLocator; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.hadoop.hdfs.protocol.AlreadyBeingCreatedException; import org.apache.hadoop.ipc.RemoteException; import org.apache.hadoop.security.UserGroupInformation; diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java index d9d9ec05ee67..89fbed405a83 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ZKDataMigrator.java @@ -29,7 +29,7 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger; From 92ac91d6cfa89dc540f05d6ccdac6618b954405c Mon Sep 17 00:00:00 2001 From: maoling Date: Wed, 11 Apr 2018 22:14:58 +0800 Subject: [PATCH 19/19] 4 --- .../apache/hadoop/hbase/procedure/ZKProcedureCoordinator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureCoordinator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureCoordinator.java index ef9ffbe662eb..4184e5580bd2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureCoordinator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ZKProcedureCoordinator.java @@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.errorhandling.ForeignException; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZKWatcher; -import org.apache.hadoop.hbase.zookeeper.getZNodePaths(); +import org.apache.hadoop.hbase.zookeeper.ZNodePaths; import org.apache.yetus.audience.InterfaceAudience; import org.apache.zookeeper.KeeperException; import org.slf4j.Logger;