diff options
Diffstat (limited to 'sql')
| -rw-r--r-- | sql/handler.cc | 2 | ||||
| -rw-r--r-- | sql/handler.h | 1 | ||||
| -rw-r--r-- | sql/sql_table.cc | 20 | ||||
| -rw-r--r-- | sql/sql_yacc.yy | 6 | ||||
| -rw-r--r-- | sql/sql_yacc_ora.yy | 5 |
5 files changed, 28 insertions, 6 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index e5362c7cf9c..f60cd67edae 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -68,7 +68,7 @@ static handlerton *installed_htons[128]; #define BITMAP_STACKBUF_SIZE (128/8) KEY_CREATE_INFO default_key_create_info= -{ HA_KEY_ALG_UNDEF, 0, {NullS, 0}, {NullS, 0}, true }; +{ HA_KEY_ALG_UNDEF, 0, 0, {NullS, 0}, {NullS, 0}, true }; /* number of entries in handlertons[] */ ulong total_ha= 0; diff --git a/sql/handler.h b/sql/handler.h index 29a837b5ea8..01d243a4451 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2347,6 +2347,7 @@ typedef struct st_key_create_information { enum ha_key_alg algorithm; ulong block_size; + uint flags; /* HA_USE.. flags */ LEX_CSTRING parser_name; LEX_CSTRING comment; /** diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0201a904058..99084152cf2 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3847,7 +3847,17 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, key->key_create_info.block_size : create_info->key_block_size); - if (key_info->block_size) + /* + Remember block_size for the future if the block size was given + either for key or table and it was given for the key during + create/alter table or we have an active key_block_size for the + table. + The idea is that table specific key_block_size > 0 will only affect + new keys and old keys will remember their original value. + */ + if (key_info->block_size && + ((key->key_create_info.flags & HA_USES_BLOCK_SIZE) || + create_info->key_block_size)) key_info->flags|= HA_USES_BLOCK_SIZE; List_iterator<Key_part_spec> cols(key->columns), cols2(key->columns); @@ -8408,8 +8418,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, LEX_CSTRING tmp_name; bzero((char*) &key_create_info, sizeof(key_create_info)); key_create_info.algorithm= key_info->algorithm; - if (key_info->flags & HA_USES_BLOCK_SIZE) - key_create_info.block_size= key_info->block_size; + /* + We copy block size directly as some engines, like Area, sets this + automatically + */ + key_create_info.block_size= key_info->block_size; + key_create_info.flags= key_info->flags; // HA_USE_BLOCK_SIZE if (key_info->flags & HA_USES_PARSER) key_create_info.parser_name= *plugin_name(key_info->parser); if (key_info->flags & HA_USES_COMMENT) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index fc064748200..002ecc65478 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -69,6 +69,7 @@ #include "sql_sequence.h" #include "sql_tvc.h" #include "vers_utils.h" +#include "my_base.h" /* this is to get the bison compilation windows warnings out */ #ifdef _MSC_VER @@ -7518,7 +7519,10 @@ key_using_alg: all_key_opt: KEY_BLOCK_SIZE opt_equal ulong_num - { Lex->last_key->key_create_info.block_size= $3; } + { + Lex->last_key->key_create_info.block_size= $3; + Lex->last_key->key_create_info.flags|= HA_USES_BLOCK_SIZE; + } | COMMENT_SYM TEXT_STRING_sys { Lex->last_key->key_create_info.comment= $2; } | IDENT_sys equal TEXT_STRING_sys diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 3cc7b585ea4..2d171496337 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -7351,7 +7351,10 @@ key_using_alg: all_key_opt: KEY_BLOCK_SIZE opt_equal ulong_num - { Lex->last_key->key_create_info.block_size= $3; } + { + Lex->create_info.used_fields|= HA_USES_BLOCK_SIZE; + Lex->create_info.key_block_size= $3; + } | COMMENT_SYM TEXT_STRING_sys { Lex->last_key->key_create_info.comment= $2; } | IDENT_sys equal TEXT_STRING_sys |
