-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Bug fix, last optimised value in ESUTF8StreamJsonParser
kept old value.
#135184
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
Conversation
Hi @gmarouli, I've created a changelog YAML for you. |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
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.
Thanks Mary!
I think you also need to undo a part #135172 did: https://github.com/elastic/elasticsearch/pull/135172/files#diff-8ef1741dbe67a9d21e8154754d17238802a9b21344f997067befe4f618f985feR145 ?
I think it would be great if we can get a unit test that reproduces the issue. For example a json document that we know caused the logsdb randomized tests to fail. If we need a DotExpandingXContentParser
to reproduce that should be ok. We should reproduce a the bug, which is that an incorrect value is returned for a specific field.
I think the unit test coverage needs to be improved. Maybe we should create a unit test that parses a random json document. First with a parser that never uses the uff-8 parsing optimization and secondly with a parser that uses the utf-8 parsing optimization. Both parsers should produce the exact same result. (I think we can let both parsers something like a map of maps). In order to make it more evil, we can randomly invoke text()
or optimizedText()
multiple times.
...impl/src/test/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParserTests.java
Outdated
Show resolved
Hide resolved
ESUTF8StreamJsonParser
kept old value.ESUTF8StreamJsonParser
kept old value.
This reverts commit 5851594.
Hi @gmarouli, I've updated the changelog YAML for you. |
...impl/src/test/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParserTests.java
Outdated
Show resolved
Hide resolved
Changed to non-issue to remove the changelog. |
ESUTF8StreamJsonParser
kept old value.ESUTF8StreamJsonParser
kept old value.
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.
...impl/src/test/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParserTests.java
Outdated
Show resolved
Hide resolved
...impl/src/test/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParserTests.java
Outdated
Show resolved
Hide resolved
...impl/src/test/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParserTests.java
Show resolved
Hide resolved
Thanks for the feedback @martijnvg , it is much simpler now and I learned a few extra things. I extended the existing test to capture both bugs we encountered. |
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.
Left one testing suggestion, otherwise LGTM.
...impl/src/test/java/org/elasticsearch/xcontent/provider/json/ESUTF8StreamJsonParserTests.java
Show resolved
Hide resolved
Ok. First, you guys are making way too many changes in the span of 4 - 5 days. Second of all... |
Hi @justzh , indeed we have been very active on this part of the code, happy to walk you through this.
We are trying to ensure this will be in If you have any feedback on our approach on handling this bug, I am very happy to hear. |
This is unrelated. |
💔 Backport failed
You can use sqren/backport to manually backport by running |
In #134790 we introduced a bug that was caught by our tests.;
The problem manifested itself when a multi field mapper would call
getText()
which would set_tokenIncomplete
to false after thegetOptimisedText()
. This would evaluate the condition_currToken == JsonToken.VALUE_STRING && _tokenIncomplete && stringEnd > 0
to false and thelastOptimisedValue
would not be reset.We changed the code to always reset the
lastOptimisedValue
when anext*()
method is called.Furthermore, we introduced a randomised unit test that creates two
XContentParser
s and runs one as a baseline using none of the optimised code and the other one is accessing both optimised and non optimised in a random pattern. This test was able to catch both #134770 & #135256.Fixes #135256