diff options
-rw-r--r-- | include/my_list.h | 2 | ||||
-rw-r--r-- | myisam/myisampack.c | 8 | ||||
-rw-r--r-- | mysql-test/r/metadata.result | 11 | ||||
-rw-r--r-- | mysql-test/t/metadata.test | 12 | ||||
-rw-r--r-- | mysys/list.c | 2 | ||||
-rw-r--r-- | mysys/thr_lock.c | 3 | ||||
-rw-r--r-- | sql-common/client.c | 5 | ||||
-rw-r--r-- | sql/mysqld.cc | 6 | ||||
-rw-r--r-- | sql/sql_parse.cc | 13 | ||||
-rw-r--r-- | sql/sql_test.cc | 2 |
10 files changed, 48 insertions, 16 deletions
diff --git a/include/my_list.h b/include/my_list.h index f786621e311..92598696fc4 100644 --- a/include/my_list.h +++ b/include/my_list.h @@ -36,7 +36,7 @@ extern void list_free(LIST *root,unsigned int free_data); extern unsigned int list_length(LIST *); extern int list_walk(LIST *,list_walk_action action,gptr argument); -#define rest(a) ((a)->next) +#define list_rest(a) ((a)->next) #define list_push(a,b) (a)=list_cons((b),(a)) #define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); } diff --git a/myisam/myisampack.c b/myisam/myisampack.c index ba48cbf1b62..b3937ab9607 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -695,14 +695,22 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) else error=my_rename(new_name,org_name,MYF(MY_WME)); if (!error) + { VOID(my_copystat(temp_name,org_name,MYF(MY_COPYTIME))); + if (tmp_dir[0]) + VOID(my_delete(new_name,MYF(MY_WME))); + } } } else { if (tmp_dir[0]) + { error=my_copy(new_name,org_name, MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_COPYTIME)); + if (!error) + VOID(my_delete(new_name,MYF(MY_WME))); + } else error=my_redel(org_name,new_name,MYF(MY_WME | MY_COPYTIME)); } diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index dcd32bf477b..50b0b6ae294 100644 --- a/mysql-test/r/metadata.result +++ b/mysql-test/r/metadata.result @@ -85,3 +85,14 @@ def aaa 1 1 8 20 1 N 32769 0 63 1 1 drop table t1; +create table t1 (i int); +insert into t1 values (1),(2),(3); +select * from t1 where i = 2; +drop table t1;// +affected rows: 0 +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 0 +i +2 +affected rows: 1 +affected rows: 0 diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test index b4edd15f5ef..65338448555 100644 --- a/mysql-test/t/metadata.test +++ b/mysql-test/t/metadata.test @@ -49,4 +49,16 @@ drop table t1; --disable_metadata +# +# Bug #11688: Bad mysql_info() results in multi-results +# +--enable_info +delimiter //; +create table t1 (i int); +insert into t1 values (1),(2),(3); +select * from t1 where i = 2; +drop table t1;// +delimiter ;// +--disable_info + # End of 4.1 tests diff --git a/mysys/list.c b/mysys/list.c index c3cd6c94b9f..0e55c9399f5 100644 --- a/mysys/list.c +++ b/mysys/list.c @@ -109,7 +109,7 @@ int list_walk(LIST *list, list_walk_action action, gptr argument) { if ((error = (*action)(list->data,argument))) return error; - list=rest(list); + list=list_rest(list); } return 0; } diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index c076e8934ad..41266d61b0a 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -1206,7 +1206,8 @@ void thr_print_locks(void) pthread_mutex_lock(&THR_LOCK_lock); puts("Current locks:"); - for (list=thr_lock_thread_list ; list && count++ < MAX_THREADS ; list=rest(list)) + for (list= thr_lock_thread_list; list && count++ < MAX_THREADS; + list= list_rest(list)) { THR_LOCK *lock=(THR_LOCK*) list->data; VOID(pthread_mutex_lock(&lock->mutex)); diff --git a/sql-common/client.c b/sql-common/client.c index 4ec919553c6..993978f132f 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -713,8 +713,9 @@ void free_old_query(MYSQL *mysql) if (mysql->fields) free_root(&mysql->field_alloc,MYF(0)); init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */ - mysql->fields=0; - mysql->field_count=0; /* For API */ + mysql->fields= 0; + mysql->field_count= 0; /* For API */ + mysql->info= 0; DBUG_VOID_RETURN; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 008aeaf87c5..e58fa669130 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -714,7 +714,6 @@ static void close_connections(void) } #endif end_thr_alarm(0); // Abort old alarms. - end_slave(); /* First signal all threads that it's time to die @@ -730,6 +729,9 @@ static void close_connections(void) { DBUG_PRINT("quit",("Informing thread %ld that it's time to die", tmp->thread_id)); + /* We skip slave threads on this first loop through. */ + if (tmp->slave_thread) continue; + tmp->killed= THD::KILL_CONNECTION; if (tmp->mysys_var) { @@ -746,6 +748,8 @@ static void close_connections(void) } (void) pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list + end_slave(); + if (thread_count) sleep(2); // Give threads time to die diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index eb54c44fa47..00553825226 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2328,16 +2328,11 @@ mysql_execute_command(THD *thd) /* Skip if we are in the slave thread, some table rules have been given and the table list says the query should not be replicated. - - Exceptions are: - - - SET: we always execute it (e.g., SET ONE_SHOT TIME_ZONE = 'XYZ') - - - DROP TEMPORARY TABLE IF EXISTS: we always execute it (otherwise we - have stale files on slave caused by exclusion of one tmp table). + Exception is DROP TEMPORARY TABLE IF EXISTS: we always execute it + (otherwise we have stale files on slave caused by exclusion of one tmp + table). */ - if (lex->sql_command != SQLCOM_SET_OPTION && - !(lex->sql_command == SQLCOM_DROP_TABLE && + if (!(lex->sql_command == SQLCOM_DROP_TABLE && lex->drop_temporary && lex->drop_if_exists) && all_tables_not_ok(thd, all_tables)) { diff --git a/sql/sql_test.cc b/sql/sql_test.cc index 722568e7f53..ddd0f3fe162 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -370,7 +370,7 @@ static void display_table_locks(void) VOID(my_init_dynamic_array(&saved_table_locks,sizeof(TABLE_LOCK_INFO),open_cache.records + 20,50)); VOID(pthread_mutex_lock(&THR_LOCK_lock)); - for (list=thr_lock_thread_list ; list ; list=rest(list)) + for (list= thr_lock_thread_list; list; list= list_rest(list)) { THR_LOCK *lock=(THR_LOCK*) list->data; |