1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

7 Commits

Author SHA1 Message Date
Sergei Petrunia
a138093efd Code cleanup in JSON array-of-object reading, add unit tests. 2026-08-12 14:31:57 +03:00
bsrikanth-mariadb
b91913d783 update opt_context_replay_basic to include variable standard_compliant_cte 2026-08-12 14:31:57 +03:00
Sergei Petrunia
a551e507e4 Cherry-pick lost commit: Rename: Read_list_of_ranges to Read_array_of_strings and move it to sql_json_lib. 2026-08-12 14:31:54 +03:00
Sergei Petrunia
ed55563d56 Cherry-pick lost commit: Add unit test for json_read_object. 2026-08-12 14:31:54 +03:00
Sergei Petrunia
94680d5b8b Cherry-pick lost commit: JSON parsing: rename classes to cleaner names
Read_container_value -> Read_array.
Read_list_of_context -> Read_array_into_list
2026-08-12 14:31:54 +03:00
bsrikanth-mariadb
85595ce69c MDEV-36523: Load basic stats from trace into optimizer
This task loads the stats of the tables that are used in a query,
from the trace into the optimizer. This feature is controlled
by optimizer_replay_context, and points to an user defined variable name,
that has the context information.
The stats such as num_of_records present in the table, indexes if present,
their names, along with the average number of records_per_key
with in each index, cost of reading an index are loaded from the trace.
Additionally, stats from range analysis i.e. ranges, and the
corresponding number of records, along with their costs are also
loaded from the trace.

The trace context which is in JSON format is firstly set into the
user defined session variable, and this variable name is set to
optimizer_replay_context system variable.
Later, when a user issues a query, the contents of the json context is
parsed and an in memory representation is built using the class
Optimizer_context_replay. This class is then used by the optimizer
to update and save original values of the tables, indexes, and range stats
in the methods "set_statistics_for_table()" of sql_statistics.cc, and
"check_quick_select()" of opt_range.cc.
After the query gets finished, the statistics that were updated
in the optimizer are restored back to the saved original values.

The entry point for parsing the json structure is in
"mysql_execute_command()" of sql_parse.cc, and similarly exit point
i.e. to restore the saved stats of the optimizer is at the end
of the same method.

Two new warning/error messages are introduced:
ER_JSON_OPTIMIZER_REPLAY_CONTEXT_PARSE_FAILED, and
ER_JSON_OPTIMIZER_REPLAY_CONTEXT_MATCH_FAILED
2026-08-12 14:31:52 +03:00
bsrikanth-mariadb
f4318f3f3b MDEV-38120: Move Json_string and Json_saved_parser_state into sql_json_lib.h
Move classes Json_string, and Json_saved_parser_state from
opt_histogram_json.cc to the newly created file sql_json_lib.h
Additionally, make the function json_unescape_to_string public earlier
defined as static in opt_histogram_json.cc, by
adding the declaration in sql_json_lib.h

Needed this change so that, the classes and functions can be reused in
other pieces of the code.
2025-11-24 17:45:51 +05:30