mirror of
				https://github.com/MariaDB/server.git
				synced 2025-11-03 14:33:32 +03:00 
			
		
		
		
	This assertion could be triggered during execution of OPTIMIZE TABLE for InnoDB tables. As part of optimize for InnoDB tables, the table is recreated and then opened again. If the reopen failed for any reason, the assertion would be triggered. This could for example be caused by a concurrent DROP TABLE executed by a different connection. The reason for the assertion was that any failures during reopening were ignored. This patch fixes the problem by making sure that the result of reopening the table is checked and that any error messages are sent to the client. Test case added to innodb_mysql_sync.test.
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
#
 | 
						|
# Bug 42074 concurrent optimize table and 
 | 
						|
# alter table = Assertion failed: thd->is_error()
 | 
						|
#
 | 
						|
DROP TABLE IF EXISTS t1;
 | 
						|
# Create InnoDB table
 | 
						|
CREATE TABLE t1 (id INT) engine=innodb;
 | 
						|
# Connection 1
 | 
						|
# Start optimizing table
 | 
						|
SET DEBUG_SYNC='ha_admin_try_alter SIGNAL optimize_started WAIT_FOR table_altered';
 | 
						|
OPTIMIZE TABLE t1;
 | 
						|
# Connection 2
 | 
						|
# Change table to engine=memory
 | 
						|
SET DEBUG_SYNC='now WAIT_FOR optimize_started';
 | 
						|
ALTER TABLE t1 engine=memory;
 | 
						|
SET DEBUG_SYNC='now SIGNAL table_altered';
 | 
						|
# Connection 1
 | 
						|
# Complete optimization
 | 
						|
Table	Op	Msg_type	Msg_text
 | 
						|
test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
 | 
						|
test.t1	optimize	error	Got error -1 from storage engine
 | 
						|
test.t1	optimize	status	Operation failed
 | 
						|
Warnings:
 | 
						|
Error	1030	Got error -1 from storage engine
 | 
						|
DROP TABLE t1;
 | 
						|
SET DEBUG_SYNC='RESET';
 | 
						|
#
 | 
						|
# Bug#47459 Assertion in Diagnostics_area::set_eof_status on
 | 
						|
#           OPTIMIZE TABLE
 | 
						|
#
 | 
						|
DROP TABLE IF EXISTS t1;
 | 
						|
CREATE TABLE t1(a INT) ENGINE= InnoDB;
 | 
						|
# Connection con1
 | 
						|
SET DEBUG_SYNC= "ha_admin_open_ltable SIGNAL opening WAIT_FOR dropped";
 | 
						|
# Sending:
 | 
						|
OPTIMIZE TABLE t1;
 | 
						|
# Connection default
 | 
						|
SET DEBUG_SYNC= "now WAIT_FOR opening";
 | 
						|
DROP TABLE t1;
 | 
						|
SET DEBUG_SYNC= "now SIGNAL dropped";
 | 
						|
# Connection con1
 | 
						|
# Reaping: OPTIMIZE TABLE t1
 | 
						|
Table	Op	Msg_type	Msg_text
 | 
						|
test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
 | 
						|
test.t1	optimize	error	Table 'test.t1' doesn't exist
 | 
						|
test.t1	optimize	status	Operation failed
 | 
						|
Warnings:
 | 
						|
Error	1146	Table 'test.t1' doesn't exist
 | 
						|
# Connection default
 | 
						|
SET DEBUG_SYNC= "RESET";
 |