HBASE-20533 Fix the flaky TestAssignmentManagerMetrics

This commit is contained in:
huzheng 2018-05-28 17:52:13 +08:00
parent 1cd2b56802
commit 81228f72d0
2 changed files with 5 additions and 8 deletions

View File

@ -41,11 +41,6 @@ import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProcedureProtos.RegionTransitionState;
import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos.RegionStateTransition.TransitionCode;
/**
* Base class for the Assign and Unassign Procedure.
*

View File

@ -91,6 +91,8 @@ public class TestAssignmentManagerMetrics {
conf.setInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, 2500);
// set a small interval for updating rit metrics
conf.setInt(AssignmentManager.RIT_CHORE_INTERVAL_MSEC_CONF_KEY, MSG_INTERVAL);
// set a small assign attempts for avoiding assert when retrying. (HBASE-20533)
conf.setInt(AssignmentManager.ASSIGN_MAX_ATTEMPTS, 3);
// keep rs online so it can report the failed opens.
conf.setBoolean(CoprocessorHost.ABORT_ON_ERROR_KEY, false);
@ -150,14 +152,14 @@ public class TestAssignmentManagerMetrics {
LOG.info("Expected error", e);
}
// Sleep 3 seconds, wait for doMetrics chore catching up
// Sleep 5 seconds, wait for doMetrics chore catching up
// the rit count consists of rit and failed opens. see RegionInTransitionStat#update
// Waiting for the completion of rit makes the assert stable.
TEST_UTIL.waitUntilNoRegionsInTransition();
Thread.sleep(MSG_INTERVAL * 3);
Thread.sleep(MSG_INTERVAL * 5);
METRICS_HELPER.assertGauge(MetricsAssignmentManagerSource.RIT_COUNT_NAME, 1, amSource);
METRICS_HELPER.assertGauge(MetricsAssignmentManagerSource.RIT_COUNT_OVER_THRESHOLD_NAME, 1,
amSource);
amSource);
}
}
}