Commit graph

247 commits

Author SHA1 Message Date
Marko Mäkelä
788953463d Merge 10.6 into 10.11
Some fixes related to commit f838b2d799 and
Rows_log_event::do_apply_event() and Update_rows_log_event::do_exec_row()
for system-versioned tables were provided by Nikita Malyavin.
This was required by test versioning.rpl,trx_id,row.
2024-03-28 09:16:57 +02:00
Sergei Golubchik
f71d7f2f0f Merge branch '10.5' into 10.6 2024-03-13 21:02:34 +01:00
Marko Mäkelä
f703e72bd8 Merge 10.4 into 10.5 2024-03-11 10:08:20 +02:00
Marko Mäkelä
09ea2dc788 MDEV-33209 Stack overflow in main.json_debug_nonembedded due to incorrect debug injection
In the JSON functions, the debug injection for stack overflows is
inaccurate and may cause actual stack overflows. Let us simply
inject stack overflow errors without actually relying on the ability
of check_stack_overrun() to do so.

Reviewed by: Rucha Deodhar
2024-03-11 09:53:04 +02:00
Alexey Botchkov
b93252a303 MDEV-32454 JSON test has problem in view protocol.
Few Item_func_json_xxx::fix_length_and_dec() functions fixed.
2024-03-02 14:58:57 +04:00
Sergei Golubchik
fd0b47f9d6 Merge branch '10.6' into 10.11 2023-12-18 11:19:04 +01:00
Sergei Golubchik
e95bba9c58 Merge branch '10.5' into 10.6 2023-12-17 11:20:43 +01:00
Sergei Golubchik
98a39b0c91 Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
Dmitry Shulga
85c157808b MDEV-32867: ASAN errors in Item_func_json_contains_path::val_int upon PS execution
This bug was caused by a patch for the task MDEV-32733.
Incorrect memory root was used for allocation of memory
pointed by the data memebr Item_func_json_contains_path::p_found.
2023-11-25 00:45:47 +07:00
Dmitry Shulga
85f2e4f8e8 MDEV-32466: Potential memory leak on executing of create view statement
This is the follow-up patch that removes explicit use of thd->stmt_arena
for memory allocation and replaces it with call of the method
  THD::active_stmt_arena_to_use()
Additionally, this patch adds extra DBUG_ASSERT to check that right
query arena is in use.
2023-11-24 16:28:31 +07:00
Marko Mäkelä
583a745299 Merge 10.6 into 10.11 2023-11-21 10:23:11 +02:00
Marko Mäkelä
0ead203111 Merge 10.5 into 10.6 2023-11-21 09:18:31 +02:00
Sergei Golubchik
8bbf6697cf MDEV-24784 JSON_ARRAYAGG charset issue
set the proper charset for a temporary result
2023-11-19 13:24:27 +01:00
Dmitry Shulga
93bdb6db4d MDEV-32733: Two JSON related tests running in PS mode fail on server built with -DWITH_PROTECT_STATEMENT_MEMROOT=YES
The tests main.func_json and json.json_no_table fail on server built with
the option -DWITH_PROTECT_STATEMENT_MEMROOT=YES by the reason that a memory
is allocated on the statement's memory root on the second execution of
a query that uses the function json_contains_path().

The reason that a memory is allocated on second execution of a prepared
statement that ivokes the function json_contains_path() is that a memory
allocated on every call of the method Item_json_str_multipath::fix_fields

To fix the issue, memory allocation should be done only once on first
call of the method Item_json_str_multipath::fix_fields. Simmilar issue
take place inside the method Item_func_json_contains_path::fix_fields.
Both methods are modified to make memory allocation only once on its
first execution and later re-use the allocated memory.

Before this patch the memory referenced by the pointers stored in the array
tmp_paths were released by the method Item_func_json_contains_path::cleanup
that is called on finishing execution of a prepared statement. Now that
memory allocation performed inside the method Item_json_str_multipath::fix_fields
is done only once, the item clean up has degenerate form and can be
delegated to the cleanup() method of the base class and memory deallocation
can be performed in the destructor.
2023-11-14 17:15:07 +07:00
Marko Mäkelä
0d55914d96 Merge 10.8 into 10.9 2023-02-16 10:25:34 +02:00
Marko Mäkelä
5abbe092e6 Merge 10.6 into 10.8 2023-02-16 09:17:06 +02:00
Marko Mäkelä
96a3b11d13 Merge 10.5 into 10.6 2023-02-14 15:23:23 +02:00
Weijun Huang
badf6de171 MDEV-30412: JSON_OBJECTAGG doesn't escape double quote in key 2023-02-14 11:55:11 +11:00
Oleksandr Byelkin
08d4968404 Merge branch '10.8' into 10.9 2023-01-18 16:39:11 +01:00
Oleksandr Byelkin
26d8485244 Merge branch '10.7' into 10.8 2023-01-18 16:37:40 +01:00
Oleksandr Byelkin
795ff0daf0 Merge branch '10.6' into 10.7 2023-01-18 16:36:13 +01:00
Oleksandr Byelkin
a01abad619 Merge branch '10.5' into 10.6 2023-01-18 16:33:06 +01:00
Rucha Deodhar
ff72a9431a MDEV-26392: Crash with json_get_path_next and 10.5.12
Analysis:
When we skip level when path is found, it changes the state of the json
engine. This breaks the sequence for json_get_path_next() which is called at
the end to ensure json document is valid and leads to crash.
Fix:
Use json_scan_next() at the end to check if json document has correct
syntax (is valid).
2023-01-18 16:28:50 +05:30
Marko Mäkelä
a8c5635cf1 Merge 10.5 into 10.6 2023-01-17 20:02:29 +02:00
Sergei Golubchik
22cd3358b3 fix failures of main.func_json --ps
in normal execution, the item is wrapped in Item_func_conv_charset.

in --ps the whole is wrapped again in Item_direct_ref_to_item
2023-01-17 15:28:56 +01:00
Rucha Deodhar
b915b96f72 MDEV-30304: Json Range only affects first row of the result set
Analysis:
Parsing json path happens only once. When paring, we set types of path
(types_used) to use later. If the path type has range or wild card, only
then multiple values get added to the result set.
However for each row in the table, types_used still gets
overwritten to default (no multiple values) and is also not set again
(because path is already parsed). Since multiple values depend on the
type of path, they dont get added to result set either.

Fix:
set default for types_used only if path is not parsed already.
2023-01-17 18:24:16 +05:30
Marko Mäkelä
5d5735c181 Merge 10.8 into 10.9 2023-01-13 11:22:29 +02:00
Marko Mäkelä
88c35781cc Merge 10.7 into 10.8 2023-01-13 11:11:04 +02:00
Marko Mäkelä
1e04cafcba Merge 10.6 into 10.7 2023-01-13 10:47:56 +02:00
Marko Mäkelä
3386b30975 Merge 10.5 into 10.6 2023-01-13 10:45:41 +02:00
Marko Mäkelä
73ecab3d26 Merge 10.4 into 10.5 2023-01-13 10:18:30 +02:00
Weijun-H
111a752b96 MDEV-19160 JSON_DETAILED output unnecessarily verbose 2023-01-05 13:12:24 +00:00
Marko Mäkelä
d3099985fb Merge 10.8 into 10.9 2022-08-29 14:02:29 +03:00
Marko Mäkelä
2bddc5d045 Merge 10.7 into 10.8 2022-08-24 10:22:37 +03:00
Marko Mäkelä
bdd80e3fb1 Merge 10.6 into 10.7 2022-08-24 09:22:34 +03:00
Marko Mäkelä
d65a2b7bde Merge 10.5 into 10.6 2022-08-22 14:02:43 +03:00
Marko Mäkelä
1d90d6874d Merge 10.4 into 10.5 2022-08-22 13:38:40 +03:00
Marko Mäkelä
36d173e523 Merge 10.3 into 10.4 2022-08-22 12:34:42 +03:00
Oleksandr Byelkin
8cb75b9863 Merge branch '10.9' into bb-10.9-release 2022-08-15 13:19:15 +02:00
Oleksandr Byelkin
39cafb666b Merge branch '10.6' into bb-10.6-release 2022-08-15 11:21:39 +02:00
qggcs
820175115e MDEV-29264: JSON function overflow error based on LONGTEXT field
Analysis: The JSON functions(JSON_ARRAY[OBJECT|ARRAY_APPEND|ARRAY_INSERT|INSERT|SET|REPLACE]) result is truncated when the function is called based on LONGTEXT field. The overflow occurs when computing the result length due to the LONGTEXT max length is same as uint32 max length. It lead to wrong result length.
Fix: Add static_cast<ulonglong> to avoid uint32 overflow and fix the arguments used.
2022-08-13 12:48:35 +05:30
Rucha Deodhar
d48428e99a MDEV-27151: JSON_VALUE() does not parse NULL properties properly
Analysis: JSON_VALUE() returns "null" string instead of NULL pointer.
Fix: When the type is JSON_VALUE_NULL (which is also a scalar) set
null_value to true and return 0 instead of returning string.
2022-08-11 15:01:15 +05:30
Rucha Deodhar
11d6de7032 MDEV-29212: json_overlaps() does not check nested key-value pair correctly
Analysis: JSON_OVERLAPS() does not check nested key-value pair completely.
If there is nested object, then it only scans and validates if two json values
overlap until one of the value (which is of type object) is exhausted.
This does not really check if the two values of keys are exacly the same, instead
it only checks if key-value pair of one is present in key-value pair of the
other
Fix: Normalize the values (which are of type object) and compare
using string compare. This will validate if two values
are exactly the same.
2022-08-11 13:47:25 +05:30
Oleksandr Byelkin
10ed52767d Merge branch '10.8' into 10.9 2022-08-10 13:57:24 +02:00
Oleksandr Byelkin
6ffbc0e510 Merge branch '10.7' into 10.8 2022-08-10 13:36:20 +02:00
Oleksandr Byelkin
65a963f755 Merge branch '10.6' into 10.7 2022-08-10 13:12:32 +02:00
Oleksandr Byelkin
c442e1ae21 Merge branch '10.5' into 10.6 2022-08-10 13:06:08 +02:00
Oleksandr Byelkin
1ac0bce36e Merge branch '10.4' into 10.5 2022-08-10 12:24:31 +02:00
Oleksandr Byelkin
65e8506ca9 Merge branch '10.3' into bb-10.4-release 2022-08-10 12:21:08 +02:00
qggcs
195833f1b6 refactor: remove redundant assignments 2022-08-09 12:35:37 +03:00