diff options
-rw-r--r-- | include/maria.h | 2 | ||||
-rw-r--r-- | include/myisam.h | 2 | ||||
-rw-r--r-- | mysql-test/r/mysql.result | 2 | ||||
-rw-r--r-- | mysql-test/r/subselect4.result | 35 | ||||
-rw-r--r-- | mysql-test/t/mysql.test | 2 | ||||
-rw-r--r-- | mysql-test/t/subselect4.test | 24 | ||||
-rw-r--r-- | sql/mysql_priv.h | 3 | ||||
-rw-r--r-- | sql/mysqld.cc | 9 | ||||
-rw-r--r-- | sql/records.cc | 18 | ||||
-rw-r--r-- | sql/share/errmsg.txt | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 29 | ||||
-rw-r--r-- | sql/sql_show.cc | 4 | ||||
-rw-r--r-- | sql/structs.h | 2 | ||||
-rw-r--r-- | storage/maria/ha_maria.cc | 11 | ||||
-rw-r--r-- | storage/maria/ha_maria.h | 1 | ||||
-rw-r--r-- | storage/maria/ma_check.c | 3 | ||||
-rw-r--r-- | storage/maria/ma_create.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_info.c | 6 | ||||
-rw-r--r-- | storage/maria/ma_open.c | 2 | ||||
-rw-r--r-- | storage/maria/maria_def.h | 2 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.cc | 8 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.h | 2 |
22 files changed, 138 insertions, 35 deletions
diff --git a/include/maria.h b/include/maria.h index 470f76669f3..ff83bb238e0 100644 --- a/include/maria.h +++ b/include/maria.h @@ -466,6 +466,8 @@ void maria_change_pagecache(PAGECACHE *old_key_cache, int maria_preload(MARIA_HA *info, ulonglong key_map, my_bool ignore_leaves); void maria_versioning(MARIA_HA *info, my_bool versioning); void maria_ignore_trids(MARIA_HA *info); +uint maria_max_key_length(void); +#define maria_max_key_segments() HA_MAX_KEY_SEG /* fulltext functions */ FT_INFO *maria_ft_init_search(uint,void *, uint, uchar *, size_t, diff --git a/include/myisam.h b/include/myisam.h index 9fc17fdf2d6..736a49fd9ad 100644 --- a/include/myisam.h +++ b/include/myisam.h @@ -298,6 +298,8 @@ extern ulong _mi_calc_blob_length(uint length , const uchar *pos); extern uint mi_get_pointer_length(ulonglong file_length, uint def); extern int mi_make_backup_of_index(struct st_myisam_info *info, time_t backup_time, myf flags); +#define myisam_max_key_length() HA_MAX_KEY_LENGTH +#define myisam_max_key_segments() HA_MAX_KEY_SEG #define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for mmap file */ /* this is used to pass to mysql_myisamchk_table */ diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 32052ddfd02..895fb5f3761 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2,t3; create table t1(a int); insert into t1 values(1); ERROR at line 9: DELIMITER must be followed by a 'delimiter' character or string diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result index 386ae0bdbde..bdc04ca2a11 100644 --- a/mysql-test/r/subselect4.result +++ b/mysql-test/r/subselect4.result @@ -2104,3 +2104,38 @@ NULL deallocate prepare st1; drop table t1, t2, t3; set optimizer_switch=@subselect4_tmp; +# +# LP bug #879939: assertion in ha_maria::enable_indexes with derived_with_keys=on +# +CREATE TABLE t2 ( a varchar(3)) ; +INSERT INTO t2 VALUES ('USA'),('USA'),('USA'),('USA'),('USA'); +CREATE TABLE t1 ( a varchar(3), b varchar(35)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('USA','Lansing'),('USA','Laredo'),('USA','Las Vegas'),('USA','Lexington-Fayett'),('USA','Lincoln'),('USA','Little Rock'),('USA','Livonia'),('USA','Long Beach'),('USA','Los Angeles'),('USA','Louisville'),('USA','Lowell'),('USA','Lubbock'),('USA','Macon'),('USA','Madison'),('USA','Manchester'),('USA','McAllen'),('USA','Memphis'),('USA','Mesa'),('USA','Mesquite'),('USA','Metairie'),('USA','Miami'); +CREATE TABLE t3 ( a varchar(35)) ENGINE=MyISAM; +INSERT INTO t3 VALUES ('Miami'); +SET optimizer_switch = 'derived_with_keys=on'; +SET @@tmp_table_size=1024*4; +explain SELECT * FROM (SELECT t1.* FROM t1, t2 ) AS alias1 JOIN t3 ON ( t3.a = alias1.b ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t3 system NULL NULL NULL NULL 1 +1 PRIMARY <derived2> ref key0 key0 39 const 10 +2 DERIVED t2 ALL NULL NULL NULL NULL 5 +2 DERIVED t1 ALL NULL NULL NULL NULL 21 Using join buffer (flat, BNL join) +SELECT * FROM (SELECT t1.* FROM t1, t2 ) AS alias1 JOIN t3 ON ( t3.a = alias1.b ); +a b a +USA Miami Miami +USA Miami Miami +USA Miami Miami +USA Miami Miami +USA Miami Miami +SET @@tmp_table_size=1024*1024*16; +SELECT * FROM (SELECT t1.* FROM t1, t2 ) AS alias1 JOIN t3 ON ( t3.a = alias1.b ); +a b a +USA Miami Miami +USA Miami Miami +USA Miami Miami +USA Miami Miami +USA Miami Miami +drop table t1,t2,t3; +SET optimizer_switch= @@global.optimizer_switch; +set @@tmp_table_size= @@global.tmp_table_size; diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 4efd7c7636d..d1dd648d5c7 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -6,7 +6,7 @@ # --disable_warnings -drop table if exists t1; +drop table if exists t1,t2,t3; --enable_warnings # diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index b789521be8d..152dec512a8 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -1735,3 +1735,27 @@ deallocate prepare st1; drop table t1, t2, t3; set optimizer_switch=@subselect4_tmp; + +--echo # +--echo # LP bug #879939: assertion in ha_maria::enable_indexes with derived_with_keys=on +--echo # + +CREATE TABLE t2 ( a varchar(3)) ; +INSERT INTO t2 VALUES ('USA'),('USA'),('USA'),('USA'),('USA'); +CREATE TABLE t1 ( a varchar(3), b varchar(35)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('USA','Lansing'),('USA','Laredo'),('USA','Las Vegas'),('USA','Lexington-Fayett'),('USA','Lincoln'),('USA','Little Rock'),('USA','Livonia'),('USA','Long Beach'),('USA','Los Angeles'),('USA','Louisville'),('USA','Lowell'),('USA','Lubbock'),('USA','Macon'),('USA','Madison'),('USA','Manchester'),('USA','McAllen'),('USA','Memphis'),('USA','Mesa'),('USA','Mesquite'),('USA','Metairie'),('USA','Miami'); + +CREATE TABLE t3 ( a varchar(35)) ENGINE=MyISAM; +INSERT INTO t3 VALUES ('Miami'); + +SET optimizer_switch = 'derived_with_keys=on'; +SET @@tmp_table_size=1024*4; + +explain SELECT * FROM (SELECT t1.* FROM t1, t2 ) AS alias1 JOIN t3 ON ( t3.a = alias1.b ); +SELECT * FROM (SELECT t1.* FROM t1, t2 ) AS alias1 JOIN t3 ON ( t3.a = alias1.b ); +SET @@tmp_table_size=1024*1024*16; +SELECT * FROM (SELECT t1.* FROM t1, t2 ) AS alias1 JOIN t3 ON ( t3.a = alias1.b ); + +drop table t1,t2,t3; +SET optimizer_switch= @@global.optimizer_switch; +set @@tmp_table_size= @@global.tmp_table_size; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 903f8bd82ff..302a8af7dd3 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2181,6 +2181,9 @@ extern uint test_flags,select_errors,ha_open_options; extern uint protocol_version, mysqld_port, mysqld_extra_port, dropping_tables; extern uint delay_key_write_options; extern ulong max_long_data_size; +extern uint internal_tmp_table_max_key_length; +extern uint internal_tmp_table_max_key_segments; + #endif /* MYSQL_SERVER */ #if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS extern MYSQL_PLUGIN_IMPORT uint lower_case_table_names; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index df0de7e25b1..57c2fa42ab8 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -669,6 +669,10 @@ ulong extra_max_connections; */ ulong max_long_data_size; +/* Limits for internal temporary tables (MyISAM or Aria) */ +uint internal_tmp_table_max_key_length; +uint internal_tmp_table_max_key_segments; + int max_user_connections= 0; bool max_user_connections_checking=0; ulonglong denied_connections; @@ -4464,6 +4468,11 @@ a file name for --log-bin-index option", opt_binlog_index_name); sql_print_error("Aria engine is not enabled or did not start. The Aria engine must be enabled to continue as mysqld was configured with --with-aria-tmp-tables"); unireg_abort(1); } + internal_tmp_table_max_key_length= maria_max_key_length(); + internal_tmp_table_max_key_segments= maria_max_key_segments(); +#else + internal_tmp_table_max_key_length= myisam_max_key_length(); + internal_tmp_table_max_key_segments= myisam_max_key_segments(); #endif tc_log= (total_ha_2pc > 1 ? (opt_bin_log ? diff --git a/sql/records.cc b/sql/records.cc index 60c801f8977..b125c201621 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -59,7 +59,6 @@ void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, bzero((char*) info,sizeof(*info)); info->thd= thd; info->table= table; - info->file= table->file; info->record= table->record[0]; info->print_error= print_error; info->unlock_row= rr_unlock_row; @@ -169,7 +168,6 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table, bzero((char*) info,sizeof(*info)); info->thd=thd; info->table=table; - info->file= table->file; info->forms= &info->table; /* Only one table */ if (table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE && @@ -291,9 +289,9 @@ void end_read_record(READ_RECORD *info) { filesort_free_buffers(info->table,0); if (info->table->created) - (void) info->file->extra(HA_EXTRA_NO_CACHE); + (void) info->table->file->extra(HA_EXTRA_NO_CACHE); if (info->read_record != rr_quick) // otherwise quick_range does it - (void) info->file->ha_index_or_rnd_end(); + (void) info->table->file->ha_index_or_rnd_end(); info->table=0; } } @@ -352,7 +350,7 @@ static int rr_quick(READ_RECORD *info) static int rr_index_first(READ_RECORD *info) { - int tmp= info->file->ha_index_first(info->record); + int tmp= info->table->file->ha_index_first(info->record); info->read_record= rr_index; if (tmp) tmp= rr_handle_error(info, tmp); @@ -378,7 +376,7 @@ static int rr_index_first(READ_RECORD *info) static int rr_index(READ_RECORD *info) { - int tmp= info->file->ha_index_next(info->record); + int tmp= info->table->file->ha_index_next(info->record); if (tmp) tmp= rr_handle_error(info, tmp); return tmp; @@ -388,7 +386,7 @@ static int rr_index(READ_RECORD *info) int rr_sequential(READ_RECORD *info) { int tmp; - while ((tmp= info->file->ha_rnd_next(info->record))) + while ((tmp= info->table->file->ha_rnd_next(info->record))) { /* rnd_next can return RECORD_DELETED for MyISAM when one thread is @@ -413,7 +411,7 @@ static int rr_from_tempfile(READ_RECORD *info) { if (my_b_read(info->io_cache,info->ref_pos,info->ref_length)) return -1; /* End of file */ - if (!(tmp= info->file->ha_rnd_pos(info->record,info->ref_pos))) + if (!(tmp= info->table->file->ha_rnd_pos(info->record,info->ref_pos))) break; /* The following is extremely unlikely to happen */ if (tmp == HA_ERR_RECORD_DELETED || @@ -464,7 +462,7 @@ static int rr_from_pointers(READ_RECORD *info) cache_pos= info->cache_pos; info->cache_pos+= info->ref_length; - if (!(tmp= info->file->ha_rnd_pos(info->record,cache_pos))) + if (!(tmp= info->table->file->ha_rnd_pos(info->record,cache_pos))) break; /* The following is extremely unlikely to happen */ @@ -597,7 +595,7 @@ static int rr_from_cache(READ_RECORD *info) record=uint3korr(position); position+=3; record_pos=info->cache+record*info->reclength; - if ((error=(int16) info->file->ha_rnd_pos(record_pos,info->ref_pos))) + if ((error=(int16) info->table->file->ha_rnd_pos(record_pos,info->ref_pos))) { record_pos[info->error_offset]=1; shortstore(record_pos,error); diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 5f6931ab155..035267b0b5d 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -6292,3 +6292,7 @@ ER_VIEW_ORDERBY_IGNORED eng "View '%-.192s'.'%-.192s' ORDER BY clause ignored because there is other ORDER BY clause already." ER_CONNECTION_KILLED 70100 eng "Connection was killed" +ER_INTERNAL_ERROR + eng "Internal error: '%-.192s'" + + diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 71d3137f1c0..af7cd3c0a7a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8675,7 +8675,7 @@ void set_join_cache_denial(JOIN_TAB *join_tab) void rr_unlock_row(st_join_table *tab) { READ_RECORD *info= &tab->read_record; - info->file->unlock_row(); + info->table->file->unlock_row(); } @@ -9349,7 +9349,6 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after) TABLE *table=tab->table; uint jcl= tab->used_join_cache_level; tab->read_record.table= table; - tab->read_record.file=table->file; tab->read_record.unlock_row= rr_unlock_row; tab->sorted= sorted; sorted= 0; // only first must be sorted @@ -14172,6 +14171,13 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo, keyinfo->key_parts > table->file->max_key_parts() || share->uniques) { + if (!share->uniques && !(keyinfo->flags & HA_NOSAME)) + { + my_error(ER_INTERNAL_ERROR, MYF(0), + "Using too big key for internal temp tables"); + DBUG_RETURN(1); + } + /* Can't create a key; Make a unique constraint instead of a key */ share->keys= 0; share->uniques= 1; @@ -14190,9 +14196,9 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo, } else { - /* Create an unique key */ + /* Create a key */ bzero((char*) &keydef,sizeof(keydef)); - keydef.flag=HA_NOSAME; + keydef.flag= keyinfo->flags & HA_NOSAME; keydef.keysegs= keyinfo->key_parts; keydef.seg= seg; } @@ -14368,7 +14374,8 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo, { /* Create an unique key */ bzero((char*) &keydef,sizeof(keydef)); - keydef.flag=HA_NOSAME | HA_BINARY_PACK_KEY | HA_PACK_KEY; + keydef.flag= ((keyinfo->flags & HA_NOSAME) | HA_BINARY_PACK_KEY | + HA_PACK_KEY); keydef.keysegs= keyinfo->key_parts; keydef.seg= seg; } @@ -15711,7 +15718,7 @@ int join_read_key2(THD *thd, JOIN_TAB *tab, TABLE *table, TABLE_REF *table_ref) */ if (tab && tab->ref.has_record && tab->ref.use_count == 0) { - tab->read_record.file->unlock_row(); + tab->read_record.table->file->unlock_row(); table_ref->has_record= FALSE; } error=table->file->ha_index_read_map(table->record[0], @@ -15897,7 +15904,7 @@ join_init_quick_read_record(JOIN_TAB *tab) int init_read_record_seq(JOIN_TAB *tab) { tab->read_record.read_record= rr_sequential; - if (tab->read_record.file->ha_rnd_init_with_error(1)) + if (tab->read_record.table->file->ha_rnd_init_with_error(1)) return 1; return (*tab->read_record.read_record)(&tab->read_record); } @@ -15964,7 +15971,6 @@ join_read_first(JOIN_TAB *tab) tab->table->status=0; tab->read_record.read_record=join_read_next; tab->read_record.table=table; - tab->read_record.file=table->file; tab->read_record.index=tab->index; tab->read_record.record=table->record[0]; if (!table->file->inited) @@ -15985,7 +15991,7 @@ static int join_read_next(READ_RECORD *info) { int error; - if ((error= info->file->ha_index_next(info->record))) + if ((error= info->table->file->ha_index_next(info->record))) return report_error(info->table, error); return 0; @@ -16003,7 +16009,6 @@ join_read_last(JOIN_TAB *tab) tab->table->status=0; tab->read_record.read_record=join_read_prev; tab->read_record.table=table; - tab->read_record.file=table->file; tab->read_record.index=tab->index; tab->read_record.record=table->record[0]; if (!table->file->inited) @@ -16021,7 +16026,7 @@ static int join_read_prev(READ_RECORD *info) { int error; - if ((error= info->file->ha_index_prev(info->record))) + if ((error= info->table->file->ha_index_prev(info->record))) return report_error(info->table, error); return 0; } @@ -16055,7 +16060,7 @@ static int join_ft_read_next(READ_RECORD *info) { int error; - if ((error= info->file->ha_ft_read(info->table->record[0]))) + if ((error= info->table->file->ha_ft_read(info->table->record[0]))) return report_error(info->table, error); return 0; } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 41e1734f346..c7cd692000f 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -6747,11 +6747,11 @@ bool get_schema_tables_result(JOIN *join, { result= 1; join->error= 1; - tab->read_record.file= table_list->table->file; + tab->read_record.table->file= table_list->table->file; table_list->schema_table_state= executed_place; break; } - tab->read_record.file= table_list->table->file; + tab->read_record.table->file= table_list->table->file; table_list->schema_table_state= executed_place; } } diff --git a/sql/structs.h b/sql/structs.h index 18f90d5b8b1..61354cbd01c 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -149,7 +149,7 @@ struct READ_RECORD { /* Parameter to read_record */ typedef int (*Read_func)(READ_RECORD*); typedef void (*Unlock_row_func)(st_join_table *); struct st_table *table; /* Head-form */ - handler *file; + // handler *file_; struct st_table **forms; /* head and ref forms */ Read_func read_record; diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index e65ac7e443c..12c291ac99d 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -935,8 +935,7 @@ double ha_maria::scan_time() uint ha_maria::max_supported_key_length() const { - uint tmp= (maria_max_key_length() - 8 - HA_MAX_KEY_SEG*3); - return min(HA_MAX_KEY_BUFF, tmp); + return maria_max_key_length(); } @@ -2601,6 +2600,14 @@ void ha_maria::drop_table(const char *name) } +void ha_maria::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) +{ + handler::change_table_ptr(table_arg, share); + if (file) + file->external_ref= table_arg; +} + + int ha_maria::external_lock(THD *thd, int lock_type) { DBUG_ENTER("ha_maria::external_lock"); diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index 0ba134a5b45..26b616e9682 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -77,6 +77,7 @@ public: { return max_supported_key_length(); } enum row_type get_row_type() const; uint checksum() const; + void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share); virtual double scan_time(); int open(const char *name, int mode, uint test_if_locked); diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 689786cab21..637303d1547 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -5671,7 +5671,8 @@ static my_off_t get_record_for_key(MARIA_KEYDEF *keyinfo, MARIA_KEY key; key.keyinfo= keyinfo; key.data= (uchar*) key_data; - key.data_length= _ma_keylength(keyinfo, key_data); + key.data_length= (_ma_keylength(keyinfo, key_data) - + keyinfo->share->rec_reflength); return _ma_row_pos_from_key(&key); } /* get_record_for_key */ diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index ea9671d4b07..b773e930e82 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -623,7 +623,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, to be able to put at least 2 keys on an index block for the key algorithms to work). */ - if (length > maria_max_key_length()) + if (length > _ma_max_key_length()) { my_errno=HA_WRONG_CREATE_OPTION; goto err_no_lock; diff --git a/storage/maria/ma_info.c b/storage/maria/ma_info.c index 1bbfa3cbf7e..af0e46ee239 100644 --- a/storage/maria/ma_info.c +++ b/storage/maria/ma_info.c @@ -28,6 +28,12 @@ MARIA_RECORD_POS maria_position(MARIA_HA *info) } +uint maria_max_key_length() +{ + uint tmp= (_ma_max_key_length() - 8 - HA_MAX_KEY_SEG*3); + return min(HA_MAX_KEY_BUFF, tmp); +} + /* Get information about the table */ /* if flag == 2 one get current info (no sync from database */ diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index de1daa544b7..a7287e75127 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -468,7 +468,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) } key_parts+=fulltext_keys*FT_SEGS; - if (share->base.max_key_length > maria_max_key_length() || + if (share->base.max_key_length > _ma_max_key_length() || keys > MARIA_MAX_KEY || key_parts > MARIA_MAX_KEY * HA_MAX_KEY_SEG) { DBUG_PRINT("error",("Wrong key info: Max_key_length: %d keys: %d key_parts: %d", share->base.max_key_length, keys, key_parts)); diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 392e0f8d95c..d21d438d64b 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -747,7 +747,7 @@ struct st_maria_handler { length=mi_uint2korr((key)+1)+3; } \ } -#define maria_max_key_length() ((maria_block_size - MAX_KEYPAGE_HEADER_SIZE)/3 - MARIA_INDEX_OVERHEAD_SIZE) +#define _ma_max_key_length() ((maria_block_size - MAX_KEYPAGE_HEADER_SIZE)/3 - MARIA_INDEX_OVERHEAD_SIZE) #define get_pack_length(length) ((length) >= 255 ? 3 : 1) #define _ma_have_versioning(info) ((info)->row_flag & ROW_FLAG_TRANSID) diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index e6ad635c885..84c16caebe1 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -551,7 +551,6 @@ my_bool mi_killed_in_mariadb(MI_INFO *info) } - ha_myisam::ha_myisam(handlerton *hton, TABLE_SHARE *table_arg) :handler(hton, table_arg), file(0), int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER | @@ -2005,6 +2004,13 @@ int ha_myisam::delete_table(const char *name) return mi_delete_table(name); } +void ha_myisam::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) +{ + handler::change_table_ptr(table_arg, share); + if (file) + file->external_ref= table_arg; +} + int ha_myisam::external_lock(THD *thd, int lock_type) { diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index f895a5bf449..e25cbee03e6 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -68,7 +68,7 @@ class ha_myisam: public handler uint max_supported_key_length() const { return HA_MAX_KEY_LENGTH; } uint max_supported_key_part_length() const { return HA_MAX_KEY_LENGTH; } uint checksum() const; - + void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share); int open(const char *name, int mode, uint test_if_locked); int close(void); int write_row(uchar * buf); |