Skip to content

Commit

Permalink
Harden assertions when checking target indices (elastic#105001)
Browse files Browse the repository at this point in the history
We should have checked and failed if there is an inconsistent pair of
data node plan and target indices. This PR strengthens these checks and
adds assertions to fail hard in tests.

Relates elastic#10480
  • Loading branch information
dnhatn committed Feb 1, 2024
1 parent 6185ba6 commit f0c8baa
Showing 1 changed file with 13 additions and 2 deletions.
Expand Up @@ -149,8 +149,13 @@ public void execute(
var concreteIndices = PlannerUtils.planConcreteIndices(physicalPlan);

QueryPragmas queryPragmas = configuration.pragmas();

if (concreteIndices.isEmpty()) {
if (dataNodePlan == null) {
if (concreteIndices.isEmpty()) {
String error = "expected no concrete indices without data node plan; got " + concreteIndices;
assert false : error;
listener.onFailure(new IllegalStateException(error));
return;
}
var computeContext = new ComputeContext(sessionId, List.of(), configuration, null, null);
runCompute(
rootTask,
Expand All @@ -160,6 +165,12 @@ public void execute(
);
return;
}
if (concreteIndices.isEmpty()) {
var error = "expected concrete indices with data node plan but got empty; data node plan " + dataNodePlan;
assert false : error;
listener.onFailure(new IllegalStateException(error));
return;
}
QueryBuilder requestFilter = PlannerUtils.requestFilter(dataNodePlan);

LOGGER.debug("Sending data node plan\n{}\n with filter [{}]", dataNodePlan, requestFilter);
Expand Down

0 comments on commit f0c8baa

Please sign in to comment.