Skip to content
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

Fix ByteArrayIndexInput with nonzero offset #93205

Conversation

DaveCTurner
Copy link
Contributor

We introduced a bug in #79885 by not accounting for cases where there's a nonzero offset in the underlying byte array. Unfortunately ESIndexInputTestCase didn't cover these code paths. This commit extends the test coverage and fixes the bug.

We introduced a bug in elastic#79885 by not accounting for cases where there's
a nonzero offset in the underlying byte array. Unfortunately
`ESIndexInputTestCase` didn't cover these code paths. This commit
extends the test coverage and fixes the bug.
@DaveCTurner DaveCTurner added >bug :Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. v8.6.1 v8.7.0 labels Jan 24, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Jan 24, 2023
@elasticsearchmachine
Copy link
Collaborator

Hi @DaveCTurner, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Copy link
Contributor

@iverase iverase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks @DaveCTurner!

@DaveCTurner DaveCTurner merged commit 7390b4d into elastic:main Jan 24, 2023
@DaveCTurner DaveCTurner deleted the 2023-01-24-ByteArrayIndexInput-nonzero-offset branch January 24, 2023 15:37
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Jan 24, 2023
We introduced a bug in elastic#79885 by not accounting for cases where there's
a nonzero offset in the underlying byte array. Unfortunately
`ESIndexInputTestCase` didn't cover these code paths. This commit
extends the test coverage and fixes the bug.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.6

elasticsearchmachine pushed a commit that referenced this pull request Jan 24, 2023
We introduced a bug in #79885 by not accounting for cases where there's
a nonzero offset in the underlying byte array. Unfortunately
`ESIndexInputTestCase` didn't cover these code paths. This commit
extends the test coverage and fixes the bug.
// Read by one byte at a time
output[readPos++] = indexInput.readByte();
final var readStrategy = randomFrom(2, 6);
switch (readStrategy) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above looks suspicious. Should it be randomIntBetween(0, 9)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and #93227 fixes this in 8.6 too

DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Jan 25, 2023
In elastic#93205 we fixed a bug in `ByteArrayIndexInput` but accidentally
reduced the coverage of the test suite with a supposedly-temporary
change for debugging purposes. This commit brings the test suite back up
to full strength again.

This was fixed in `main` by elastic#93208, but most of that change is not for
backporting.
DaveCTurner added a commit that referenced this pull request Jan 25, 2023
In #93205 we fixed a bug in `ByteArrayIndexInput` but accidentally
reduced the coverage of the test suite with a supposedly-temporary
change for debugging purposes. This commit brings the test suite back up
to full strength again.

This was fixed in `main` by #93208, but most of that change is not for
backporting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v8.6.1 v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants