[MDEV-13977] Assertion `0' fails in void Protocol::end_statement or wrong result of ALTER if EITS stat tables are InnoDB Created: 2017-10-01  Updated: 2022-12-06  Resolved: 2022-12-06

Status: Closed
Project: MariaDB Server
Component/s: Admin statements, Data Definition - Alter Table, Optimizer, Storage Engine - InnoDB
Affects Version/s: 10.0
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: not-10.1, not-10.2, not-10.3, not-10.4+


 Description   

--source include/have_innodb.inc
--source include/have_log_bin.inc
 
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
 
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
 
ALTER TABLE  mysql.index_stats ENGINE=InnoDB;
ALTER TABLE  mysql.column_stats ENGINE=InnoDB;
ALTER TABLE  mysql.table_stats ENGINE=InnoDB;
 
RENAME TABLE t1 TO t2, t1 TO t2;
 
SHOW TABLES;
 
# Cleanup
DROP TABLE IF EXISTS t1, t2;

10.0 debug 78b63425a3f1

mysqld: /data/src/10.0/sql/protocol.cc:530: void Protocol::end_statement(): Assertion `0' failed.
171002  0:26:02 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f54912c9ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00000000005a2241 in Protocol::end_statement (this=0x7f548576f5f8) at /data/src/10.0/sql/protocol.cc:530
#9  0x000000000064a36e in dispatch_command (command=COM_QUERY, thd=0x7f548576f070, packet=0x7f548b1f1071 "RENAME TABLE t1 TO t2, t1 TO t2", packet_length=31) at /data/src/10.0/sql/sql_parse.cc:1732
#10 0x0000000000648237 in do_command (thd=0x7f548576f070) at /data/src/10.0/sql/sql_parse.cc:999
#11 0x0000000000768052 in do_handle_one_connection (thd_arg=0x7f548576f070) at /data/src/10.0/sql/sql_connect.cc:1377
#12 0x0000000000767dc4 in handle_one_connection (arg=0x7f548576f070) at /data/src/10.0/sql/sql_connect.cc:1292
#13 0x0000000000ac8076 in pfs_spawn_thread (arg=0x7f548571f3f0) at /data/src/10.0/storage/perfschema/pfs.cc:1860
#14 0x00007f549323b494 in start_thread (arg=0x7f54935b5700) at pthread_create.c:333
#15 0x00007f549138693f in clone () from /lib/x86_64-linux-gnu/libc.so.6

On a release build RENAME TABLE does not produce the expected error, ends silently:

MariaDB [test]> RENAME TABLE t1 TO t2, t1 TO t2;
Query OK, 0 rows affected (0.00 sec)

However, if we run SHOW WARNINGS anyway, it returns a lot:

+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message                                                                                                                                                                                                                                                                         |
+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Error | 1665 | Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. |
| Error | 1015 | Can't lock file (errno: 170 "It is not possible to log this statement")                                                                                                                                                                                                         |
| Error | 1050 | Table 't2' already exists                                                                                                                                                                                                                                                       |
| Error | 1665 | Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED. |
| Error | 1015 | Can't lock file (errno: 170 "It is not possible to log this statement")                                                                                                                                                                                                         |
+-------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
5 rows in set (0.00 sec)

And the table is not renamed.

10.1 and 10.2 don't seem to be affected.


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