MDEV-40174: Remove unnecessary double parsing JSON document#5405
Open
VasuBhakt wants to merge 1 commit into
Open
MDEV-40174: Remove unnecessary double parsing JSON document#5405VasuBhakt wants to merge 1 commit into
VasuBhakt wants to merge 1 commit into
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
…ormalize Signed-off-by: VasuBhakt <cpswastik31@gmail.com>
VasuBhakt
force-pushed
the
MDEV-40174-json-normalize-json-equal-fix
branch
from
July 17, 2026 19:49
8c432fc to
f1ee4c5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes MDEV-40174
Problem
The
json_normalize_enginefunction, used byjson_normalize, callsjson_valid_enginebefore processing. The processing reparses the same JSON document thatjson_validalready processed.Solution
Removed the redundant
json_valid_enginepre-check to eliminate double-parsing, and integrated error handling directly into the normalization engine:Catch Empty Strings: Removed
DBUG_ASSERT(0)for uninitialized values and instead return an error directly injson_normalize_engineifroot.type == JSON_VALUE_UNINITIALIZED.Catch Trailing Garbage on Scalars: Updated
json_norm_buildto enforce a full scan to the end of the document for scalar values (like numbers/strings) usingwhile (json_scan_next(je) == 0). This ensures that trailing garbage correctly triggers a syntax error, matching the strict validation previously handled byjson_valid_engine.Propagate Syntax Errors: Updated
json_normalize_engineto explicitly check and fail ifje->s.erroris set during the build phase.Version
The change is directed at versions
10.11,11.4,11.8, and should also fix12.3. The PR is based on branch10.11, being the lowest affected branch.