Commit ca3cecf8 authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Fixed bug introduces by last changeset

(Fixing of problem with ALTER TABLE on BDB tables)
parent 20680f89
......@@ -69,7 +69,8 @@ a max(id) b
0 0
NULL NULL NULL
grp count(*)
0 7
NULL 1
0 6
1 6
FACILITY
NULL
......
......@@ -447,6 +447,7 @@ bool rm_temporary_table(enum db_type base, char *path);
bool send_fields(THD *thd,List<Item> &item,uint send_field_count);
void free_io_cache(TABLE *entry);
void intern_close_table(TABLE *entry);
bool close_thread_table(THD *thd, TABLE **table_ptr);
void close_thread_tables(THD *thd,bool locked=0);
void close_temporary_tables(THD *thd);
TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name);
......
......@@ -428,7 +428,6 @@ void close_thread_tables(THD *thd, bool locked)
DBUG_VOID_RETURN; // LOCK TABLES in use
}
TABLE *table,*next;
bool found_old_table=0;
if (thd->lock)
......@@ -441,9 +440,35 @@ void close_thread_tables(THD *thd, bool locked)
DBUG_PRINT("info", ("thd->open_tables=%p", thd->open_tables));
for (table=thd->open_tables ; table ; table=next)
while (thd->open_tables)
found_old_table|=close_thread_table(thd, &thd->open_tables);
thd->some_tables_deleted=0;
/* Free tables to hold down open files */
while (open_cache.records > table_cache_size && unused_tables)
VOID(hash_delete(&open_cache,(byte*) unused_tables)); /* purecov: tested */
check_unused();
if (found_old_table)
{
next=table->next;
/* Tell threads waiting for refresh that something has happened */
VOID(pthread_cond_broadcast(&COND_refresh));
}
if (!locked)
VOID(pthread_mutex_unlock(&LOCK_open));
/* VOID(pthread_sigmask(SIG_SETMASK,&thd->signals,NULL)); */
DBUG_VOID_RETURN;
}
/* move one table to free list */
bool close_thread_table(THD *thd, TABLE **table_ptr)
{
DBUG_ENTER("close_thread_table");
bool found_old_table=0;
TABLE *table=*table_ptr;
*table_ptr=table->next;
if (table->version != refresh_version ||
thd->version != refresh_version || !table->db_stat)
{
......@@ -473,22 +498,7 @@ void close_thread_tables(THD *thd, bool locked)
else
unused_tables=table->next=table->prev=table;
}
}
thd->some_tables_deleted=0;
thd->open_tables=0;
/* Free tables to hold down open files */
while (open_cache.records > table_cache_size && unused_tables)
VOID(hash_delete(&open_cache,(byte*) unused_tables)); /* purecov: tested */
check_unused();
if (found_old_table)
{
/* Tell threads waiting for refresh that something has happened */
VOID(pthread_cond_broadcast(&COND_refresh));
}
if (!locked)
VOID(pthread_mutex_unlock(&LOCK_open));
/* VOID(pthread_sigmask(SIG_SETMASK,&thd->signals,NULL)); */
DBUG_VOID_RETURN;
DBUG_RETURN(found_old_table);
}
/* Close and delete temporary tables */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment