use of org.elasticsearch.common.breaker.MemoryCircuitBreaker in project crate by crate.
the class RowAccountingWithEstimatorsTest method testRowCellsAccountingCircuitBreakingWorks.
@Test
public void testRowCellsAccountingCircuitBreakingWorks() throws Exception {
RowCellsAccountingWithEstimators rowAccounting = new RowCellsAccountingWithEstimators(Collections.singletonList(DataTypes.INTEGER), ConcurrentRamAccounting.forCircuitBreaker("test", new MemoryCircuitBreaker(new ByteSizeValue(10, ByteSizeUnit.BYTES), 1.01, LogManager.getLogger(RowAccountingWithEstimatorsTest.class))), 0);
expectedException.expect(CircuitBreakingException.class);
IntStream.range(0, 3).forEach(i -> rowAccounting.accountForAndMaybeBreak(new Object[] { i }));
}
use of org.elasticsearch.common.breaker.MemoryCircuitBreaker in project crate by crate.
the class RowAccountingWithEstimatorsTest method testCircuitBreakingWorksWithExtraSizePerRow.
@Test
public void testCircuitBreakingWorksWithExtraSizePerRow() throws Exception {
RowAccountingWithEstimators rowAccounting = new RowAccountingWithEstimators(Collections.singletonList(DataTypes.INTEGER), ConcurrentRamAccounting.forCircuitBreaker("test", new MemoryCircuitBreaker(new ByteSizeValue(10, ByteSizeUnit.BYTES), 1.01, LogManager.getLogger(RowAccountingWithEstimatorsTest.class))), 2);
expectedException.expect(CircuitBreakingException.class);
RowGenerator.range(0, 2).forEach(rowAccounting::accountForAndMaybeBreak);
}
Aggregations