diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 49e99b1d609..13e33e768da 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4231,15 +4231,8 @@ int ha_partition::write_row(uchar * buf) */ if (have_auto_increment) { - if (!part_share->auto_inc_initialized && - !table_share->next_number_keypart) - { - /* - If auto_increment in table_share is not initialized, start by - initializing it. - */ - info(HA_STATUS_AUTO); - } + if (!table_share->next_number_keypart) + update_next_auto_inc_val(); error= update_auto_increment(); /* @@ -4432,8 +4425,11 @@ exit: bitmap_is_set(table->write_set, table->found_next_number_field->field_index)) { - if (!part_share->auto_inc_initialized) - info(HA_STATUS_AUTO); + update_next_auto_inc_val(); + /* + The following call is safe as part_share->auto_inc_initialized + (tested in the call) is guaranteed to be set for update statements. + */ set_auto_increment_if_higher(table->found_next_number_field); } DBUG_RETURN(error); @@ -8119,7 +8115,8 @@ int ha_partition::info(uint flag) { set_if_bigger(part_share->next_auto_inc_val, auto_increment_value); - part_share->auto_inc_initialized= true; + if (can_use_for_auto_inc_init()) + part_share->auto_inc_initialized= true; DBUG_PRINT("info", ("initializing next_auto_inc_val to %lu", (ulong) part_share->next_auto_inc_val)); } @@ -10088,6 +10085,82 @@ int ha_partition::cmp_ref(const uchar *ref1, const uchar *ref2) ****************************************************************************/ +/** + Retreive new values for part_share->next_auto_inc_val if needed + + This is needed if the value has not been initialized or if one of + the underlying partitions require that the value should be re-calculated +*/ + +void ha_partition::update_next_auto_inc_val() +{ + if (!part_share->auto_inc_initialized || + need_info_for_auto_inc()) + info(HA_STATUS_AUTO); +} + + +/** + Determine whether a partition needs auto-increment initialization. + + @return + TRUE A partition needs auto-increment initialization + FALSE No partition needs auto-increment initialization + + Resets part_share->auto_inc_initialized if next auto_increment needs to be + recalculated. +*/ + +bool ha_partition::need_info_for_auto_inc() +{ + handler **file= m_file; + DBUG_ENTER("ha_partition::need_info_for_auto_inc"); + + do + { + if ((*file)->need_info_for_auto_inc()) + { + /* We have to get new auto_increment values from handler */ + part_share->auto_inc_initialized= FALSE; + DBUG_RETURN(TRUE); + } + } while (*(++file)); + DBUG_RETURN(FALSE); +} + + +/** + Determine if all partitions can use the current auto-increment value for + auto-increment initialization. + + @return + TRUE All partitions can use the current auto-increment + value for auto-increment initialization + FALSE All partitions cannot use the current + auto-increment value for auto-increment + initialization + + Notes + This function is only called for ::info(HA_STATUS_AUTO) and is + mainly used by the Spider engine, which returns false + except in the case of DROP TABLE or ALTER TABLE when it returns TRUE. + Other engines always returns TRUE for this call. +*/ + +bool ha_partition::can_use_for_auto_inc_init() +{ + handler **file= m_file; + DBUG_ENTER("ha_partition::can_use_for_auto_inc_init"); + + do + { + if (!(*file)->can_use_for_auto_inc_init()) + DBUG_RETURN(FALSE); + } while (*(++file)); + DBUG_RETURN(TRUE); +} + + int ha_partition::reset_auto_increment(ulonglong value) { handler **file= m_file; @@ -10177,8 +10250,8 @@ void ha_partition::get_auto_increment(ulonglong offset, ulonglong increment, based replication. Because the statement-based binary log contains only the first generated value used by the statement, and slaves assumes all other generated values used by this statement were consecutive to - this first one, we must exclusively lock the generator until the statement - is done. + this first one, we must exclusively lock the generator until the + statement is done. */ if (!auto_increment_safe_stmt_log_lock && thd->lex->sql_command != SQLCOM_INSERT && diff --git a/sql/ha_partition.h b/sql/ha_partition.h index ba99660bea3..3187dc5dc62 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1137,6 +1137,8 @@ public: auto_increment_column_changed ------------------------------------------------------------------------- */ + virtual bool need_info_for_auto_inc(); + virtual bool can_use_for_auto_inc_init(); virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, @@ -1144,16 +1146,17 @@ public: virtual void release_auto_increment(); private: virtual int reset_auto_increment(ulonglong value); + void update_next_auto_inc_val(); virtual void lock_auto_increment() { /* lock already taken */ if (auto_increment_safe_stmt_log_lock) return; - DBUG_ASSERT(!auto_increment_lock); - if(table_share->tmp_table == NO_TMP_TABLE) + if (table_share->tmp_table == NO_TMP_TABLE) { - auto_increment_lock= TRUE; part_share->lock_auto_inc(); + DBUG_ASSERT(!auto_increment_lock); + auto_increment_lock= TRUE; } } virtual void unlock_auto_increment() @@ -1163,10 +1166,10 @@ private: It will be set to false and thus unlocked at the end of the statement by ha_partition::release_auto_increment. */ - if(auto_increment_lock && !auto_increment_safe_stmt_log_lock) + if (auto_increment_lock && !auto_increment_safe_stmt_log_lock) { - part_share->unlock_auto_inc(); auto_increment_lock= FALSE; + part_share->unlock_auto_inc(); } } virtual void set_auto_increment_if_higher(Field *field) @@ -1174,7 +1177,8 @@ private: ulonglong nr= (((Field_num*) field)->unsigned_flag || field->val_int() > 0) ? field->val_int() : 0; lock_auto_increment(); - DBUG_ASSERT(part_share->auto_inc_initialized); + DBUG_ASSERT(part_share->auto_inc_initialized || + !can_use_for_auto_inc_init()); /* must check when the mutex is taken */ if (nr >= part_share->next_auto_inc_val) part_share->next_auto_inc_val= nr + 1; diff --git a/sql/handler.h b/sql/handler.h index cdd5a8b3031..94473859226 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -3395,6 +3395,8 @@ public: virtual void try_semi_consistent_read(bool) {} virtual void unlock_row() {} virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;} + virtual bool need_info_for_auto_inc() { return 0; } + virtual bool can_use_for_auto_inc_init() { return 1; } virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, diff --git a/storage/spider/mysql-test/spider/r/auto_increment.result b/storage/spider/mysql-test/spider/r/auto_increment.result new file mode 100644 index 00000000000..cbc7fee0671 --- /dev/null +++ b/storage/spider/mysql-test/spider/r/auto_increment.result @@ -0,0 +1,186 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +SET @old_log_output = @@global.log_output; +SET GLOBAL log_output = 'TABLE,FILE'; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +test select 1 +connection master_1; +SELECT 1; +1 +1 +connection child2_1; +SELECT 1; +1 +1 + +create table select test +connection child2_1; +CHILD2_1_DROP_TABLES +CHILD2_1_CREATE_TABLES +TRUNCATE TABLE mysql.general_log; +connection master_1; +DROP TABLE IF EXISTS tbl_a; +CREATE TABLE tbl_a ( +col_a INT NOT NULL AUTO_INCREMENT, +col_b VARCHAR(20) DEFAULT 'defg', +col_c INT NOT NULL DEFAULT 100, +PRIMARY KEY(col_a) +) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1 +SHOW CREATE TABLE tbl_a; +Table Create Table +tbl_a CREATE TABLE `tbl_a` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` int(11) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +Table Create Table +tbl_a CREATE TABLE `tbl_a` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` int(11) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' +ALTER TABLE tbl_a MODIFY col_c MEDIUMINT NOT NULL DEFAULT 100; +SHOW CREATE TABLE tbl_a; +Table Create Table +tbl_a CREATE TABLE `tbl_a` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` mediumint(9) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' +RENAME TABLE tbl_a TO tbl_x; +SHOW CREATE TABLE tbl_x; +Table Create Table +tbl_x CREATE TABLE `tbl_x` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` mediumint(9) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' +RENAME TABLE tbl_x TO tbl_a; +SHOW CREATE TABLE tbl_a; +Table Create Table +tbl_a CREATE TABLE `tbl_a` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` mediumint(9) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +Table Create Table +tbl_a CREATE TABLE `tbl_a` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` mediumint(9) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' +MASTER_1_AUTO_INCREMENT1 +SHOW CREATE TABLE tbl_a; +Table Create Table +tbl_a CREATE TABLE `tbl_a` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` mediumint(9) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER AUTO_INCREMENT=30 DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +Table Create Table +tbl_a CREATE TABLE `tbl_a` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` mediumint(9) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' +MASTER_1_AUTO_INCREMENT2 +SHOW CREATE TABLE tbl_a; +Table Create Table +tbl_a CREATE TABLE `tbl_a` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` mediumint(9) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER AUTO_INCREMENT=20 DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +Table Create Table +tbl_a CREATE TABLE `tbl_a` ( + `col_a` int(11) NOT NULL AUTO_INCREMENT, + `col_b` varchar(20) DEFAULT 'defg', + `col_c` mediumint(9) NOT NULL DEFAULT 100, + PRIMARY KEY (`col_a`) +) ENGINE=SPIDER AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"' + +select test +connection child2_1; +TRUNCATE TABLE mysql.general_log; +connection master_1; +SELECT * FROM tbl_a; +col_a col_b col_c +1 def 10 +2 def 10 +3 def 10 +4 def 10 +5 def 10 +6 def 10 +7 def 10 +8 def 10 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +argument +select `col_a`,`col_b`,`col_c` from `auto_test_remote`.`tbl_a` +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %' +SELECT col_a, col_b, col_c FROM tbl_a ORDER BY col_a; +col_a col_b col_c +1 def 10 +2 def 10 +3 def 10 +4 def 10 +5 def 10 +6 def 10 +7 def 10 +8 def 10 + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/r/spider3_fixes_part.result index b793346df4b..937f222f02f 100644 --- a/storage/spider/mysql-test/spider/r/spider3_fixes_part.result +++ b/storage/spider/mysql-test/spider/r/spider3_fixes_part.result @@ -85,10 +85,10 @@ MASTER_1_AUTO_INCREMENT_OFFSET3 INSERT INTO t1 (id) VALUES (null); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() -778 +1555 SELECT MAX(id) FROM t1; MAX(id) -1554 +1555 MASTER_1_AUTO_INCREMENT_OFFSET4 INSERT INTO t2 (id) VALUES (null); SELECT LAST_INSERT_ID(); @@ -101,36 +101,36 @@ MASTER_1_AUTO_INCREMENT_OFFSET3 INSERT INTO t1 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() -1555 +2332 SELECT id FROM t1 ORDER BY id; id 777 -778 1554 1555 2331 2332 3109 3886 +4663 MASTER_1_AUTO_INCREMENT_OFFSET4 INSERT INTO t2 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); LAST_INSERT_ID() -3108 +5439 SELECT id FROM t2 ORDER BY id; id 777 -778 1554 1555 2331 2332 -3108 3109 -3885 3886 -4662 +4663 5439 +6216 +6993 +7770 TRUNCATE TABLE t1; TRUNCATE TABLE t2; INSERT INTO t1 () VALUES (),(),(),(); diff --git a/storage/spider/mysql-test/spider/t/auto_increment.test b/storage/spider/mysql-test/spider/t/auto_increment.test new file mode 100644 index 00000000000..12d93ca3e72 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/auto_increment.test @@ -0,0 +1,185 @@ +--source auto_increment_init.inc + +--echo +--echo drop and create databases +--connection master_1 +--disable_warnings +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + SET GLOBAL log_output = 'TABLE,FILE'; + } + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + +--echo +--echo test select 1 +--connection master_1 +SELECT 1; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + SELECT 1; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo create table select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS tbl_a; +--enable_warnings +--disable_query_log +echo CREATE TABLE tbl_a ( + col_a INT NOT NULL AUTO_INCREMENT, + col_b VARCHAR(20) DEFAULT 'defg', + col_c INT NOT NULL DEFAULT 100, + PRIMARY KEY(col_a) +) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1; +eval CREATE TABLE tbl_a ( + col_a INT NOT NULL AUTO_INCREMENT, + col_b VARCHAR(20) DEFAULT 'defg', + col_c INT NOT NULL DEFAULT 100, + PRIMARY KEY(col_a) +) $MASTER_1_ENGINE $MASTER_1_AUTO_INCREMENT_2_1 $MASTER_1_COMMENT_2_1; +--enable_query_log +SHOW CREATE TABLE tbl_a; +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +ALTER TABLE tbl_a MODIFY col_c MEDIUMINT NOT NULL DEFAULT 100; +SHOW CREATE TABLE tbl_a; +RENAME TABLE tbl_a TO tbl_x; +SHOW CREATE TABLE tbl_x; +RENAME TABLE tbl_x TO tbl_a; +SHOW CREATE TABLE tbl_a; +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT1; +eval $MASTER_1_AUTO_INCREMENT1; +--enable_query_log +SHOW CREATE TABLE tbl_a; +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; +--disable_query_log +echo MASTER_1_AUTO_INCREMENT2; +eval $MASTER_1_AUTO_INCREMENT2; +--enable_query_log +SHOW CREATE TABLE tbl_a; +INSERT INTO tbl_a () VALUES (); +INSERT INTO tbl_a () VALUES (); +SHOW CREATE TABLE tbl_a; + +--echo +--echo select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} +--connection master_1 +SELECT * FROM tbl_a; +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + eval $CHILD2_1_SELECT_ARGUMENT1; + } + eval $CHILD2_1_SELECT_TABLES; + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + if ($USE_GENERAL_LOG) + { + SET GLOBAL log_output = @old_log_output; + } +} +--enable_warnings +--source auto_increment_deinit.inc +--echo +--echo end of test diff --git a/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc b/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc new file mode 100644 index 00000000000..52be67a1d09 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc @@ -0,0 +1,13 @@ +--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP +--let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP +--let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP +--let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP +--let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP +--let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings diff --git a/storage/spider/mysql-test/spider/t/auto_increment_init.inc b/storage/spider/mysql-test/spider/t/auto_increment_init.inc new file mode 100644 index 00000000000..e4c1325072a --- /dev/null +++ b/storage/spider/mysql-test/spider/t/auto_increment_init.inc @@ -0,0 +1,38 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source ../t/test_init.inc +--enable_result_log +--enable_query_log +--enable_warnings +--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 +let $MASTER_1_COMMENT_2_1= + COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'; +let $MASTER_1_AUTO_INCREMENT_2_1= + AUTO_INCREMENT=20; +let $MASTER_1_AUTO_INCREMENT1= + ALTER TABLE tbl_a AUTO_INCREMENT=30; +let $MASTER_1_AUTO_INCREMENT2= + ALTER TABLE tbl_a AUTO_INCREMENT=10; +let $CHILD2_1_CHARSET_AUTO_INCREMENT= + AUTO_INCREMENT=20; +--let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES +let $CHILD2_1_DROP_TABLES= + DROP TABLE IF EXISTS tbl_a; +--let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES +let $CHILD2_1_CREATE_TABLES= + CREATE TABLE tbl_a ( + col_a INT NOT NULL AUTO_INCREMENT, + col_b VARCHAR(20) DEFAULT 'def', + col_c INT NOT NULL DEFAULT 10, + PRIMARY KEY(col_a) + ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET_AUTO_INCREMENT $CHILD2_1_CHARSET; +--let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES +let $CHILD2_1_SELECT_TABLES= + SELECT col_a, col_b, col_c FROM tbl_a ORDER BY col_a; +let $CHILD2_1_SELECT_ARGUMENT1= + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select %'; +--let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2 +--let $OUTPUT_CHILD_GROUP2= 1 +--let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG +--let $USE_GENERAL_LOG= 1 diff --git a/storage/spider/spd_environ.h b/storage/spider/spd_environ.h index f5141a7e3b4..1ca40f3f8cd 100644 --- a/storage/spider/spd_environ.h +++ b/storage/spider/spd_environ.h @@ -31,5 +31,7 @@ #define PARTITION_HAS_EXTRA_ATTACH_CHILDREN #define PARTITION_HAS_GET_CHILD_HANDLERS #define HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN +#define HANDLER_HAS_NEED_INFO_FOR_AUTO_INC +#define HANDLER_HAS_CAN_USE_FOR_AUTO_INC_INIT #endif #endif /* SPD_ENVIRON_INCLUDED */