MDEV-36986 Support tracing arrays of primitive types - #5583
Open
bsrikanth-mariadb wants to merge 1 commit into
Open
MDEV-36986 Support tracing arrays of primitive types#5583bsrikanth-mariadb wants to merge 1 commit into
bsrikanth-mariadb wants to merge 1 commit into
Conversation
bsrikanth-mariadb
marked this pull request as draft
August 21, 2026 14:14
Single_line_formatting_helper accumulates array elements that may fit on
one line, and printed all of them quoted when flushing. Numbers, booleans
and nulls thus came out as JSON strings:
"depends_on_map_bits": ["0"] instead of [0]
Remember per element whether it arrived via add_escaped_str() (a string,
quote it) or add_unquoted_str() (a number, boolean or null, don't), in a
parallel quoted[] array reset together with the buffer, and honour it in
both flush paths. This also fixes disable_and_flush(), which called
add_str() and so escaped the buffered strings a second time.
add_size() output stays quoted: it may carry a unit suffix ("2KiB").
While at it:
- Json_writer_array::add(ulonglong) cast to longlong, printing values
above LLONG_MAX as negative. Use add_ull(). add(size_t) had the same
bug and is compiled out on _WIN64, so fixing only one would have made
the output platform-dependent.
- on_add_str() now enforces MAX_ELEMENTS instead of only asserting it,
so quoted[] cannot be overrun in a release build if the line length
accounting ever changes.
opt_context_schema.inc: rec_per_key holds numbers now, not strings. Also
fix two syntax errors that left the schema invalid JSON, so it is usable
once MDEV-38033 enables the JSON_SCHEMA_VALID() check in
run_query_twice_and_compare_stats.inc.
bsrikanth-mariadb
force-pushed
the
13.2-MDEV-36986-support-tracing-array-of-primitive-types
branch
from
August 21, 2026 15:34
1b03eeb to
f895946
Compare
bsrikanth-mariadb
marked this pull request as ready for review
August 24, 2026 04:36
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.
Single_line_formatting_helper accumulates array elements that may fit on one line, and printed all of them quoted when flushing numbers, booleans and nulls thus came out as JSON strings:
"depends_on_map_bits": ["0"] instead of [0]
Solution is to:
Remember per element whether it arrived via add_escaped_str() (a string, quote it) or add_unquoted_str() (a number, boolean or null, don't), in a parallel quoted[] array reset together with the buffer, and honour it in both flush paths. This also fixes disable_and_flush(), which called add_str() and so escaped the buffered strings a second time.
add_size() output stays quoted: it may carry a unit suffix ("2KiB").
While at it:
opt_context_schema.inc: rec_per_key holds numbers now, not strings. Also fix two syntax errors that left the schema invalid JSON, so it is usable once MDEV-38033 enables the JSON_SCHEMA_VALID() check in run_query_twice_and_compare_stats.inc.