diff options
author | unknown <monty@donna.mysql.com> | 2000-08-29 12:31:01 +0300 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-08-29 12:31:01 +0300 |
commit | 52046a7ba3c00111bf27195197b486a9ef558416 (patch) | |
tree | 8c9e3c031400ac400edcf6561fe51f4bdbd69369 /sql/sql_base.cc | |
parent | 844c92364e04fb17371c4a71dee52f179f8ad253 (diff) | |
download | mariadb-git-52046a7ba3c00111bf27195197b486a9ef558416.tar.gz |
Bug fixes for 3.23.23
myisam/mi_debug.c:
***MISSING WEAVE***
Docs/internals.texi:
Added coding guidelines
Docs/manual.texi:
Changelog update + Win32 -> Windows
client/mysql.cc:
Changed --no-named-commands to be on by default
client/mysqlimport.c:
Bug fix
include/config-win.h:
Update of supported functions
include/global.h:
Removed compiler warning
libmysql/libmysql.c:
Fix for Ia64
myisam/ChangeLog:
Changelog
myisam/Makefile.am:
Added file mi_dbug.c
myisam/ft_stopwords.c:
Fix for Ia64
myisam/mi_delete_table.c:
Extra debugging
myisam/mi_rename.c:
Extra debugging
myisam/mi_rnext.c:
Fixed bug with MIN and concurrent insert
myisam/mi_rprev.c:
Fixed bug with MAX and concurrent insert
myisam/mi_search.c:
Fixed bug with DECIMAL/NUMERIC keys
myisam/myisamdef.h:
Extra debugging
scripts/make_binary_distribution.sh:
Added thread safe mysql library
sql/ha_heap.cc:
Fix of HEAP bug with range keys
sql/ha_heap.h:
Fix of HEAP bug with range keys
sql/handler.cc:
Optimizing
sql/handler.h:
Optimizing
sql/lock.cc:
More DEBUG + fix of RENAME bug
sql/mini_client.cc:
Fix for Ia64
sql/mysql_priv.h:
Fix for name locks
sql/mysqld.cc:
Shorter message if wrong options
sql/opt_range.cc:
Added TODO
sql/sql_base.cc:
Fix for DROP TABLE
sql/sql_parse.cc:
Fix of permission checking for CHECK TABLE
sql/sql_select.cc:
Fix of using LEFT JOIN with empty table
sql/table.h:
Fix for name locks
tests/fork_test.pl:
Fixed typo
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r-- | sql/sql_base.cc | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc index e6468890ed6..1ccd009de07 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -582,9 +582,8 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, thd->mysys_var->current_cond= &COND_refresh; thd->proc_info="Flushing tables"; pthread_mutex_unlock(&thd->mysys_var->mutex); - VOID(pthread_cond_broadcast(&COND_refresh)); // If one flush is locked - close_old_data_files(thd,thd->open_tables,1); + close_old_data_files(thd,thd->open_tables,1,1); bool found=1; /* Wait until all threads has closed all the tables we had locked */ DBUG_PRINT("info", ("Waiting for others threads to close their open tables")); @@ -921,7 +920,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, ** There is a refresh in progress for this table ** Wait until the table is freed or the thread is killed. */ - close_old_data_files(thd,thd->open_tables,0); + close_old_data_files(thd,thd->open_tables,0,0); if (table->in_use != thd) wait_for_refresh(thd); else @@ -1216,9 +1215,11 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh) abort_locks is set if called from flush_tables. */ -void close_old_data_files(THD *thd, TABLE *table, bool abort_locks) +void close_old_data_files(THD *thd, TABLE *table, bool abort_locks, + bool send_refresh) { - bool found=0; + DBUG_ENTER("close_old_data_files"); + bool found=send_refresh; for (; table ; table=table->next) { if (table->version != refresh_version) @@ -1241,6 +1242,7 @@ void close_old_data_files(THD *thd, TABLE *table, bool abort_locks) } if (found) VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh + DBUG_VOID_RETURN; } @@ -1250,17 +1252,19 @@ void close_old_data_files(THD *thd, TABLE *table, bool abort_locks) if the table is closed */ -bool table_is_used(TABLE *table) +bool table_is_used(TABLE *table, bool wait_for_name_lock) { do { char *key= table->table_cache_key; uint key_length=table->key_length; - for (TABLE *search=(TABLE*) hash_search(&open_cache,(byte*) key,key_length) ; + for (TABLE *search=(TABLE*) hash_search(&open_cache, + (byte*) key,key_length) ; search ; search = (TABLE*) hash_next(&open_cache,(byte*) key,key_length)) { if (search->locked_by_flush || + search->locked_by_name && wait_for_name_lock || search->db_stat && search->version < refresh_version) return 1; // Table is used } @@ -1278,19 +1282,14 @@ bool wait_for_tables(THD *thd) thd->proc_info="Waiting for tables"; pthread_mutex_lock(&LOCK_open); - thd->some_tables_deleted=0; - close_old_data_files(thd,thd->open_tables,0); - if (dropping_tables) - { - (void) pthread_cond_broadcast(&COND_refresh); // Signal to refresh/delete - (void) pthread_cond_wait(&COND_refresh,&LOCK_open); - } - - while (table_is_used(thd->open_tables) && ! thd->killed) + while (!thd->killed) { + thd->some_tables_deleted=0; + close_old_data_files(thd,thd->open_tables,0,dropping_tables != 0); + if (!table_is_used(thd->open_tables,1)) + break; (void) pthread_cond_wait(&COND_refresh,&LOCK_open); } - if (thd->killed) result= 1; // aborted else |