1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-27277 Add a warning when max_sort_length is reached

During a query execution some sorting and grouping operations
on strings may be involved. System variable max_sort_length defines
the maximum number of bytes to use when comparing strings during
sorting/grouping. Thus, the comparable parts of strings may be less
than their actual size, so the results of the query may be not
sorted/grouped properly.
To indicate that some comparisons were done on a truncated lengths,
a new warning has been introduced with this commit.
This commit is contained in:
Oleg Smirnov
2023-09-04 13:15:06 +07:00
parent 0d17c540a5
commit fd87e01f38
20 changed files with 432 additions and 28 deletions

View File

@@ -146,6 +146,11 @@ while ($_dt_tables)
--echo # increasing group_concat_max_len from $_dt_old_group_concat_max_len to $_dt_order_by_length
}
}
# Increase sorting buffers.
--let $_dt_old_max_sort_length= `SELECT @@SESSION.max_sort_length`
--let $_dt_old_sort_buffer_size= `SELECT @@SESSION.sort_buffer_size`
--eval SET SESSION max_sort_length = 100000;
--eval SET SESSION sort_buffer_size = 10000000;
# Generate ORDER BY clause.
# It would be better to do GROUP_CONCAT(CONCAT('`', column_name, '`')) but
# BUG#58087 prevents us from returning strings that begin with backticks.
@@ -172,6 +177,9 @@ while ($_dt_tables)
eval SELECT * INTO OUTFILE '$_dt_outfile' FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list`;
--enable_cursor_protocol
--enable_ps2_protocol
# Restore sorting buffers.
--eval SET SESSION max_sort_length = $_dt_old_max_sort_length;
--eval SET SESSION sort_buffer_size = $_dt_old_sort_buffer_size;
# Compare files.
if ($_dt_prev_outfile)