summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2005-12-02 16:27:18 +0100
committerunknown <ingo@mysql.com>2005-12-02 16:27:18 +0100
commit65d412db6e45423aaf6889fd902ce844d71ff751 (patch)
tree0c8cfb24444d1fcb19a7bf0773a7e6cb7d435c33
parente77da4fc83cc2cbacad9be4c9efc4704224cf660 (diff)
downloadmariadb-git-65d412db6e45423aaf6889fd902ce844d71ff751.tar.gz
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: 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 a macro for the new build option. configure.in: 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 a call for the new macro. include/myisam.h: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Limit the number of keys for MyISAM to its hard limit. sql/mysql_priv.h: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Stick with the optimized Bitmap<64> if indexes are limited to 64 or lower. Otherwise use a bigger bitmap. It must be defined as a multiple of 8. sql/opt_range.cc: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Initialize an object element to avoid a crash when using InnoDB with many indexes. sql/unireg.h: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Replace the fixed limit by the configurable limit. tests/mysql_client_test.c: Bug#10932 - Building server with key limit of 128, makes test cases fail Allow for configuration of the maximum number of indexes per table. Replace the fixed limit by the configurable limit.
-rw-r--r--config/ac-macros/misc.m421
-rw-r--r--configure.in1
-rw-r--r--include/myisam.h13
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/opt_range.cc1
-rw-r--r--sql/unireg.h2
-rw-r--r--tests/mysql_client_test.c2
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 */