HBASE-27269 The implementation of TestReplicationStatus.waitOnMetricsReport is incorrect (#4678)
Signed-off-by: Duo Zhang <zhangduo@apache.org> (cherry picked from commit 2dc26082be978796046d9124212e8c9d2d8a1f5d)
This commit is contained in:
parent
272805c32e
commit
c5b22d973b
@ -133,13 +133,24 @@ public class TestReplicationStatus extends TestReplicationBase {
|
||||
* @param greaterThan size of replicationLoadSourceList must be greater before we proceed
|
||||
*/
|
||||
private List<ReplicationLoadSource> waitOnMetricsReport(int greaterThan, ServerName serverName)
|
||||
throws IOException {
|
||||
ClusterMetrics metrics = hbaseAdmin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS));
|
||||
throws Exception {
|
||||
UTIL1.waitFor(30000, 1000, new Waiter.ExplainingPredicate<Exception>() {
|
||||
@Override
|
||||
public boolean evaluate() throws Exception {
|
||||
List<ReplicationLoadSource> list =
|
||||
metrics.getLiveServerMetrics().get(serverName).getReplicationLoadSourceList();
|
||||
while (list.size() <= greaterThan) {
|
||||
Threads.sleep(1000);
|
||||
hbaseAdmin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics()
|
||||
.get(serverName).getReplicationLoadSourceList();
|
||||
return list.size() > greaterThan;
|
||||
}
|
||||
return list;
|
||||
|
||||
@Override
|
||||
public String explainFailure() throws Exception {
|
||||
return "The ReplicationLoadSourceList's size is lesser than or equal to " + greaterThan
|
||||
+ " for " + serverName;
|
||||
}
|
||||
});
|
||||
|
||||
return hbaseAdmin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics()
|
||||
.get(serverName).getReplicationLoadSourceList();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user