Below is the list of changes that have just been committed into a local
5.0 repository of mydev. When mydev does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1958 05/11/15 18:28:59 ingo@stripped +12 -0
Merge mysql.com:/home/mydev/mysql-4.1-4100
into mysql.com:/home/mydev/mysql-5.0-5000
sql/sql_table.cc
1.285 05/11/15 18:28:48 ingo@stripped +0 -0
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Manual merge.
sql/sql_handler.cc
1.75 05/11/15 18:28:48 ingo@stripped +5 -7
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Manual merge.
sql/sql_base.cc
1.318 05/11/15 18:28:48 ingo@stripped +1 -2
Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
Manual merge.
sql/sql_select.cc
1.375 05/11/15 18:17:00 ingo@stripped +0 -0
Auto merged
sql/sql_class.cc
1.218 05/11/15 18:17:00 ingo@stripped +0 -0
Auto merged
sql/mysql_priv.h
1.368 05/11/15 18:16:59 ingo@stripped +0 -0
Auto merged
mysql-test/t/myisam.test
1.53 05/11/15 18:16:59 ingo@stripped +0 -0
Auto merged
mysql-test/t/handler.test
1.24 05/11/15 18:16:58 ingo@stripped +0 -0
Auto merged
mysql-test/t/fulltext.test
1.77 05/11/15 18:16:58 ingo@stripped +0 -0
Auto merged
mysql-test/r/myisam.result
1.71 05/11/15 18:16:58 ingo@stripped +0 -0
Auto merged
mysql-test/r/fulltext.result
1.81 05/11/15 18:16:58 ingo@stripped +0 -0
Auto merged
myisam/ft_parser.c
1.47 05/11/15 18:16:58 ingo@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: ingo
# Host: chilla.local
# Root: /home/mydev/mysql-5.0-5000/RESYNC
--- 1.46/myisam/ft_parser.c 2005-03-09 13:37:15 +01:00
+++ 1.47/myisam/ft_parser.c 2005-11-15 18:16:58 +01:00
@@ -196,8 +196,10 @@
for (word->pos=doc; doc<end; length++, mbl=my_mbcharlen(cs, *(uchar *)doc),
doc+=(mbl ? mbl : 1))
if (true_word_char(cs,*doc))
mwc= 0;
- else if (!misc_word_char(*doc) || mwc++)
+ else if (!misc_word_char(*doc) || mwc)
break;
+ else
+ mwc++;
word->len= (uint)(doc-word->pos) - mwc;
--- 1.367/sql/mysql_priv.h 2005-11-10 20:32:38 +01:00
+++ 1.368/sql/mysql_priv.h 2005-11-15 18:16:59 +01:00
@@ -890,7 +890,8 @@
bool mysql_ha_close(THD *thd, TABLE_LIST *tables);
bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
-int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags);
+int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
+ bool is_locked);
/* mysql_ha_flush mode_flags bits */
#define MYSQL_HA_CLOSE_FINAL 0x00
#define MYSQL_HA_REOPEN_ON_USAGE 0x01
--- 1.317/sql/sql_base.cc 2005-11-03 15:28:10 +01:00
+++ 1.318/sql/sql_base.cc 2005-11-15 18:28:48 +01:00
@@ -311,7 +311,8 @@
thd->proc_info="Flushing tables";
close_old_data_files(thd,thd->open_tables,1,1);
- mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL);
+ mysql_ha_flush(thd, tables, MYSQL_HA_REOPEN_ON_USAGE | MYSQL_HA_FLUSH_ALL,
+ TRUE);
bool found=1;
/* Wait until all threads has closed all the tables we had locked */
DBUG_PRINT("info",
@@ -1238,7 +1239,7 @@
/* close handler tables which are marked for flush */
if (thd->handler_tables)
- mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE);
+ mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE);
for (table=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ;
table && table->in_use ;
@@ -1642,7 +1643,7 @@
{
thd->some_tables_deleted=0;
close_old_data_files(thd,thd->open_tables,0,dropping_tables != 0);
- mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE);
+ mysql_ha_flush(thd, (TABLE_LIST*) NULL, MYSQL_HA_REOPEN_ON_USAGE, TRUE);
if (!table_is_used(thd->open_tables,1))
break;
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
--- 1.217/sql/sql_class.cc 2005-10-25 11:02:41 +02:00
+++ 1.218/sql/sql_class.cc 2005-11-15 18:17:00 +01:00
@@ -376,7 +376,7 @@
close_thread_tables(this);
}
mysql_ha_flush(this, (TABLE_LIST*) 0,
- MYSQL_HA_CLOSE_FINAL | MYSQL_HA_FLUSH_ALL);
+ MYSQL_HA_CLOSE_FINAL | MYSQL_HA_FLUSH_ALL, FALSE);
hash_free(&handler_tables_hash);
delete_dynamic(&user_var_events);
hash_free(&user_vars);
--- 1.374/sql/sql_select.cc 2005-11-03 20:35:16 +01:00
+++ 1.375/sql/sql_select.cc 2005-11-15 18:17:00 +01:00
@@ -11128,8 +11128,12 @@
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();
--- 1.284/sql/sql_table.cc 2005-11-09 08:12:54 +01:00
+++ 1.285/sql/sql_table.cc 2005-11-15 18:28:48 +01:00
@@ -232,7 +232,7 @@
char *db=table->db;
db_type table_type= DB_TYPE_UNKNOWN;
- mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL);
+ mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL, TRUE);
if (!close_temporary_table(thd, db, table->table_name))
{
tmp_table_deleted=1;
@@ -2171,7 +2171,7 @@
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
- mysql_ha_flush(thd, tables, MYSQL_HA_CLOSE_FINAL);
+ mysql_ha_flush(thd, tables, MYSQL_HA_CLOSE_FINAL, FALSE);
for (table= tables; table; table= table->next_local)
{
char table_name[NAME_LEN*2+2];
@@ -3127,8 +3127,9 @@
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);
- mysql_ha_flush(thd, table_list, MYSQL_HA_CLOSE_FINAL);
/* 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,
--- 1.80/mysql-test/r/fulltext.result 2005-08-12 17:04:47 +02:00
+++ 1.81/mysql-test/r/fulltext.result 2005-11-15 18:16:58 +01:00
@@ -429,4 +429,8 @@
Table Op Msg_type Msg_text
test.t1 repair status OK
SET myisam_repair_threads=@@global.myisam_repair_threads;
+INSERT INTO t1 VALUES('testword\'\'');
+SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
+a
+testword''
DROP TABLE t1;
--- 1.76/mysql-test/t/fulltext.test 2005-08-12 17:04:48 +02:00
+++ 1.77/mysql-test/t/fulltext.test 2005-11-15 18:16:58 +01:00
@@ -348,6 +348,12 @@
SET myisam_repair_threads=2;
REPAIR TABLE t1;
SET myisam_repair_threads=@@global.myisam_repair_threads;
+
+#
+# BUG#5686 - #1034 - Incorrect key file for table - only utf8
+#
+INSERT INTO t1 VALUES('testword\'\'');
+SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
DROP TABLE t1;
# End of 4.1 tests
--- 1.70/mysql-test/r/myisam.result 2005-11-08 09:22:47 +01:00
+++ 1.71/mysql-test/r/myisam.result 2005-11-15 18:16:58 +01:00
@@ -505,6 +505,16 @@
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;
--- 1.52/mysql-test/t/myisam.test 2005-11-08 09:22:47 +01:00
+++ 1.53/mysql-test/t/myisam.test 2005-11-15 18:16:59 +01:00
@@ -477,6 +477,18 @@
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
--- 1.23/mysql-test/t/handler.test 2005-09-01 17:27:00 +02:00
+++ 1.24/mysql-test/t/handler.test 2005-11-15 18:16:58 +01:00
@@ -347,4 +347,32 @@
drop table t4;
drop table t5;
+#
+# Bug#14397 - OPTIMIZE TABLE with an open HANDLER causes a crash
+#
+create table t1 (c1 int);
+insert into t1 values (1);
+# client 1
+handler t1 open;
+handler t1 read first;
+# client 2
+connect (con2,localhost,root,,);
+connection con2;
+--exec echo send the below to another connection, do not wait for the result
+send optimize table t1;
+--sleep 1
+# client 1
+--exec echo proceed with the normal connection
+connection default;
+handler t1 read next;
+handler t1 close;
+# client 2
+--exec echo read the result from the other connection
+connection con2;
+reap;
+# client 1
+--exec echo proceed with the normal connection
+connection default;
+drop table t1;
+
# End of 4.1 tests
--- 1.74/sql/sql_handler.cc 2005-09-15 01:56:03 +02:00
+++ 1.75/sql/sql_handler.cc 2005-11-15 18:28:48 +01:00
@@ -336,6 +336,7 @@
ha_rows select_limit_cnt, ha_rows offset_limit_cnt)
{
TABLE_LIST *hash_tables;
+ TABLE **table_ptr;
TABLE *table;
MYSQL_LOCK *lock;
List<Item> list;
@@ -368,6 +369,27 @@
DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p",
hash_tables->db, hash_tables->table_name,
hash_tables->alias, table));
+ /* Table might have been flushed. */
+ if (table && (table->version != refresh_version))
+ {
+ /*
+ We must follow the thd->handler_tables chain, as we need the
+ address of the 'next' pointer referencing this table
+ for close_thread_table().
+ */
+ for (table_ptr= &(thd->handler_tables);
+ *table_ptr && (*table_ptr != table);
+ table_ptr= &(*table_ptr)->next)
+ {}
+ VOID(pthread_mutex_lock(&LOCK_open));
+ if (close_thread_table(thd, table_ptr))
+ {
+ /* Tell threads waiting for refresh that something has happened */
+ VOID(pthread_cond_broadcast(&COND_refresh));
+ }
+ VOID(pthread_mutex_unlock(&LOCK_open));
+ table= hash_tables->table= NULL;
+ }
if (!table)
{
/*
@@ -594,6 +616,7 @@
MYSQL_HA_REOPEN_ON_USAGE mark for reopen.
MYSQL_HA_FLUSH_ALL flush all tables, not only
those marked for flush.
+ is_locked If LOCK_open is locked.
DESCRIPTION
The list of HANDLER tables may be NULL, in which case all HANDLER
@@ -601,7 +624,6 @@
If 'tables' is NULL and MYSQL_HA_FLUSH_ALL is not set,
all HANDLER tables marked for flush are closed.
Broadcasts a COND_refresh condition, for every table closed.
- The caller must lock LOCK_open.
NOTE
Since mysql_ha_flush() is called when the base table has to be closed,
@@ -611,10 +633,12 @@
0 ok
*/
-int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags)
+int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
+ bool is_locked)
{
TABLE_LIST *tmp_tables;
TABLE **table_ptr;
+ bool did_lock= FALSE;
DBUG_ENTER("mysql_ha_flush");
DBUG_PRINT("enter", ("tables: %p mode_flags: 0x%02x", tables, mode_flags));
@@ -640,6 +664,12 @@
(*table_ptr)->s->db,
(*table_ptr)->s->table_name,
(*table_ptr)->alias));
+ /* The first time it is required, lock for close_thread_table(). */
+ if (! did_lock && ! is_locked)
+ {
+ VOID(pthread_mutex_lock(&LOCK_open));
+ did_lock= TRUE;
+ }
mysql_ha_flush_table(thd, table_ptr, mode_flags);
continue;
}
@@ -658,6 +688,12 @@
if ((mode_flags & MYSQL_HA_FLUSH_ALL) ||
((*table_ptr)->s->version != refresh_version))
{
+ /* The first time it is required, lock for close_thread_table(). */
+ if (! did_lock && ! is_locked)
+ {
+ VOID(pthread_mutex_lock(&LOCK_open));
+ did_lock= TRUE;
+ }
mysql_ha_flush_table(thd, table_ptr, mode_flags);
continue;
}
@@ -665,6 +701,10 @@
}
}
+ /* Release the lock if it was taken by this function. */
+ if (did_lock)
+ VOID(pthread_mutex_unlock(&LOCK_open));
+
DBUG_RETURN(0);
}
@@ -696,8 +736,8 @@
table->alias, mode_flags));
if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
- (byte*) (*table_ptr)->alias,
- strlen((*table_ptr)->alias) + 1)))
+ (byte*) (*table_ptr)->alias,
+ strlen((*table_ptr)->alias) + 1)))
{
if (! (mode_flags & MYSQL_HA_REOPEN_ON_USAGE))
{
@@ -711,6 +751,7 @@
}
}
+ safe_mutex_assert_owner(&LOCK_open);
(*table_ptr)->file->ha_index_or_rnd_end();
if (close_thread_table(thd, table_ptr))
{
| Thread |
|---|
| • bk commit into 5.0 tree (ingo:1.1958) | ingo | 15 Nov |