You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2019/12/13 19:35:16 UTC
[hbase] branch master updated: HBASE-23575 Remove dead code in
AsyncRegistry (#929)
This is an automated email from the ASF dual-hosted git repository.
busbey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new efa4fe9 HBASE-23575 Remove dead code in AsyncRegistry (#929)
efa4fe9 is described below
commit efa4fe901a3c050b0db087c45d47d250c7ca1039
Author: Bharath Vissapragada <bh...@apache.org>
AuthorDate: Wed Dec 11 17:44:56 2019 -0800
HBASE-23575 Remove dead code in AsyncRegistry (#929)
Removes a bunch of dead code and fixes some checkstyle nits.
Signed-off-by: Viraj Jasani <vi...@gmail.com>
Signed-off-by: Sean Busbey <bu...@apache.org>
---
.../org/apache/hadoop/hbase/client/AsyncRegistry.java | 15 +--------------
.../apache/hadoop/hbase/client/ZKAsyncRegistry.java | 18 ++----------------
.../hadoop/hbase/client/DoNothingAsyncRegistry.java | 13 +------------
.../apache/hadoop/hbase/client/DummyAsyncRegistry.java | 12 +-----------
.../hadoop/hbase/client/TestZKAsyncRegistry.java | 6 +-----
5 files changed, 6 insertions(+), 58 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegistry.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegistry.java
index 96329dc..9537777 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegistry.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncRegistry.java
@@ -1,4 +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
@@ -19,15 +19,12 @@ package org.apache.hadoop.hbase.client;
import java.io.Closeable;
import java.util.concurrent.CompletableFuture;
-
import org.apache.hadoop.hbase.RegionLocations;
import org.apache.hadoop.hbase.ServerName;
import org.apache.yetus.audience.InterfaceAudience;
/**
* Implementations hold cluster information such as this cluster's id, location of hbase:meta, etc..
- * All stuffs that may be related to zookeeper at client side are placed here.
- * <p>
* Internal use only.
*/
@InterfaceAudience.Private
@@ -46,21 +43,11 @@ interface AsyncRegistry extends Closeable {
CompletableFuture<String> getClusterId();
/**
- * Get the number of 'running' regionservers.
- */
- CompletableFuture<Integer> getCurrentNrHRS();
-
- /**
* Get the address of HMaster.
*/
CompletableFuture<ServerName> getMasterAddress();
/**
- * Get the info port of HMaster.
- */
- CompletableFuture<Integer> getMasterInfoPort();
-
- /**
* Closes this instance and releases any system resources associated with it
*/
@Override
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ZKAsyncRegistry.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ZKAsyncRegistry.java
index 36fa6bb..08e3846 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ZKAsyncRegistry.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/ZKAsyncRegistry.java
@@ -1,4 +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
@@ -24,7 +24,6 @@ import static org.apache.hadoop.hbase.client.RegionReplicaUtil.getRegionInfoForR
import static org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil.lengthOfPBMagic;
import static org.apache.hadoop.hbase.util.FutureUtils.addListener;
import static org.apache.hadoop.hbase.zookeeper.ZKMetadata.removeMetaData;
-
import java.io.IOException;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -43,14 +42,12 @@ import org.apache.hadoop.hbase.zookeeper.ZNodePaths;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
-
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos;
/**
- * Fetch the registry data from zookeeper.
+ * Zookeeper based registry implementation.
*/
@InterfaceAudience.Private
class ZKAsyncRegistry implements AsyncRegistry {
@@ -210,11 +207,6 @@ class ZKAsyncRegistry implements AsyncRegistry {
return future;
}
- @Override
- public CompletableFuture<Integer> getCurrentNrHRS() {
- return zk.exists(znodePaths.rsZNode).thenApply(s -> s != null ? s.getNumChildren() : 0);
- }
-
private static ZooKeeperProtos.Master getMasterProto(byte[] data) throws IOException {
if (data == null || data.length == 0) {
return null;
@@ -238,12 +230,6 @@ class ZKAsyncRegistry implements AsyncRegistry {
}
@Override
- public CompletableFuture<Integer> getMasterInfoPort() {
- return getAndConvert(znodePaths.masterAddressZNode, ZKAsyncRegistry::getMasterProto)
- .thenApply(proto -> proto != null ? proto.getInfoPort() : 0);
- }
-
- @Override
public void close() {
zk.close();
}
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/DoNothingAsyncRegistry.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/DoNothingAsyncRegistry.java
index 6633068..8c7b073 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/DoNothingAsyncRegistry.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/DoNothingAsyncRegistry.java
@@ -1,4 +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
@@ -18,7 +18,6 @@
package org.apache.hadoop.hbase.client;
import java.util.concurrent.CompletableFuture;
-
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.RegionLocations;
import org.apache.hadoop.hbase.ServerName;
@@ -44,21 +43,11 @@ class DoNothingAsyncRegistry implements AsyncRegistry {
}
@Override
- public CompletableFuture<Integer> getCurrentNrHRS() {
- return CompletableFuture.completedFuture(0);
- }
-
- @Override
public CompletableFuture<ServerName> getMasterAddress() {
return CompletableFuture.completedFuture(null);
}
@Override
- public CompletableFuture<Integer> getMasterInfoPort() {
- return CompletableFuture.completedFuture(0);
- }
-
- @Override
public void close() {
}
}
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/DummyAsyncRegistry.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/DummyAsyncRegistry.java
index e9ae25d..245876e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/DummyAsyncRegistry.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/DummyAsyncRegistry.java
@@ -1,4 +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
@@ -40,21 +40,11 @@ public class DummyAsyncRegistry implements AsyncRegistry {
}
@Override
- public CompletableFuture<Integer> getCurrentNrHRS() {
- return null;
- }
-
- @Override
public CompletableFuture<ServerName> getMasterAddress() {
return null;
}
@Override
- public CompletableFuture<Integer> getMasterInfoPort() {
- return null;
- }
-
- @Override
public void close() {
}
}
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestZKAsyncRegistry.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestZKAsyncRegistry.java
index 5a72dae..3e4ca94 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestZKAsyncRegistry.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestZKAsyncRegistry.java
@@ -1,4 +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
@@ -25,7 +25,6 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
-
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.stream.IntStream;
@@ -84,11 +83,8 @@ public class TestZKAsyncRegistry {
String expectedClusterId = TEST_UTIL.getHBaseCluster().getMaster().getClusterId();
assertEquals("Expected " + expectedClusterId + ", found=" + clusterId, expectedClusterId,
clusterId);
- assertEquals(TEST_UTIL.getHBaseCluster().getClusterMetrics().getLiveServerMetrics().size(),
- REGISTRY.getCurrentNrHRS().get().intValue());
assertEquals(TEST_UTIL.getHBaseCluster().getMaster().getServerName(),
REGISTRY.getMasterAddress().get());
- assertEquals(-1, REGISTRY.getMasterInfoPort().get().intValue());
RegionReplicaTestHelper
.waitUntilAllMetaReplicasHavingRegionLocation(TEST_UTIL.getConfiguration(), REGISTRY, 3);
RegionLocations locs = REGISTRY.getMetaRegionLocation().get();