HBASE-27269 The implementation of TestReplicationStatus.waitOnMetricsReport is incorrect (#4678)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 2dc26082be
)
This commit is contained in:
parent
1094b154ab
commit
1183f06c16
|
@ -133,13 +133,24 @@ public class TestReplicationStatus extends TestReplicationBase {
|
||||||
* @param greaterThan size of replicationLoadSourceList must be greater before we proceed
|
* @param greaterThan size of replicationLoadSourceList must be greater before we proceed
|
||||||
*/
|
*/
|
||||||
private List<ReplicationLoadSource> waitOnMetricsReport(int greaterThan, ServerName serverName)
|
private List<ReplicationLoadSource> waitOnMetricsReport(int greaterThan, ServerName serverName)
|
||||||
throws IOException {
|
throws Exception {
|
||||||
ClusterMetrics metrics = hbaseAdmin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS));
|
UTIL1.waitFor(30000, 1000, new Waiter.ExplainingPredicate<Exception>() {
|
||||||
List<ReplicationLoadSource> list =
|
@Override
|
||||||
metrics.getLiveServerMetrics().get(serverName).getReplicationLoadSourceList();
|
public boolean evaluate() throws Exception {
|
||||||
while (list.size() <= greaterThan) {
|
List<ReplicationLoadSource> list =
|
||||||
Threads.sleep(1000);
|
hbaseAdmin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics()
|
||||||
}
|
.get(serverName).getReplicationLoadSourceList();
|
||||||
return list;
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue