HBASE-27269 The implementation of TestReplicationStatus.waitOnMetricsReport is incorrect (#4678)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
LiangJun He 2022-08-04 22:42:36 +08:00 committed by GitHub
parent fb529e2352
commit 2dc26082be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 8 deletions

View File

@ -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();
}
}