mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
led to creating corrupted index. While execution of the CREATE .. SELECT SQL_BUFFER_RESULT statement the engine->start_bulk_insert function was called twice. On the first call On the first call MyISAM disabled all non-unique indexes and on the second call it decides to not re-enable them because all indexes was disabled. Due to this no indexes was actually created during CREATE TABLE thus producing crashed table. Now the select_inset class has is_bulk_insert_mode flag which prevents calling the start_bulk_insert function twice. The flag is set in the select_create::prepare, select_insert::prepare2 functions and the select_insert class constructor. The flag is reset in the select_insert::send_eof function. mysql-test/t/insert_select.test: A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT led to creating corrupted index. mysql-test/r/insert_select.result: A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT led to creating corrupted index. sql/sql_class.h: Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT led to creating corrupted index. The is_bulk_insert_mode flag is added to the select_insert class. sql/sql_insert.cc: Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT led to creating corrupted index. The is_bulk_insert_mode is set in the select_create::prepare, select_insert::prepare2 functions and the select_insert class constructor. The flag is reset in the select_insert::send_eof function.
This commit is contained in:
parent
ad57f91294
commit
f7f1095908
4 changed files with 35 additions and 3 deletions
|
|
@ -385,3 +385,15 @@ INSERT INTO t1 (prev_id) SELECT id
|
|||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#30384: Having SQL_BUFFER_RESULT option in the
|
||||
--echo # CREATE .. KEY(..) .. SELECT led to creating corrupted index.
|
||||
--echo #
|
||||
create table t1(f1 int);
|
||||
insert into t1 values(1),(2),(3);
|
||||
create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
|
||||
check table t2 extended;
|
||||
drop table t1,t2;
|
||||
--echo ##################################################################
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue