1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00
Files
mariadb/sql
bsrikanth-mariadb a4ae3f23fd MDEV-36986: Support tracing array of primitive types
Json_writer had two separate code paths: add_unquoted_str() for
numbers/bool/null, and add_escaped_str() which added the surrounding
quotes itself for strings. Single_line_formatting_helper, which
buffers consecutive array/object elements to decide if they fit on
one line, assumed only strings could ever be buffered and always
wrapped the flushed values in quotes. As a result, arrays of numbers
(e.g. "depends_on_map_bits", "rec_per_key") were incorrectly rendered
with their elements quoted as strings.

Unify both paths into add_escaped_quoted_str(): the caller now hands
over bytes that are already in their final on-the-wire form. String
escaping (json_escape_to_string) writes its own surrounding quotes,
while numbers/bool/null are passed through unquoted, so the one-line
helper just concatenates the buffered payloads on flush instead of
adding quotes itself. A DBUG_ASSERT in add_escaped_quoted_str() now
checks that every payload is already a quoted string or a bare
number/bool/null token, so a caller that violates the contract trips
an assertion in debug builds instead of silently producing invalid
JSON.

Also:
- Fix Json_writer_array::add(ulonglong)/(size_t), which went through
  add_ll() with a cast to longlong and corrupted large unsigned
  values (e.g. ULLONG_MAX); route them through add_ull() instead.
- Fix mysql-test/include/opt_context_schema.inc: "subquery_runs" was
  nested inside the preceding object instead of being a sibling
  member, and "rec_per_key" items are now declared as "number" to
  match the corrected output.
- Update recorded .result files for opt_trace, opt_context_*, and
  subselect_mat_analyze_json to reflect numbers/booleans no longer
  being quoted inside JSON arrays.
- Extend unittest/sql/my_json_writer-t.cc with coverage for arrays
  of primitives: plain integers, mixed types, sizes, multi-line
  arrays, values flushed before a nested object, strings that were
  already escaped by the one-line buffer, and invalid utf8mb4 input
  through add_str().
- Rewrite the "multi-line array of integers" test to actually
  overflow the one-line buffer (9 seven-digit numbers instead of 7),
  since the previous version fit on one line and never exercised the
  element-per-line flush path it claimed to test.
- Drop the now-redundant single-argument add_escaped_quoted_str()
  overload; all call sites already know their length.
- Update json_escape_to_string()'s doc comments (my_json_writer.h,
  sql_json_lib.h) to state that it quotes its output, not just
  escapes it.
2026-10-01 13:36:14 +05:30
..
2026-06-15 16:53:03 +02:00
…
2026-09-04 12:21:02 +02:00
2025-07-28 21:29:29 +02:00
2024-11-05 14:00:48 -08:00
2026-08-03 13:42:39 +02:00
2025-09-29 18:25:09 +03:00
…
2025-03-14 12:08:56 +04:00
2026-02-16 21:55:18 +01:00
2025-03-14 12:08:56 +04:00
…
2024-12-02 17:51:17 +02:00
2026-01-31 14:08:54 +01:00
2026-07-20 13:23:00 +03:00
2026-07-20 13:23:00 +03:00
…
2026-01-31 14:08:54 +01:00
2026-07-30 16:15:40 +02:00
2026-09-04 12:14:15 +02:00
2024-12-02 11:35:34 +02:00
2026-03-24 09:49:17 +02:00
2026-03-24 09:49:17 +02:00
…
…
2026-05-26 21:15:58 +02:00
2026-06-15 16:53:03 +02:00
2026-05-26 21:15:58 +02:00
2026-09-10 09:07:23 +03:00
2026-07-29 12:27:46 +02:00
2024-11-29 13:43:17 +02:00
…
…
2026-08-20 08:27:14 +02:00
2026-08-20 08:27:14 +02:00
2024-12-05 10:11:58 +01:00
2026-08-20 08:27:14 +02:00
2026-02-03 14:53:15 +01:00
2026-05-26 21:15:58 +02:00
2026-02-03 14:53:15 +01:00
2026-09-04 12:21:02 +02:00
2026-08-03 13:42:39 +02:00
2026-08-20 08:27:14 +02:00
2026-06-29 07:41:06 +03:00
2026-03-24 09:49:17 +02:00
2026-01-31 14:08:54 +01:00
2026-09-10 09:07:23 +03:00
2026-09-10 09:07:23 +03:00
2026-01-08 12:02:45 +01:00
2026-08-03 13:42:39 +02:00
2024-07-08 22:40:16 +02:00
2026-05-26 21:15:58 +02:00
…
2026-05-26 21:15:58 +02:00
…
2025-03-14 12:08:56 +04:00
2026-09-04 12:21:02 +02:00
…
2024-10-03 15:59:20 +10:00
…
2025-03-14 12:08:56 +04:00
2026-05-26 21:15:58 +02:00
2026-09-04 12:14:15 +02:00
2026-09-04 12:14:15 +02:00
2026-07-29 12:27:46 +02:00
2026-09-04 12:21:02 +02:00
2026-07-30 11:41:55 +02:00
2026-05-08 08:00:01 +02:00
2026-09-04 12:21:02 +02:00
2026-01-31 14:08:54 +01:00
2026-05-26 21:15:58 +02:00
2026-09-04 12:14:15 +02:00
2026-02-03 14:53:15 +01:00
2025-09-29 18:25:09 +03:00
2024-07-22 15:14:50 +02:00
2026-05-26 21:15:58 +02:00
2026-05-26 21:15:58 +02:00
2026-05-26 21:15:58 +02:00
2026-06-16 12:24:32 +02:00
2026-07-30 11:41:55 +02:00
2026-06-16 12:24:32 +02:00
2026-08-20 08:27:14 +02:00
2026-06-15 16:53:03 +02:00
2026-06-15 16:53:03 +02:00
2025-03-14 12:08:56 +04:00
2026-04-02 09:15:17 +03:00
2026-09-04 12:14:15 +02:00
2026-09-04 12:21:02 +02:00
2026-09-04 12:21:02 +02:00
2026-02-06 17:46:50 +01:00
2025-11-04 12:39:27 +01:00
2026-09-04 12:14:15 +02:00
2026-09-04 12:14:15 +02:00
2026-09-10 09:07:23 +03:00
2026-09-04 12:14:15 +02:00
2026-09-04 12:14:15 +02:00
2026-08-20 08:27:14 +02:00
2025-09-04 18:08:39 +03:00
2026-09-04 12:21:02 +02:00
2026-05-26 21:15:58 +02:00
2026-08-03 13:42:39 +02:00
2026-07-30 11:41:55 +02:00
2026-06-15 15:15:10 +02:00
2026-06-15 15:15:10 +02:00
2026-09-10 09:07:23 +03:00
2026-04-02 09:15:17 +03:00
2026-09-10 09:07:23 +03:00
2026-09-10 09:07:23 +03:00
2026-01-31 14:08:54 +01:00
2026-01-05 20:34:44 +01:00
2026-07-30 11:41:55 +02:00
2026-03-24 09:49:17 +02:00
2026-06-29 07:40:04 +03:00
2026-01-08 12:02:45 +01:00
2026-07-30 16:15:40 +02:00
2026-07-30 16:15:40 +02:00
2026-08-03 13:42:39 +02:00
2026-02-06 17:46:51 +01:00
2026-03-17 18:57:42 +01:00
2026-09-04 12:21:02 +02:00
2026-07-30 16:15:40 +02:00
…
2026-02-06 17:46:51 +01:00
2025-09-29 18:25:09 +03:00
2025-08-04 12:05:53 +02:00
2024-12-02 17:51:17 +02:00
2026-08-03 13:42:39 +02:00
2025-09-19 12:31:14 +03:00
2026-05-26 21:15:58 +02:00
2025-03-14 12:08:56 +04:00
2026-09-10 09:07:23 +03:00
2026-09-04 12:21:02 +02:00
2026-09-04 12:21:02 +02:00
2026-09-04 12:21:02 +02:00
2025-01-09 09:41:38 +02:00
2024-12-02 17:51:17 +02:00
2026-09-04 12:21:02 +02:00
2026-07-30 11:41:55 +02:00
2026-09-04 12:21:02 +02:00
2026-05-27 12:49:36 +02:00
2026-08-20 08:27:14 +02:00
2026-09-04 12:21:02 +02:00
2026-09-04 12:21:02 +02:00
2026-07-30 16:15:40 +02:00
2026-08-19 08:40:05 +02:00
2026-07-28 13:14:38 +02:00
2026-02-07 22:12:32 +01:00
2025-04-29 11:18:00 +10:00
2026-05-26 21:15:58 +02:00
…
2026-05-22 09:52:05 +02:00
2026-05-22 09:52:05 +02:00
2026-09-04 12:14:15 +02:00
2026-09-04 12:21:02 +02:00
2026-08-03 13:42:39 +02:00
2025-03-14 12:08:56 +04:00
2024-12-02 17:51:17 +02:00
2026-08-20 08:27:14 +02:00
2026-07-30 16:15:40 +02:00
2026-06-15 16:53:03 +02:00
2026-08-20 08:27:14 +02:00
2026-09-04 12:21:02 +02:00
2026-09-04 12:21:02 +02:00
2026-08-20 08:27:14 +02:00
2026-08-20 08:27:14 +02:00
2026-09-04 12:21:02 +02:00
2026-07-20 13:23:00 +03:00
2026-03-24 09:49:17 +02:00
2025-09-04 18:08:39 +03:00
2025-03-14 12:08:56 +04:00
2026-05-22 09:52:05 +02:00
2024-12-02 17:51:17 +02:00
2024-12-02 11:35:34 +02:00
2026-09-04 12:14:15 +02:00
2026-09-04 12:21:02 +02:00
2025-03-14 12:08:56 +04:00
2026-06-16 12:24:32 +02:00
2025-11-28 12:56:27 +02:00
2026-09-04 12:21:02 +02:00
2026-06-21 15:32:20 +02:00
2026-08-19 08:40:05 +02:00
2026-06-15 16:53:03 +02:00
2026-04-02 09:15:17 +03:00
2024-10-03 13:24:43 +03:00
2024-09-09 13:50:38 +03:00
2026-09-04 12:21:02 +02:00
2026-02-07 22:12:32 +01:00
2026-08-03 13:42:39 +02:00
2026-07-29 12:27:46 +02:00
2026-09-04 12:21:02 +02:00