[MDEV-23212] Limited tmp_disk_table_size causes wrong results or warnings upon queries from I_S, Assertion `0' in Protocol::end_statement, Internal MariaDB error code: 1114 on slave init Created: 2020-07-18  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: Information Schema, Variables
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 1
Labels: None

Issue Links:
Relates
relates to MDEV-22266 Diagnostics_area::sql_errno() const: ... Closed

 Description   

Depending on the version and build, tmp_disk_table_size has different effects on queries from INFORMATION_SCHEMA, particularly INFORMATION_SCHEMA.ALL_PLUGINS.

The actual contents of ALL_PLUGINS table in the examples before is 109-129 rows, depending on the version.

SET tmp_disk_table_size= 16384;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ALL_PLUGINS;
SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS UNION DISTINCT SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS;

10.2 returns wrong results for both queries without any warnings:

10.2 non-debug a1e52e7f

MariaDB [test]> SET tmp_disk_table_size= 16384;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [test]> SELECT COUNT(*) FROM INFORMATION_SCHEMA.ALL_PLUGINS;
+----------+
| COUNT(*) |
+----------+
|        1 |
+----------+
1 row in set (0.032 sec)
 
MariaDB [test]> SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS UNION DISTINCT SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS;
Query OK, 0 rows affected (0.021 sec)

10.3 and 10.4 return a correct result on the simple query but wrong result without warnings on UNION:

10.3 non-debug 2cae58f8

MariaDB [test]> SET tmp_disk_table_size= 16384;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [test]> SELECT COUNT(*) FROM INFORMATION_SCHEMA.ALL_PLUGINS;
+----------+
| COUNT(*) |
+----------+
|      109 |
+----------+
1 row in set (0.535 sec)
 
MariaDB [test]> SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS UNION DISTINCT SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS;
Query OK, 0 rows affected (0.071 sec)

10.5 returns a wrong result with bunch of warnings (including weird ones about not found symbols) on the simple query and a wrong result without warnings on UNION:

10.5 non-debug 054f1036

MariaDB [test]> SET tmp_disk_table_size= 16384;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [test]> SELECT COUNT(*) FROM INFORMATION_SCHEMA.ALL_PLUGINS;
+----------+
| COUNT(*) |
+----------+
|        1 |
+----------+
1 row in set, 45 warnings (0.020 sec)
 
MariaDB [test]> SHOW WARNINGS;
+-------+------+-----------------------------------------------------------------+
| Level | Code | Message                                                         |
+-------+------+-----------------------------------------------------------------+
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1127 | Can't find symbol '_mysql_plugin_interface_version_' in library |
| Error | 1127 | Can't find symbol '_mysql_plugin_interface_version_' in library |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1127 | Can't find symbol '_mysql_plugin_interface_version_' in library |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1127 | Can't find symbol '_mysql_plugin_interface_version_' in library |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1127 | Can't find symbol '_mysql_plugin_interface_version_' in library |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
| Error | 1114 | The table '(temporary)' is full                                 |
+-------+------+-----------------------------------------------------------------+
45 rows in set (0.000 sec)
 
MariaDB [test]> SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS UNION DISTINCT SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS;
Query OK, 0 rows affected (0.034 sec)

All debug builds additionally abort with an assertion failure upon UNION:

10.5 debug 054f1036

mariadbd: /data/src/10.5/sql/protocol.cc:623: void Protocol::end_statement(): Assertion `0' failed.
200718 18:07:35 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f1390bfdf12 in __GI___assert_fail (assertion=0x5582bd0edad0 "0", file=0x5582bd0ed7c0 "/data/src/10.5/sql/protocol.cc", line=623, function=0x5582bd0ee190 <Protocol::end_statement()::__PRETTY_FUNCTION__> "void Protocol::end_statement()") at assert.c:101
#8  0x00005582bc258c62 in Protocol::end_statement (this=0x7f13700010e0) at /data/src/10.5/sql/protocol.cc:623
#9  0x00005582bc38769b in dispatch_command (command=COM_QUERY, thd=0x7f1370000b18, packet=0x7f13701af1f9 "SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS UNION DISTINCT SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS", packet_length=104, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:2459
#10 0x00005582bc383daa in do_command (thd=0x7f1370000b18) at /data/src/10.5/sql/sql_parse.cc:1348
#11 0x00005582bc529589 in do_handle_one_connection (connect=0x5582bfffe1b8, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1411
#12 0x00005582bc5292f1 in handle_one_connection (arg=0x5582bfffe1b8) at /data/src/10.5/sql/sql_connect.cc:1313
#13 0x00005582bca673f6 in pfs_spawn_thread (arg=0x5582bfffdde8) at /data/src/10.5/storage/perfschema/pfs.cc:2201
#14 0x00007f1392b864a4 in start_thread (arg=0x7f1387768700) at pthread_create.c:456
#15 0x00007f1390cbad0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97



 Comments   
Comment by Roel Van de Paar [ 2022-11-22 ]

SET GLOBAL init_slave='SHOW VARIABLES';
SET GLOBAL tmp_disk_table_size=1024;
SET GLOBAL big_tables=1;
CHANGE MASTER TO master_host='none';
START SLAVE SQL_THREAD;

Will produce

10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

2022-11-22 17:31:05 5 [Note] Slave SQL thread initialized, starting replication in log 'FIRST' at position 4, relay log './qa-roel-2-relay-bin.000001' position: 4; GTID position ''
2022-11-22 17:31:05 5 [ERROR] mysqld: The table '(temporary)' is full
2022-11-22 17:31:05 5 [ERROR] Slave SQL: Slave SQL thread aborted. Can't execute init_slave query, Internal MariaDB error code: 1114
2022-11-22 17:31:05 5 [Note] Slave SQL thread exiting, replication stopped in log 'FIRST' at position 4; GTID position '', master: none:3306

On 10.2-10.11

Comment by Roel Van de Paar [ 2022-11-22 ]

Original testcase

SET tmp_disk_table_size= 16384;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ALL_PLUGINS;
SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS UNION DISTINCT SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS;

Against 10.11 produces:

10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

mysqld: /test/10.11_dbg/sql/protocol.cc:617: void Protocol::end_statement(): Assertion `0' failed.

10.11.2 8283948846740a22f96bbe7bccf250708406d5d9 (Debug)

Core was generated by `/test/MD171122-mariadb-10.11.2-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x1474cd166700 (LWP 1371204))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00001474e5ccd859 in __GI_abort () at abort.c:79
#2  0x00001474e5ccd729 in __assert_fail_base (fmt=0x1474e5e63588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55d67812a073 "0", file=0x55d677f5d7d0 "/test/10.11_dbg/sql/protocol.cc", line=617, function=<optimized out>) at assert.c:92
#3  0x00001474e5cdefd6 in __GI___assert_fail (assertion=assertion@entry=0x55d67812a073 "0", file=file@entry=0x55d677f5d7d0 "/test/10.11_dbg/sql/protocol.cc", line=line@entry=617, function=function@entry=0x55d677f5dfd0 "void Protocol::end_statement()") at assert.c:101
#4  0x000055d6772d0fca in Protocol::end_statement (this=0x14748c001358) at /test/10.11_dbg/sql/protocol.cc:617
#5  0x000055d6773bf613 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14748c000d48, packet=<optimized out>, packet@entry=0x14748c00adf9 "SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS UNION DISTINCT SELECT * FROM INFORMATION_SCHEMA.ALL_PLUGINS", packet_length=packet_length@entry=104, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:2401
#6  0x000055d6773bff7f in do_command (thd=0x14748c000d48, blocking=blocking@entry=true) at /test/10.11_dbg/sql/sql_parse.cc:1407
#7  0x000055d67751a763 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55d67b1997c8, put_in_cache=put_in_cache@entry=true) at /test/10.11_dbg/sql/sql_connect.cc:1416
#8  0x000055d67751ac32 in handle_one_connection (arg=0x55d67b1997c8) at /test/10.11_dbg/sql/sql_connect.cc:1318
#9  0x00001474e61de609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#10 0x00001474e5dca133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

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