diff options
author | unknown <ingo@mysql.com> | 2005-11-16 10:23:42 +0100 |
---|---|---|
committer | unknown <ingo@mysql.com> | 2005-11-16 10:23:42 +0100 |
commit | eb71b12996b9e6973fbb31fca7ae78e4b3d51b80 (patch) | |
tree | abec561c32aa740ef8db20cd3d1be05ef97c42b8 | |
parent | 813916f37f5022270a0054b44f617deba51cb34d (diff) | |
parent | 264018e255b74930da24420ea75932a28a25c7da (diff) | |
download | mariadb-git-eb71b12996b9e6973fbb31fca7ae78e4b3d51b80.tar.gz |
Merge mysql.com:/home/mydev/mysql-4.1-4100
into mysql.com:/home/mydev/mysql-5.0-5000
mysql-test/r/handler.result:
Auto merged
mysql-test/r/myisam.result:
Auto merged
mysql-test/t/handler.test:
Auto merged
mysql-test/t/myisam.test:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/mysql_priv.h:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Manual merge.
sql/sql_base.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Manual merge.
sql/sql_handler.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Manual merge.
sql/sql_table.cc:
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Manual merge.
-rw-r--r-- | mysql-test/r/myisam.result | 10 | ||||
-rw-r--r-- | mysql-test/t/myisam.test | 12 | ||||
-rw-r--r-- | sql/sql_handler.cc | 5 | ||||
-rw-r--r-- | sql/sql_select.cc | 8 | ||||
-rw-r--r-- | sql/sql_table.cc | 3 |
5 files changed, 33 insertions, 5 deletions
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 7da55b66376..e000cfd9c11 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -505,6 +505,16 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary 1 SIMPLE t2 index NULL PRIMARY 4 NULL 2 Using index; Distinct drop table t1,t2; +create table t1 ( +c1 varchar(32), +key (c1) +) engine=myisam; +alter table t1 disable keys; +insert into t1 values ('a'), ('b'); +select c1 from t1 order by c1 limit 1; +c1 +a +drop table t1; CREATE TABLE t1 (`a` int(11) NOT NULL default '0', `b` int(11) NOT NULL default '0', UNIQUE KEY `a` USING RTREE (`a`,`b`)) ENGINE=MyISAM; Got one of the listed errors create table t1 (a int, b varchar(200), c text not null) checksum=1; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index d510ef66677..fb90c16bb86 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -477,6 +477,18 @@ explain select distinct t1.a from t1,t2 order by t2.a; drop table t1,t2; # +# Bug#14616 - Freshly imported table returns error 124 when using LIMIT +# +create table t1 ( + c1 varchar(32), + key (c1) +) engine=myisam; +alter table t1 disable keys; +insert into t1 values ('a'), ('b'); +select c1 from t1 order by c1 limit 1; +drop table t1; + +# # Test RTREE index # --error 1235, 1289 diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 07f4de26707..da72d283259 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -737,8 +737,8 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags) table->alias, mode_flags)); if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash, - (byte*) table->alias, - strlen(table->alias) + 1))) + (byte*) table->alias, + strlen(table->alias) + 1))) { if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE)) { @@ -752,6 +752,7 @@ static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags) } } + safe_mutex_assert_owner(&LOCK_open); (*table_ptr)->file->ha_index_or_rnd_end(); safe_mutex_assert_owner(&LOCK_open); if (close_thread_table(thd, table_ptr)) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b65e25335fc..ae40a81643f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -11128,8 +11128,12 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, DBUG_ENTER("test_if_skip_sort_order"); LINT_INIT(ref_key_parts); - /* Check which keys can be used to resolve ORDER BY */ - usable_keys.set_all(); + /* + Check which keys can be used to resolve ORDER BY. + We must not try to use disabled keys. + */ + usable_keys= table->keys_in_use; + for (ORDER *tmp_order=order; tmp_order ; tmp_order=tmp_order->next) { Item *item= (*tmp_order->item)->real_item(); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0d6ef9bb767..815cdfe6cc5 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3132,8 +3132,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, if (!new_db || !my_strcasecmp(table_alias_charset, new_db, db)) new_db= db; used_fields=create_info->used_fields; - + mysql_ha_flush(thd, table_list, MYSQL_HA_CLOSE_FINAL, FALSE); + /* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */ if (alter_info->tablespace_op != NO_TABLESPACE_OP) DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list, |