Skip to content

Commit

Permalink
HBASE-27269 The implementation of TestReplicationStatus.waitOnMetrics…
Browse files Browse the repository at this point in the history
…Report is incorrect (#4678)

Signed-off-by: Duo Zhang <[email protected]>
  • Loading branch information
2005hithlj authored Aug 4, 2022
1 parent fb529e2 commit 2dc2608
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,24 @@ public boolean evaluate() throws Exception {
* @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));
List<ReplicationLoadSource> list =
metrics.getLiveServerMetrics().get(serverName).getReplicationLoadSourceList();
while (list.size() <= greaterThan) {
Threads.sleep(1000);
}
return list;
throws Exception {
UTIL1.waitFor(30000, 1000, new Waiter.ExplainingPredicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
List<ReplicationLoadSource> list =
hbaseAdmin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics()
.get(serverName).getReplicationLoadSourceList();
return list.size() > greaterThan;
}

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

0 comments on commit 2dc2608

Please sign in to comment.