Wrap accounting breaker check in assertBusy (#39211)

There may be situations where indices have not yet been closed from a Lucene
perspective, causing the breaker to not immediately be at 0

Relates to #30290
This commit is contained in:
Lee Hinman 2019-02-21 08:00:03 -07:00 committed by Lee Hinman
parent ef921fd157
commit d9de899316
1 changed files with 10 additions and 4 deletions

View File

@ -2457,9 +2457,15 @@ public final class InternalTestCluster extends TestCluster {
final CircuitBreakerService breakerService = getInstanceFromNode(CircuitBreakerService.class, nodeAndClient.node); final CircuitBreakerService breakerService = getInstanceFromNode(CircuitBreakerService.class, nodeAndClient.node);
CircuitBreaker fdBreaker = breakerService.getBreaker(CircuitBreaker.FIELDDATA); CircuitBreaker fdBreaker = breakerService.getBreaker(CircuitBreaker.FIELDDATA);
assertThat("Fielddata breaker not reset to 0 on node: " + name, fdBreaker.getUsed(), equalTo(0L)); assertThat("Fielddata breaker not reset to 0 on node: " + name, fdBreaker.getUsed(), equalTo(0L));
try {
assertBusy(() -> {
CircuitBreaker acctBreaker = breakerService.getBreaker(CircuitBreaker.ACCOUNTING); CircuitBreaker acctBreaker = breakerService.getBreaker(CircuitBreaker.ACCOUNTING);
assertThat("Accounting breaker not reset to 0 on node: " + name + ", are there still Lucene indices around?", assertThat("Accounting breaker not reset to 0 on node: " + name + ", are there still Lucene indices around?",
acctBreaker.getUsed(), equalTo(0L)); acctBreaker.getUsed(), equalTo(0L));
});
} catch (Exception e) {
throw new AssertionError("Exception during check for accounting breaker reset to 0", e);
}
// Anything that uses transport or HTTP can increase the // Anything that uses transport or HTTP can increase the
// request breaker (because they use bigarrays), because of // request breaker (because they use bigarrays), because of
// that the breaker can sometimes be incremented from ping // that the breaker can sometimes be incremented from ping
@ -2474,7 +2480,7 @@ public final class InternalTestCluster extends TestCluster {
assertThat("Request breaker not reset to 0 on node: " + name, reqBreaker.getUsed(), equalTo(0L)); assertThat("Request breaker not reset to 0 on node: " + name, reqBreaker.getUsed(), equalTo(0L));
}); });
} catch (Exception e) { } catch (Exception e) {
fail("Exception during check for request breaker reset to 0: " + e); throw new AssertionError("Exception during check for request breaker reset to 0", e);
} }
NodeService nodeService = getInstanceFromNode(NodeService.class, nodeAndClient.node); NodeService nodeService = getInstanceFromNode(NodeService.class, nodeAndClient.node);