From 6b18dbef3163f5c99d35852421d909cf3a7651bd Mon Sep 17 00:00:00 2001 From: "ingo@mysql.com" <> Date: Fri, 2 Dec 2005 16:27:18 +0100 Subject: [PATCH 1/3] Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Added and used a configure.in macro. Replaced fixed limits by the configurable limit. Limited MyISAM indexes to its hard limit. Fixed a bug in opt_range.cc for many indexes with InnoDB. Tested for 2, 63, 64, 65, 127, 128, 129, 255, 256, and 257 indexes. Testing this part of the bugfix requires rebuilding of the server with different options. This cannot be done with our test suite. Therefore I added the necessary test files to the bug report. If you repeat the tests, please note that the ps_* tests fail for everything but 64 indexes. This is because of differences in the meta data, namely field lengths for index names etc. --- config/ac-macros/misc.m4 | 21 +++++++++++++++++++++ configure.in | 1 + include/myisam.h | 13 ++++++++----- sql/mysql_priv.h | 6 +++++- sql/opt_range.cc | 1 + sql/unireg.h | 2 +- tests/mysql_client_test.c | 2 +- 7 files changed, 38 insertions(+), 8 deletions(-) diff --git a/config/ac-macros/misc.m4 b/config/ac-macros/misc.m4 index 6f93f38f119..5346b81fb03 100644 --- a/config/ac-macros/misc.m4 +++ b/config/ac-macros/misc.m4 @@ -693,6 +693,27 @@ dnl --------------------------------------------------------------------------- dnl END OF MYSQL_CHECK_BIG_TABLES SECTION dnl --------------------------------------------------------------------------- + +dnl --------------------------------------------------------------------------- +dnl Macro: MYSQL_CHECK_MAX_INDEXES +dnl Sets MAX_INDEXES +dnl --------------------------------------------------------------------------- +AC_DEFUN([MYSQL_CHECK_MAX_INDEXES], [ + AC_ARG_WITH([max-indexes], + [ + --with-max-indexes=\# Sets the maximum number of indexes per table, default 64], + [max_indexes="$withval"], + [max_indexes=64]) + AC_MSG_CHECKING([max indexes per table]) + AC_DEFINE_UNQUOTED([MAX_INDEXES], [$max_indexes], + [Maximum number of indexes per table]) + AC_MSG_RESULT([$max_indexes]) +]) +dnl --------------------------------------------------------------------------- +dnl END OF MYSQL_CHECK_MAX_INDEXES SECTION +dnl --------------------------------------------------------------------------- + + dnl MYSQL_NEEDS_MYSYS_NEW AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW], [AC_CACHE_CHECK([needs mysys_new helpers], mysql_use_mysys_new, diff --git a/configure.in b/configure.in index 9f0867da68a..38ce699a7c5 100644 --- a/configure.in +++ b/configure.in @@ -2413,6 +2413,7 @@ AC_SUBST(readline_link) AC_SUBST(readline_h_ln_cmd) MYSQL_CHECK_BIG_TABLES +MYSQL_CHECK_MAX_INDEXES MYSQL_CHECK_BDB MYSQL_CHECK_INNODB MYSQL_CHECK_EXAMPLEDB diff --git a/include/myisam.h b/include/myisam.h index 56717524bb2..96c1e7e192e 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -33,8 +33,6 @@ extern "C" { #endif #include "my_handler.h" - /* defines used by myisam-funktions */ - /* There is a hard limit for the maximum number of keys as there are only 8 bits in the index file header for the number of keys in a table. @@ -45,14 +43,19 @@ extern "C" { running myisamchk compiled for 128 keys on a table with 255 keys. */ #define MI_MAX_POSSIBLE_KEY 255 /* For myisam_chk */ +#if MAX_INDEXES > MI_MAX_POSSIBLE_KEY +#define MI_MAX_KEY MI_MAX_POSSIBLE_KEY /* Max allowed keys */ +#else +#define MI_MAX_KEY MAX_INDEXES /* Max allowed keys */ +#endif + #define MI_MAX_POSSIBLE_KEY_BUFF (1024+6+6) /* For myisam_chk */ /* The following defines can be increased if necessary. - BUT: MI_MAX_KEY must be <= MI_MAX_POSSIBLE_KEY. + But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and MI_MAX_KEY_LENGTH. */ -#define MI_MAX_KEY 64 /* Max allowed keys */ +#define MI_MAX_KEY_LENGTH 1000 /* Max length in bytes */ #define MI_MAX_KEY_SEG 16 /* Max segments for key */ -#define MI_MAX_KEY_LENGTH 1000 #define MI_MAX_KEY_BUFF (MI_MAX_KEY_LENGTH+MI_MAX_KEY_SEG*6+8+8) #define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */ diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 6a1a65b963a..9b7921b2179 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -42,7 +42,11 @@ /* TODO convert all these three maps to Bitmap classes */ typedef ulonglong table_map; /* Used for table bits in join */ -typedef Bitmap<64> key_map; /* Used for finding keys */ +#if MAX_INDEXES <= 64 +typedef Bitmap<64> key_map; /* Used for finding keys */ +#else +typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */ +#endif typedef ulong key_part_map; /* Used for finding key parts */ /* Used to identify NESTED_JOIN structures within a join (applicable only to diff --git a/sql/opt_range.cc b/sql/opt_range.cc index d9a608eb064..221a343053d 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3172,6 +3172,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, trp->is_covering= TRUE; trp->read_cost= total_cost; trp->records= records; + trp->cpk_scan= NULL; DBUG_PRINT("info", ("Returning covering ROR-intersect plan: cost %g, records %lu", diff --git a/sql/unireg.h b/sql/unireg.h index 8f21dd1d2db..deae6908a69 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -48,7 +48,7 @@ #define MAX_ALIAS_NAME 256 #define MAX_FIELD_NAME 34 /* Max colum name length +2 */ #define MAX_SYS_VAR_LENGTH 32 -#define MAX_KEY 64 /* Max used keys */ +#define MAX_KEY MAX_INDEXES /* Max used keys */ #define MAX_REF_PARTS 16 /* Max parts used as ref */ #if SIZEOF_CHARP > 4 #define MAX_KEY_LENGTH 3072 /* max possible key, if 64 bits */ diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index ce732690700..36ab8094e5b 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -36,7 +36,7 @@ #define VER "2.1" #define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */ -#define MAX_KEY 64 +#define MAX_KEY MAX_INDEXES #define MAX_SERVER_ARGS 64 /* set default options */ From 0a45078dd87d128ade4cd5abddb4eb53dfe23f4d Mon Sep 17 00:00:00 2001 From: "msvensson@neptunus.(none)" <> Date: Mon, 5 Dec 2005 16:00:23 +0100 Subject: [PATCH 2/3] Fix for mysqltest.test failing with mysql-test-run.pl and --ps-protocol --- mysql-test/r/mysqltest.result | 2 +- mysql-test/t/mysqltest.test | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 56ee329fb28..5ff931dafb5 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -391,7 +391,7 @@ root@localhost -------------------------------------------------------------------------------- this will be executed this will be executed -mysqltest: At line 2: query 'create table t1 (a int primary key); +mysqltest: At line 3: query 'create table t1 (a int primary key); insert into t1 values (1); select 'select-me'; insertz 'error query'' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'insertz 'error query'' at line 1 diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 6e56fac2f86..8ccf2cb0c7a 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -953,7 +953,9 @@ select "this will be executed"; # # Failing multi statement query ---exec echo "delimiter ||||;" > var/tmp/bug11731.sql +# PS does not support multi statement +--exec echo "--disable_ps_protocol" > var/tmp/bug11731.sql +--exec echo "delimiter ||||;" >> var/tmp/bug11731.sql --exec echo "create table t1 (a int primary key);" >> var/tmp/bug11731.sql --exec echo "insert into t1 values (1);" >> var/tmp/bug11731.sql --exec echo "select 'select-me';" >> var/tmp/bug11731.sql @@ -973,7 +975,9 @@ drop table t1; # Using expected error ---exec echo "delimiter ||||;" > var/tmp/bug11731.sql +# PS does not support multi statement +--exec echo "--disable_ps_protocol" > var/tmp/bug11731.sql +--exec echo "delimiter ||||;" >> var/tmp/bug11731.sql --exec echo "--error 1064" >> var/tmp/bug11731.sql --exec echo "create table t1 (a int primary key);" >> var/tmp/bug11731.sql --exec echo "insert into t1 values (1);" >> var/tmp/bug11731.sql From 2fd30b61d52bdb3bdcc967b3e651d99f5826c666 Mon Sep 17 00:00:00 2001 From: "mleich@mysql.com" <> Date: Mon, 5 Dec 2005 17:57:48 +0100 Subject: [PATCH 3/3] Fix for Bug#12429: Replication tests fail: "Slave_IO_Running" (?) differs Solution according to the comments made by Guilhem - rpl_relayrotate Remove the SHOW SLAVE STATUS It is not needed. - rpl_until, rpl_deadlock Omit the printing of the "Slave_IO_Running" value --- mysql-test/r/rpl_deadlock.result | 2 +- mysql-test/r/rpl_relayrotate.result | 3 --- mysql-test/r/rpl_until.result | 2 +- mysql-test/t/disabled.def | 3 --- mysql-test/t/rpl_deadlock.test | 2 +- mysql-test/t/rpl_relayrotate.test | 3 --- mysql-test/t/rpl_until.test | 2 +- 7 files changed, 4 insertions(+), 13 deletions(-) diff --git a/mysql-test/r/rpl_deadlock.result b/mysql-test/r/rpl_deadlock.result index b112a51a145..c25cb1e6a53 100644 --- a/mysql-test/r/rpl_deadlock.result +++ b/mysql-test/r/rpl_deadlock.result @@ -83,5 +83,5 @@ a 22 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 18911 # # master-bin.000001 Yes Yes 0 0 18911 # None 0 No # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 18911 # # master-bin.000001 # Yes 0 0 18911 # None 0 No # drop table t1,t2,t3,t4; diff --git a/mysql-test/r/rpl_relayrotate.result b/mysql-test/r/rpl_relayrotate.result index c79187e12d0..b038e7b6a3e 100644 --- a/mysql-test/r/rpl_relayrotate.result +++ b/mysql-test/r/rpl_relayrotate.result @@ -16,7 +16,4 @@ master_pos_wait('master-bin.001',3000)>=0 select max(a) from t1; max(a) 8000 -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 735186 # # master-bin.000001 Yes Yes 0 0 735186 # None 0 No # drop table t1; diff --git a/mysql-test/r/rpl_until.result b/mysql-test/r/rpl_until.result index 64efeab0145..4a4dcdbb1c0 100644 --- a/mysql-test/r/rpl_until.result +++ b/mysql-test/r/rpl_until.result @@ -49,7 +49,7 @@ n 2 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 776 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 608 # Relay slave-relay-bin.000004 746 No # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 776 slave-relay-bin.000004 # master-bin.000001 # No 0 0 608 # Relay slave-relay-bin.000004 746 No # start slave; stop slave; start slave until master_log_file='master-bin.000001', master_log_pos=776; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index fe95a543fb5..4f5e11e7fbd 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -11,7 +11,4 @@ ############################################################################## sp-goto : GOTO is currently is disabled - will be fixed in the future -rpl_relayrotate : Unstable test case, bug#12429 -rpl_until : Unstable test case, bug#12429 -rpl_deadlock : Unstable test case, bug#12429 kill : Unstable test case, bug#9712 diff --git a/mysql-test/t/rpl_deadlock.test b/mysql-test/t/rpl_deadlock.test index d2a8fc0c844..08921caf897 100644 --- a/mysql-test/t/rpl_deadlock.test +++ b/mysql-test/t/rpl_deadlock.test @@ -102,7 +102,7 @@ commit; sync_with_master; select * from t1; select * from t2; ---replace_column 1 # 8 # 9 # 23 # 33 # +--replace_column 1 # 8 # 9 # 11 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT show slave status; diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test index b66cf7a6e0d..e9a4cdd05c5 100644 --- a/mysql-test/t/rpl_relayrotate.test +++ b/mysql-test/t/rpl_relayrotate.test @@ -56,9 +56,6 @@ start slave; # (the only statement with position>=3000 is COMMIT). select master_pos_wait('master-bin.001',3000)>=0; select max(a) from t1; ---replace_column 1 # 8 # 9 # 23 # 33 # ---replace_result $MASTER_MYPORT MASTER_MYPORT -show slave status; connection master; # The following DROP is a very important cleaning task: diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_until.test index 5bc7a040b1b..708f44a1ab6 100644 --- a/mysql-test/t/rpl_until.test +++ b/mysql-test/t/rpl_until.test @@ -49,7 +49,7 @@ sleep 2; wait_for_slave_to_stop; select * from t2; --replace_result $MASTER_MYPORT MASTER_MYPORT ---replace_column 1 # 9 # 23 # 33 # +--replace_column 1 # 9 # 11 # 23 # 33 # show slave status; # clean up