Commit 6b18dbef authored by ingo@mysql.com's avatar ingo@mysql.com

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.
parent 04d1ef90
...@@ -693,6 +693,27 @@ dnl --------------------------------------------------------------------------- ...@@ -693,6 +693,27 @@ dnl ---------------------------------------------------------------------------
dnl END OF MYSQL_CHECK_BIG_TABLES SECTION dnl END OF MYSQL_CHECK_BIG_TABLES SECTION
dnl --------------------------------------------------------------------------- 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 dnl MYSQL_NEEDS_MYSYS_NEW
AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW], AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW],
[AC_CACHE_CHECK([needs mysys_new helpers], mysql_use_mysys_new, [AC_CACHE_CHECK([needs mysys_new helpers], mysql_use_mysys_new,
......
...@@ -2413,6 +2413,7 @@ AC_SUBST(readline_link) ...@@ -2413,6 +2413,7 @@ AC_SUBST(readline_link)
AC_SUBST(readline_h_ln_cmd) AC_SUBST(readline_h_ln_cmd)
MYSQL_CHECK_BIG_TABLES MYSQL_CHECK_BIG_TABLES
MYSQL_CHECK_MAX_INDEXES
MYSQL_CHECK_BDB MYSQL_CHECK_BDB
MYSQL_CHECK_INNODB MYSQL_CHECK_INNODB
MYSQL_CHECK_EXAMPLEDB MYSQL_CHECK_EXAMPLEDB
......
...@@ -33,8 +33,6 @@ extern "C" { ...@@ -33,8 +33,6 @@ extern "C" {
#endif #endif
#include "my_handler.h" #include "my_handler.h"
/* defines used by myisam-funktions */
/* /*
There is a hard limit for the maximum number of keys as there are only 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. 8 bits in the index file header for the number of keys in a table.
...@@ -45,14 +43,19 @@ extern "C" { ...@@ -45,14 +43,19 @@ extern "C" {
running myisamchk compiled for 128 keys on a table with 255 keys. running myisamchk compiled for 128 keys on a table with 255 keys.
*/ */
#define MI_MAX_POSSIBLE_KEY 255 /* For myisam_chk */ #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 */ #define MI_MAX_POSSIBLE_KEY_BUFF (1024+6+6) /* For myisam_chk */
/* /*
The following defines can be increased if necessary. 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_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_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 */ #define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */
......
...@@ -42,7 +42,11 @@ ...@@ -42,7 +42,11 @@
/* TODO convert all these three maps to Bitmap classes */ /* TODO convert all these three maps to Bitmap classes */
typedef ulonglong table_map; /* Used for table bits in join */ 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 */ typedef ulong key_part_map; /* Used for finding key parts */
/* /*
Used to identify NESTED_JOIN structures within a join (applicable only to Used to identify NESTED_JOIN structures within a join (applicable only to
......
...@@ -3172,6 +3172,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, ...@@ -3172,6 +3172,7 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
trp->is_covering= TRUE; trp->is_covering= TRUE;
trp->read_cost= total_cost; trp->read_cost= total_cost;
trp->records= records; trp->records= records;
trp->cpk_scan= NULL;
DBUG_PRINT("info", DBUG_PRINT("info",
("Returning covering ROR-intersect plan: cost %g, records %lu", ("Returning covering ROR-intersect plan: cost %g, records %lu",
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#define MAX_ALIAS_NAME 256 #define MAX_ALIAS_NAME 256
#define MAX_FIELD_NAME 34 /* Max colum name length +2 */ #define MAX_FIELD_NAME 34 /* Max colum name length +2 */
#define MAX_SYS_VAR_LENGTH 32 #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 */ #define MAX_REF_PARTS 16 /* Max parts used as ref */
#if SIZEOF_CHARP > 4 #if SIZEOF_CHARP > 4
#define MAX_KEY_LENGTH 3072 /* max possible key, if 64 bits */ #define MAX_KEY_LENGTH 3072 /* max possible key, if 64 bits */
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define VER "2.1" #define VER "2.1"
#define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */ #define MAX_TEST_QUERY_LENGTH 300 /* MAX QUERY BUFFER LENGTH */
#define MAX_KEY 64 #define MAX_KEY MAX_INDEXES
#define MAX_SERVER_ARGS 64 #define MAX_SERVER_ARGS 64
/* set default options */ /* set default options */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment