Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.elasticsearch.compute.data.Block;
import org.elasticsearch.compute.data.BlockFactory;
import org.elasticsearch.compute.data.Page;
import org.elasticsearch.compute.operator.AsyncOperator;
import org.elasticsearch.compute.operator.Driver;
import org.elasticsearch.compute.operator.DriverContext;
import org.elasticsearch.compute.operator.DriverRunner;
Expand Down Expand Up @@ -247,11 +248,23 @@ public void testSimpleFinishClose() throws Exception {
assert input.size() == 1 : "Expected single page, got: " + input;
// eventually, when driverContext always returns a tracking factory, we can enable this assertion
// assertThat(driverContext.blockFactory().breaker().getUsed(), greaterThan(0L));
Page page = input.get(0);
try (var operator = simple().get(driverContext)) {
assert operator.needsInput();
operator.addInput(page);
for (Page page : input) {
if (operator.needsInput()) {
operator.addInput(page);
} else {
page.releaseBlocks();
}
}
operator.finish();
// for async operator, we need to wait for async actions to finish.
if (operator instanceof AsyncOperator<?> || randomBoolean()) {
driverContext.finish();
PlainActionFuture<Void> waitForAsync = new PlainActionFuture<>();
driverContext.waitForAsyncActions(waitForAsync);
waitForAsync.actionGet(TimeValue.timeValueSeconds(30));
}
}
}

Expand Down