[MDEV-27277] Please add a warning when max_sort_length is reached. Created: 2021-12-15  Updated: 2023-12-22

Status: In Review
Project: MariaDB Server
Component/s: Server
Fix Version/s: 11.5

Type: Task Priority: Major
Reporter: Jean-François Gagné Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Hi,

this is to report upstream feature request Bug#105911 [1] for MariaDB.

[1]: https://bugs.mysql.com/bug.php?id=105911

This FR is to add a warning when the max_sort_length limit is reached.

As shown below for 10.6.5 (same for 10.5.13), there are no warning when the limit is reached.

Many thanks for looking into this,

Jean-François Gagné

# Create a sandbox.
dbdeployer deploy single mariadb_10.6.5
 
# max_sort_length is 1024 by default.
./use -N <<< "show global variables like 'max_sort_length'"
max_sort_length 1024
 
# Initialize the sandbox.
./use <<< "
  CREATE DATABASE test_jfg;
  CREATE TABLE test_jfg.t (
    id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    v VARCHAR(5000))"
 
# Add rows on both sides of the limit.
for i in 1020 1024; do
  for j in 2 4 6 1 3 5; do ./use test_jfg <<< "INSERT INTO t(v) VALUES('$(yes | head -n $i | paste -s -d "")$j')"; done
done
 
# No warnings even if the ORDER BY is not fully honored.
mysql [localhost:10605] {msandbox} (test_jfg) > SELECT SUBSTRING(v, 1020) FROM t ORDER BY v;
+--------------------+
| SUBSTRING(v, 1020) |
+--------------------+
| y1                 |
| y2                 |
| y3                 |
| y4                 |
| y5                 |
| y6                 |
| yyyyy2             |
| yyyyy4             |
| yyyyy6             |
| yyyyy1             |
| yyyyy3             |
| yyyyy5             |
+--------------------+
12 rows in set (0.000 sec)
 
# I would expect a warning similar to this.
mysql [localhost:10605] {msandbox} (test_jfg) > SELECT "1a" + 2;
+----------+
| "1a" + 2 |
+----------+
|        3 |
+----------+
1 row in set, 1 warning (0.000 sec)
 
mysql [localhost:10605] {msandbox} (test_jfg) > show warnings;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: '1a' |
+---------+------+----------------------------------------+
1 row in set (0.000 sec)



 Comments   
Comment by Oleg Smirnov [ 2023-09-05 ]

psergei can you please review bb-11.3-mdev-27277?

Generated at Thu Feb 08 09:51:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.