mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	Bug #42074 concurrent optimize table and alter table = Assertion failed: thd->is_error() This assertion could occur if OPTIMIZE TABLE was started on a InnoDB table and the table was altered to different storage engine after OPTIMIZE had started. This allowed OPTIMIZE to pass the initial checks for storage engine support, but fail once it reached "recreate+analyze" if this operation was not supported by the new storage engine. The bug had no consequences for non-debug builds of the server. In detail, the assertion was triggered when ha_analyze() returned HA_ADMIN_NOT_IMPLEMENTED. This led to a code path which included an assert checking for diagnostics area contents. Since this area had not been filled, the assertion was triggered. The diagnostics area is in this case only used to provide more detailed information about why optimize failed. The triggered code path sends this information to the client and clears the diagnostic area. This patch fixed the problem by adding an error message to the diagnostic area if ha_analyze() fails. This error message contains the error code returned by ha_analyze(). Test case added to innodb_mysql_sync.test.
		
			
				
	
	
		
			27 lines
		
	
	
		
			839 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			839 B
		
	
	
	
		
			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';
 |