Skip to content

Commit 4a61c8b

Browse files
authored
HBASE-22744 Removed deprecated status and load classes in client module
Signed-off-by: stack <stack@apache.org>
1 parent f9fd5b6 commit 4a61c8b

File tree

11 files changed

+49
-1784
lines changed

11 files changed

+49
-1784
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/ClusterStatus.java

Lines changed: 0 additions & 400 deletions
This file was deleted.

hbase-client/src/main/java/org/apache/hadoop/hbase/RegionLoad.java

Lines changed: 0 additions & 421 deletions
This file was deleted.

hbase-client/src/main/java/org/apache/hadoop/hbase/ServerLoad.java

Lines changed: 0 additions & 596 deletions
This file was deleted.

hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetOnlineRegionResponse;
132132
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoRequest;
133133
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionInfoResponse;
134-
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetRegionLoadResponse;
135134
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetServerInfoRequest;
136135
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetServerInfoResponse;
137136
import org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.GetStoreFileRequest;
@@ -1734,16 +1733,6 @@ public static org.apache.hadoop.hbase.client.RegionInfo getRegionInfo(final RpcC
17341733
}
17351734
}
17361735

1737-
public static List<org.apache.hadoop.hbase.RegionLoad> getRegionLoadInfo(
1738-
GetRegionLoadResponse regionLoadResponse) {
1739-
List<org.apache.hadoop.hbase.RegionLoad> regionLoadList =
1740-
new ArrayList<>(regionLoadResponse.getRegionLoadsCount());
1741-
for (RegionLoad regionLoad : regionLoadResponse.getRegionLoadsList()) {
1742-
regionLoadList.add(new org.apache.hadoop.hbase.RegionLoad(regionLoad));
1743-
}
1744-
return regionLoadList;
1745-
}
1746-
17471736
/**
17481737
* A helper to close a region given a region name
17491738
* using admin protocol.

hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public static void setUpBeforeClass() throws Exception {
100100
TEST_UTIL.waitFor(6000, new Waiter.Predicate<IOException>() {
101101
@Override
102102
public boolean evaluate() throws IOException {
103-
return TEST_UTIL.getMiniHBaseCluster().getClusterStatus().getAverageLoad() > 0;
103+
return TEST_UTIL.getMiniHBaseCluster().getClusterMetrics().getAverageLoad() > 0;
104104
}
105105
});
106106
}

hbase-server/src/test/java/org/apache/hadoop/hbase/MiniHBaseCluster.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public MiniHBaseCluster(Configuration conf, int numMasters, int numRegionServers
110110
CompatibilityFactory.getInstance(MetricsAssertHelper.class).init();
111111

112112
init(numMasters, numRegionServers, rsPorts, masterClass, regionserverClass);
113-
this.initialClusterStatus = getClusterStatus();
113+
this.initialClusterStatus = getClusterMetrics();
114114
}
115115

116116
public Configuration getConfiguration() {
@@ -435,9 +435,9 @@ public JVMClusterUtil.RegionServerThread startRegionServerAndWait(long timeout)
435435
ServerName rsServerName = t.getRegionServer().getServerName();
436436

437437
long start = System.currentTimeMillis();
438-
ClusterStatus clusterStatus = getClusterStatus();
438+
ClusterMetrics clusterStatus = getClusterMetrics();
439439
while ((System.currentTimeMillis() - start) < timeout) {
440-
if (clusterStatus != null && clusterStatus.getServers().contains(rsServerName)) {
440+
if (clusterStatus != null && clusterStatus.getLiveServerMetrics().containsKey(rsServerName)) {
441441
return t;
442442
}
443443
Threads.sleep(100);
@@ -659,16 +659,6 @@ public void shutdown() throws IOException {
659659
public void close() throws IOException {
660660
}
661661

662-
/**
663-
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
664-
* Use {@link #getClusterMetrics()} instead.
665-
*/
666-
@Deprecated
667-
public ClusterStatus getClusterStatus() throws IOException {
668-
HMaster master = getMaster();
669-
return master == null ? null : new ClusterStatus(master.getClusterMetrics());
670-
}
671-
672662
@Override
673663
public ClusterMetrics getClusterMetrics() throws IOException {
674664
HMaster master = getMaster();

hbase-server/src/test/java/org/apache/hadoop/hbase/TestClientClusterStatus.java

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ public void testNone() throws Exception {
8989
// or more requests than expected.
9090
Assert.assertEquals(status0.getLiveServerMetrics().size(),
9191
status1.getLiveServerMetrics().size());
92-
checkPbObjectNotNull(new ClusterStatus(status0));
93-
checkPbObjectNotNull(new ClusterStatus(status1));
9492
}
9593

9694
@Test
@@ -109,28 +107,26 @@ public void testLiveAndDeadServersStatus() throws Exception {
109107
Waiter.waitFor(CLUSTER.getConfiguration(), 10 * 1000, 100, new Predicate<Exception>() {
110108
@Override
111109
public boolean evaluate() throws Exception {
112-
ClusterStatus status
113-
= new ClusterStatus(ADMIN.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)));
110+
ClusterMetrics status = ADMIN.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS));
114111
Assert.assertNotNull(status);
115-
return status.getRegionsCount() > 0;
112+
return status.getRegionCount() > 0;
116113
}
117114
});
118115
// Retrieve live servers and dead servers info.
119116
EnumSet<Option> options =
120117
EnumSet.of(Option.LIVE_SERVERS, Option.DEAD_SERVERS, Option.SERVERS_NAME);
121-
ClusterStatus status = new ClusterStatus(ADMIN.getClusterMetrics(options));
122-
checkPbObjectNotNull(status);
118+
ClusterMetrics status = ADMIN.getClusterMetrics(options);
123119
Assert.assertNotNull(status);
124-
Assert.assertNotNull(status.getServers());
120+
Assert.assertNotNull(status.getLiveServerMetrics().keySet());
125121
// exclude a dead region server
126122
Assert.assertEquals(SLAVES -1, numRs);
127123
// live servers = nums of regionservers
128124
// By default, HMaster don't carry any regions so it won't report its load.
129125
// Hence, it won't be in the server list.
130-
Assert.assertEquals(status.getServers().size(), numRs);
131-
Assert.assertTrue(status.getRegionsCount() > 0);
126+
Assert.assertEquals(status.getLiveServerMetrics().keySet().size(), numRs);
127+
Assert.assertTrue(status.getRegionCount() > 0);
132128
Assert.assertNotNull(status.getDeadServerNames());
133-
Assert.assertEquals(1, status.getDeadServersSize());
129+
Assert.assertEquals(1, status.getDeadServerNames().size());
134130
ServerName deadServerName = status.getDeadServerNames().iterator().next();
135131
Assert.assertEquals(DEAD.getServerName(), deadServerName);
136132
Assert.assertNotNull(status.getServersName());
@@ -158,18 +154,18 @@ public void testMasterAndBackupMastersStatus() throws Exception {
158154
Assert.assertEquals(MASTERS, masterThreads.size());
159155
// Retrieve master and backup masters infos only.
160156
EnumSet<Option> options = EnumSet.of(Option.MASTER, Option.BACKUP_MASTERS);
161-
ClusterStatus status = new ClusterStatus(ADMIN.getClusterMetrics(options));
162-
Assert.assertTrue(status.getMaster().equals(activeName));
163-
Assert.assertEquals(MASTERS - 1, status.getBackupMastersSize());
157+
ClusterMetrics status = ADMIN.getClusterMetrics(options);
158+
Assert.assertTrue(status.getMasterName().equals(activeName));
159+
Assert.assertEquals(MASTERS - 1, status.getBackupMasterNames().size());
164160
}
165161

166162
@Test
167163
public void testOtherStatusInfos() throws Exception {
168164
EnumSet<Option> options =
169165
EnumSet.of(Option.MASTER_COPROCESSORS, Option.HBASE_VERSION,
170166
Option.CLUSTER_ID, Option.BALANCER_ON);
171-
ClusterStatus status = new ClusterStatus(ADMIN.getClusterMetrics(options));
172-
Assert.assertTrue(status.getMasterCoprocessors().length == 1);
167+
ClusterMetrics status = ADMIN.getClusterMetrics(options);
168+
Assert.assertTrue(status.getMasterCoprocessorNames().size() == 1);
173169
Assert.assertNotNull(status.getHBaseVersion());
174170
Assert.assertNotNull(status.getClusterId());
175171
Assert.assertTrue(status.getAverageLoad() == 0.0);
@@ -192,21 +188,6 @@ public void testObserver() throws IOException {
192188
Assert.assertEquals(postCount + 1, MyObserver.POST_COUNT.get());
193189
}
194190

195-
/**
196-
* HBASE-19496 do the refactor for ServerLoad and RegionLoad so the inner pb object is useless
197-
* now. However, they are Public classes, and consequently we must make sure the all pb objects
198-
* have initialized.
199-
*/
200-
private static void checkPbObjectNotNull(ClusterStatus status) {
201-
for (ServerName name : status.getLiveServerMetrics().keySet()) {
202-
ServerLoad load = status.getLoad(name);
203-
Assert.assertNotNull(load.obtainServerLoadPB());
204-
for (RegionLoad rl : load.getRegionsLoad().values()) {
205-
Assert.assertNotNull(rl.regionLoadPB);
206-
}
207-
}
208-
}
209-
210191
public static class MyObserver implements MasterCoprocessor, MasterObserver {
211192
private static final AtomicInteger PRE_COUNT = new AtomicInteger(0);
212193
private static final AtomicInteger POST_COUNT = new AtomicInteger(0);

hbase-server/src/test/java/org/apache/hadoop/hbase/TestRegionLoad.java

Lines changed: 0 additions & 180 deletions
This file was deleted.

0 commit comments

Comments
 (0)