-
Notifications
You must be signed in to change notification settings - Fork 25.2k
ESQL: Fix usage of already released null block in ValueSourceReaderOperator #126411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESQL: Fix usage of already released null block in ValueSourceReaderOperator #126411
Conversation
Pinging @elastic/es-analytical-engine (Team:Analytics) |
Hi @alex-spies, I've created a changelog YAML for you. |
In addition to the enclosed IT, I'd love to have a unit test for this. It looks like we should be able to add a case to @nik9000 if you have an idea how to add a test without major effort, I'd love to add it, too. |
Hi @alex-spies, I've updated the changelog YAML for you. |
.../esql/compute/src/main/java/org/elasticsearch/compute/lucene/ValuesSourceReaderOperator.java
Outdated
Show resolved
Hide resolved
// However, downstream operators take ownership of the null block we hand to them and may close it, forcing us to create a new | ||
// one. | ||
// This could be avoided altogether if this factory itself kept a reference to the null block, but we'd have to also ensure | ||
// to release this block once the factory is not used anymore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the factory itself would have to be Releasable
. FWIW, that's not really a big deal. I think I'd prefer it to this fix to be honest. I'm kind of ok with whichever though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if you are trying to get this merged quickly I'd be fine with this solution - especially if you are willing to try the other in a followup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also prefer making this Releasable
. It's easy to do, I'll push a commit with the change.
Wrong implementations of .close()
or forgetting to incref when handing out blocks actually nicely show up as test failures already in the existing tests, so I think this is guarding better against regressions.
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
Outdated
Show resolved
Hide resolved
int p = forwards[0]; | ||
int shard = shards.getInt(p); | ||
int segment = segments.getInt(p); | ||
int firstDoc = docs.getInt(p); | ||
positionFieldWork(shard, segment, firstDoc); | ||
LeafReaderContext ctx = ctx(shard, segment); | ||
fieldsMoved(ctx, shard); | ||
verifyBuilders(loaderBlockFactory, shard); | ||
read(docs.getInt(p), shard); | ||
read(firstDoc, shard); | ||
for (int i = 1; i < forwards.length; i++) { | ||
p = forwards[i]; | ||
shard = shards.getInt(p); | ||
segment = segments.getInt(p); | ||
boolean changedSegment = positionFieldWorkDocGuarteedAscending(shard, segment); | ||
if (changedSegment) { | ||
ctx = ctx(shard, segment); | ||
fieldsMoved(ctx, shard); | ||
} | ||
verifyBuilders(loaderBlockFactory, shard); | ||
read(docs.getInt(p), shard); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just got indented, the diff is actually just whitespace o.O
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add ?w=1
to the url it'll ignore whitespace ala git diff -w
. There's an option for it hiding behind the gear icon at the top of the page too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it much more now. Thanks!
The Serverless checks are failing with an unrelated test failure that is already known (Serverless CI issue opened last week, re-muted 4h ago). I think it's not worth updating the branch to run CI again just to pick up on the mute for this test, so I'm going to go ahead with the merge as all other tests and CI checks passed. |
💔 Backport failed
You can use sqren/backport to manually backport by running |
…erator (elastic#126411) * Add yaml test with reproducer * Fix the bug * Make ComputeBlockLoaderFactory Releasable
…erator (elastic#126411) * Add yaml test with reproducer * Fix the bug * Make ComputeBlockLoaderFactory Releasable
…erator (elastic#126411) * Add yaml test with reproducer * Fix the bug * Make ComputeBlockLoaderFactory Releasable
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
…erator (elastic#126411) * Add yaml test with reproducer * Fix the bug * Make ComputeBlockLoaderFactory Releasable (cherry picked from commit ffd4913) # Conflicts: # x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
Fix #125850