mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Manual merge from mysql-trunk.
Conflicts: - client/mysqltest.cc - mysql-test/collections/default.experimental - mysql-test/suite/rpl/t/disabled.def - sql/mysqld.cc - sql/opt_range.cc - sql/sp.cc - sql/sql_acl.cc - sql/sql_partition.cc - sql/sql_table.cc
This commit is contained in:
161
sql/sql_base.cc
161
sql/sql_base.cc
@ -22,6 +22,7 @@
|
||||
#include "sp_head.h"
|
||||
#include "sp.h"
|
||||
#include "sql_trigger.h"
|
||||
#include "sql_prepare.h"
|
||||
#include <m_ctype.h>
|
||||
#include <my_dir.h>
|
||||
#include <hash.h>
|
||||
@ -46,9 +47,12 @@ public:
|
||||
|
||||
virtual ~Prelock_error_handler() {}
|
||||
|
||||
virtual bool handle_error(uint sql_errno, const char *message,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
THD *thd);
|
||||
virtual bool handle_condition(THD *thd,
|
||||
uint sql_errno,
|
||||
const char* sqlstate,
|
||||
MYSQL_ERROR::enum_warning_level level,
|
||||
const char* msg,
|
||||
MYSQL_ERROR ** cond_hdl);
|
||||
|
||||
bool safely_trapped_errors();
|
||||
|
||||
@ -59,11 +63,14 @@ private:
|
||||
|
||||
|
||||
bool
|
||||
Prelock_error_handler::handle_error(uint sql_errno,
|
||||
const char * /* message */,
|
||||
MYSQL_ERROR::enum_warning_level /* level */,
|
||||
THD * /* thd */)
|
||||
Prelock_error_handler::handle_condition(THD *,
|
||||
uint sql_errno,
|
||||
const char*,
|
||||
MYSQL_ERROR::enum_warning_level,
|
||||
const char*,
|
||||
MYSQL_ERROR ** cond_hdl)
|
||||
{
|
||||
*cond_hdl= NULL;
|
||||
if (sql_errno == ER_NO_SUCH_TABLE)
|
||||
{
|
||||
m_handled_errors++;
|
||||
@ -122,9 +129,9 @@ extern "C" uchar *table_cache_key(const uchar *record, size_t *length,
|
||||
|
||||
bool table_cache_init(void)
|
||||
{
|
||||
return hash_init(&open_cache, &my_charset_bin, table_cache_size+16,
|
||||
0, 0, table_cache_key,
|
||||
(hash_free_key) free_cache_entry, 0) != 0;
|
||||
return my_hash_init(&open_cache, &my_charset_bin, table_cache_size+16,
|
||||
0, 0, table_cache_key,
|
||||
(my_hash_free_key) free_cache_entry, 0) != 0;
|
||||
}
|
||||
|
||||
void table_cache_free(void)
|
||||
@ -134,7 +141,7 @@ void table_cache_free(void)
|
||||
{
|
||||
close_cached_tables(NULL, NULL, FALSE, FALSE, FALSE);
|
||||
if (!open_cache.records) // Safety first
|
||||
hash_free(&open_cache);
|
||||
my_hash_free(&open_cache);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -169,7 +176,7 @@ static void check_unused(void)
|
||||
}
|
||||
for (idx=0 ; idx < open_cache.records ; idx++)
|
||||
{
|
||||
TABLE *entry=(TABLE*) hash_element(&open_cache,idx);
|
||||
TABLE *entry=(TABLE*) my_hash_element(&open_cache,idx);
|
||||
if (!entry->in_use)
|
||||
count--;
|
||||
if (entry->file)
|
||||
@ -282,9 +289,9 @@ bool table_def_init(void)
|
||||
oldest_unused_share= &end_of_unused_share;
|
||||
end_of_unused_share.prev= &oldest_unused_share;
|
||||
|
||||
return hash_init(&table_def_cache, &my_charset_bin, table_def_size,
|
||||
0, 0, table_def_key,
|
||||
(hash_free_key) table_def_free_entry, 0) != 0;
|
||||
return my_hash_init(&table_def_cache, &my_charset_bin, table_def_size,
|
||||
0, 0, table_def_key,
|
||||
(my_hash_free_key) table_def_free_entry, 0) != 0;
|
||||
}
|
||||
|
||||
|
||||
@ -295,7 +302,7 @@ void table_def_free(void)
|
||||
{
|
||||
table_def_inited= 0;
|
||||
pthread_mutex_destroy(&LOCK_table_share);
|
||||
hash_free(&table_def_cache);
|
||||
my_hash_free(&table_def_cache);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -341,8 +348,8 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
|
||||
*error= 0;
|
||||
|
||||
/* Read table definition from cache */
|
||||
if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key,
|
||||
key_length)))
|
||||
if ((share= (TABLE_SHARE*) my_hash_search(&table_def_cache,(uchar*) key,
|
||||
key_length)))
|
||||
goto found;
|
||||
|
||||
if (!(share= alloc_table_share(table_list, key, key_length)))
|
||||
@ -379,7 +386,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
|
||||
if (open_table_def(thd, share, db_flags))
|
||||
{
|
||||
*error= share->error;
|
||||
(void) hash_delete(&table_def_cache, (uchar*) share);
|
||||
(void) my_hash_delete(&table_def_cache, (uchar*) share);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
share->ref_count++; // Mark in use
|
||||
@ -431,7 +438,7 @@ found:
|
||||
oldest_unused_share->next)
|
||||
{
|
||||
pthread_mutex_lock(&oldest_unused_share->mutex);
|
||||
VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
|
||||
VOID(my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
|
||||
}
|
||||
|
||||
DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
|
||||
@ -475,7 +482,7 @@ static TABLE_SHARE
|
||||
|
||||
@todo Rework alternative ways to deal with ER_NO_SUCH TABLE.
|
||||
*/
|
||||
if (share || (thd->is_error() && thd->main_da.sql_errno() != ER_NO_SUCH_TABLE))
|
||||
if (share || (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE))
|
||||
|
||||
DBUG_RETURN(share);
|
||||
|
||||
@ -522,7 +529,7 @@ static TABLE_SHARE
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
/* Table existed in engine. Let's open it */
|
||||
mysql_reset_errors(thd, 1); // Clear warnings
|
||||
thd->warning_info->clear_warning_info(thd->query_id);
|
||||
thd->clear_error(); // Clear error message
|
||||
DBUG_RETURN(get_table_share(thd, table_list, key, key_length,
|
||||
db_flags, error));
|
||||
@ -586,7 +593,7 @@ void release_table_share(TABLE_SHARE *share, enum release_type type)
|
||||
if (to_be_deleted)
|
||||
{
|
||||
DBUG_PRINT("info", ("Deleting share"));
|
||||
hash_delete(&table_def_cache, (uchar*) share);
|
||||
my_hash_delete(&table_def_cache, (uchar*) share);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
pthread_mutex_unlock(&share->mutex);
|
||||
@ -617,7 +624,8 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name)
|
||||
table_list.db= (char*) db;
|
||||
table_list.table_name= (char*) table_name;
|
||||
key_length= create_table_def_key((THD*) 0, key, &table_list, 0);
|
||||
return (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, key_length);
|
||||
return (TABLE_SHARE*) my_hash_search(&table_def_cache,
|
||||
(uchar*) key, key_length);
|
||||
}
|
||||
|
||||
|
||||
@ -714,7 +722,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
|
||||
for (uint idx=0 ; result == 0 && idx < open_cache.records; idx++)
|
||||
{
|
||||
OPEN_TABLE_LIST *table;
|
||||
TABLE *entry=(TABLE*) hash_element(&open_cache,idx);
|
||||
TABLE *entry=(TABLE*) my_hash_element(&open_cache,idx);
|
||||
TABLE_SHARE *share= entry->s;
|
||||
|
||||
if (db && my_strcasecmp(system_charset_info, db, share->db.str))
|
||||
@ -727,7 +735,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
|
||||
table_list.table_name= share->table_name.str;
|
||||
table_list.grant.privilege=0;
|
||||
|
||||
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list, 1, TRUE))
|
||||
if (check_table_access(thd,SELECT_ACL,&table_list, TRUE, 1, TRUE))
|
||||
continue;
|
||||
/* need to check if we haven't already listed it */
|
||||
for (table= open_list ; table ; table=table->next)
|
||||
@ -863,17 +871,17 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
|
||||
while (unused_tables)
|
||||
{
|
||||
#ifdef EXTRA_DEBUG
|
||||
if (hash_delete(&open_cache,(uchar*) unused_tables))
|
||||
if (my_hash_delete(&open_cache,(uchar*) unused_tables))
|
||||
printf("Warning: Couldn't delete open table from hash\n");
|
||||
#else
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables));
|
||||
VOID(my_hash_delete(&open_cache,(uchar*) unused_tables));
|
||||
#endif
|
||||
}
|
||||
/* Free table shares */
|
||||
while (oldest_unused_share->next)
|
||||
{
|
||||
pthread_mutex_lock(&oldest_unused_share->mutex);
|
||||
VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
|
||||
VOID(my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share));
|
||||
}
|
||||
DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu",
|
||||
refresh_version));
|
||||
@ -918,7 +926,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
|
||||
*/
|
||||
for (uint idx=0 ; idx < open_cache.records ; idx++)
|
||||
{
|
||||
TABLE *table=(TABLE*) hash_element(&open_cache,idx);
|
||||
TABLE *table=(TABLE*) my_hash_element(&open_cache,idx);
|
||||
if (table->in_use)
|
||||
table->in_use->some_tables_deleted= 1;
|
||||
}
|
||||
@ -963,7 +971,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
|
||||
found=0;
|
||||
for (uint idx=0 ; idx < open_cache.records ; idx++)
|
||||
{
|
||||
TABLE *table=(TABLE*) hash_element(&open_cache,idx);
|
||||
TABLE *table=(TABLE*) my_hash_element(&open_cache,idx);
|
||||
/* Avoid a self-deadlock. */
|
||||
if (table->in_use == thd)
|
||||
continue;
|
||||
@ -1045,7 +1053,7 @@ bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh,
|
||||
|
||||
for (idx= 0; idx < table_def_cache.records; idx++)
|
||||
{
|
||||
TABLE_SHARE *share= (TABLE_SHARE *) hash_element(&table_def_cache, idx);
|
||||
TABLE_SHARE *share= (TABLE_SHARE *) my_hash_element(&table_def_cache, idx);
|
||||
|
||||
/* Ignore if table is not open or does not have a connect_string */
|
||||
if (!share->connect_string.length || !share->ref_count)
|
||||
@ -1201,7 +1209,7 @@ static void close_open_tables(THD *thd)
|
||||
|
||||
/* Free tables to hold down open files */
|
||||
while (open_cache.records > table_cache_size && unused_tables)
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
|
||||
VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
|
||||
check_unused();
|
||||
if (found_old_table)
|
||||
{
|
||||
@ -1284,9 +1292,9 @@ void close_thread_tables(THD *thd)
|
||||
*/
|
||||
if (!(thd->state_flags & Open_tables_state::BACKUPS_AVAIL))
|
||||
{
|
||||
thd->main_da.can_overwrite_status= TRUE;
|
||||
thd->stmt_da->can_overwrite_status= TRUE;
|
||||
ha_autocommit_or_rollback(thd, thd->is_error());
|
||||
thd->main_da.can_overwrite_status= FALSE;
|
||||
thd->stmt_da->can_overwrite_status= FALSE;
|
||||
|
||||
/*
|
||||
Reset transaction state, but only if we're not inside a
|
||||
@ -1387,7 +1395,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr)
|
||||
if (table->needs_reopen_or_name_lock() ||
|
||||
thd->version != refresh_version || !table->db_stat)
|
||||
{
|
||||
VOID(hash_delete(&open_cache,(uchar*) table));
|
||||
VOID(my_hash_delete(&open_cache,(uchar*) table));
|
||||
found_old_table=1;
|
||||
}
|
||||
else
|
||||
@ -2091,7 +2099,7 @@ void unlink_open_table(THD *thd, TABLE *find, bool unlock)
|
||||
/* Remove table from open_tables list. */
|
||||
*prev= list->next;
|
||||
/* Close table. */
|
||||
VOID(hash_delete(&open_cache,(uchar*) list)); // Close table
|
||||
VOID(my_hash_delete(&open_cache,(uchar*) list)); // Close table
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2397,7 +2405,7 @@ bool lock_table_name_if_not_cached(THD *thd, const char *db,
|
||||
key_length= (uint)(strmov(strmov(key, db) + 1, table_name) - key) + 1;
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
|
||||
if (hash_search(&open_cache, (uchar *)key, key_length))
|
||||
if (my_hash_search(&open_cache, (uchar *)key, key_length))
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
DBUG_PRINT("info", ("Table is cached, name-lock is not obtained"));
|
||||
@ -2752,11 +2760,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
an implicit "pending locks queue" - see
|
||||
wait_for_locked_table_names for details.
|
||||
*/
|
||||
for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length,
|
||||
&state);
|
||||
for (table= (TABLE*) my_hash_first(&open_cache, (uchar*) key, key_length,
|
||||
&state);
|
||||
table && table->in_use ;
|
||||
table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length,
|
||||
&state))
|
||||
table= (TABLE*) my_hash_next(&open_cache, (uchar*) key, key_length,
|
||||
&state))
|
||||
{
|
||||
DBUG_PRINT("tcache", ("in_use table: '%s'.'%s' 0x%lx", table->s->db.str,
|
||||
table->s->table_name.str, (long) table));
|
||||
@ -2868,7 +2876,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
DBUG_PRINT("tcache", ("opening new table"));
|
||||
/* Free cache if too big */
|
||||
while (open_cache.records > table_cache_size && unused_tables)
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
|
||||
VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */
|
||||
|
||||
if (table_list->create)
|
||||
{
|
||||
@ -2926,7 +2934,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
Set 1 as a flag here
|
||||
*/
|
||||
if (error < 0)
|
||||
table_list->view= (st_lex*)1;
|
||||
table_list->view= (LEX*)1;
|
||||
|
||||
my_free((uchar*)table, MYF(0));
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
@ -3331,7 +3339,7 @@ bool reopen_tables(THD *thd, bool get_locks, bool mark_share_as_old)
|
||||
*/
|
||||
if (table->child_l || table->parent)
|
||||
detach_merge_children(table, TRUE);
|
||||
VOID(hash_delete(&open_cache,(uchar*) table));
|
||||
VOID(my_hash_delete(&open_cache,(uchar*) table));
|
||||
error=1;
|
||||
}
|
||||
else
|
||||
@ -3360,7 +3368,7 @@ bool reopen_tables(THD *thd, bool get_locks, bool mark_share_as_old)
|
||||
{
|
||||
while (err_tables)
|
||||
{
|
||||
VOID(hash_delete(&open_cache, (uchar*) err_tables));
|
||||
VOID(my_hash_delete(&open_cache, (uchar*) err_tables));
|
||||
err_tables= err_tables->next;
|
||||
}
|
||||
}
|
||||
@ -3512,11 +3520,11 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock)
|
||||
|
||||
DBUG_PRINT("loop", ("table_name: %s", table->alias));
|
||||
HASH_SEARCH_STATE state;
|
||||
for (TABLE *search= (TABLE*) hash_first(&open_cache, (uchar*) key,
|
||||
key_length, &state);
|
||||
for (TABLE *search= (TABLE*) my_hash_first(&open_cache, (uchar*) key,
|
||||
key_length, &state);
|
||||
search ;
|
||||
search= (TABLE*) hash_next(&open_cache, (uchar*) key,
|
||||
key_length, &state))
|
||||
search= (TABLE*) my_hash_next(&open_cache, (uchar*) key,
|
||||
key_length, &state))
|
||||
{
|
||||
DBUG_PRINT("info", ("share: 0x%lx "
|
||||
"open_placeholder: %d locked_by_name: %d "
|
||||
@ -3642,7 +3650,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name)
|
||||
else
|
||||
{
|
||||
/* We already have a name lock, remove copy */
|
||||
VOID(hash_delete(&open_cache,(uchar*) table));
|
||||
VOID(my_hash_delete(&open_cache,(uchar*) table));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -3957,7 +3965,7 @@ retry:
|
||||
release_table_share(share, RELEASE_WAIT_FOR_DROP);
|
||||
if (!thd->killed)
|
||||
{
|
||||
mysql_reset_errors(thd, 1); // Clear warnings
|
||||
thd->warning_info->clear_warning_info(thd->query_id);
|
||||
thd->clear_error(); // Clear error message
|
||||
goto retry;
|
||||
}
|
||||
@ -4521,9 +4529,6 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
*/
|
||||
for (tables= *start; tables ;tables= tables->next_global)
|
||||
{
|
||||
DBUG_PRINT("tcache", ("opening table: '%s'.'%s' item: 0x%lx",
|
||||
tables->db, tables->table_name, (long) tables));
|
||||
|
||||
safe_to_ignore_table= FALSE;
|
||||
|
||||
/*
|
||||
@ -4560,6 +4565,8 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
}
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
DBUG_PRINT("tcache", ("opening table: '%s'.'%s' item: 0x%lx",
|
||||
tables->db, tables->table_name, (long) tables));
|
||||
(*counter)++;
|
||||
|
||||
/*
|
||||
@ -4616,7 +4623,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
Let us free memory used by 'sroutines' hash here since we never
|
||||
call destructor for this LEX.
|
||||
*/
|
||||
hash_free(&tables->view->sroutines);
|
||||
my_hash_free(&tables->view->sroutines);
|
||||
goto process_view_routines;
|
||||
}
|
||||
|
||||
@ -5893,8 +5900,8 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length,
|
||||
field_ptr= table->field + cached_field_index;
|
||||
else if (table->s->name_hash.records)
|
||||
{
|
||||
field_ptr= (Field**) hash_search(&table->s->name_hash, (uchar*) name,
|
||||
length);
|
||||
field_ptr= (Field**) my_hash_search(&table->s->name_hash, (uchar*) name,
|
||||
length);
|
||||
if (field_ptr)
|
||||
{
|
||||
/*
|
||||
@ -6021,7 +6028,9 @@ find_field_in_table_ref(THD *thd, TABLE_LIST *table_list,
|
||||
table_name && table_name[0] &&
|
||||
(my_strcasecmp(table_alias_charset, table_list->alias, table_name) ||
|
||||
(db_name && db_name[0] && table_list->db && table_list->db[0] &&
|
||||
strcmp(db_name, table_list->db))))
|
||||
(table_list->schema_table ?
|
||||
my_strcasecmp(system_charset_info, db_name, table_list->db) :
|
||||
strcmp(db_name, table_list->db)))))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
*actual_table= NULL;
|
||||
@ -6140,8 +6149,8 @@ Field *find_field_in_table_sef(TABLE *table, const char *name)
|
||||
Field **field_ptr;
|
||||
if (table->s->name_hash.records)
|
||||
{
|
||||
field_ptr= (Field**)hash_search(&table->s->name_hash,(uchar*) name,
|
||||
strlen(name));
|
||||
field_ptr= (Field**)my_hash_search(&table->s->name_hash,(uchar*) name,
|
||||
strlen(name));
|
||||
if (field_ptr)
|
||||
{
|
||||
/*
|
||||
@ -8383,7 +8392,7 @@ void remove_db_from_cache(const char *db)
|
||||
{
|
||||
for (uint idx=0 ; idx < open_cache.records ; idx++)
|
||||
{
|
||||
TABLE *table=(TABLE*) hash_element(&open_cache,idx);
|
||||
TABLE *table=(TABLE*) my_hash_element(&open_cache,idx);
|
||||
if (!strcmp(table->s->db.str, db))
|
||||
{
|
||||
table->s->version= 0L; /* Free when thread is ready */
|
||||
@ -8392,7 +8401,7 @@ void remove_db_from_cache(const char *db)
|
||||
}
|
||||
}
|
||||
while (unused_tables && !unused_tables->s->version)
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables));
|
||||
VOID(my_hash_delete(&open_cache,(uchar*) unused_tables));
|
||||
}
|
||||
|
||||
|
||||
@ -8408,7 +8417,7 @@ void flush_tables()
|
||||
{
|
||||
(void) pthread_mutex_lock(&LOCK_open);
|
||||
while (unused_tables)
|
||||
hash_delete(&open_cache,(uchar*) unused_tables);
|
||||
my_hash_delete(&open_cache,(uchar*) unused_tables);
|
||||
(void) pthread_mutex_unlock(&LOCK_open);
|
||||
}
|
||||
|
||||
@ -8445,11 +8454,11 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
|
||||
HASH_SEARCH_STATE state;
|
||||
result= signalled= 0;
|
||||
|
||||
for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length,
|
||||
&state);
|
||||
for (table= (TABLE*) my_hash_first(&open_cache, (uchar*) key, key_length,
|
||||
&state);
|
||||
table;
|
||||
table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length,
|
||||
&state))
|
||||
table= (TABLE*) my_hash_next(&open_cache, (uchar*) key, key_length,
|
||||
&state))
|
||||
{
|
||||
THD *in_use;
|
||||
DBUG_PRINT("tcache", ("found table: '%s'.'%s' 0x%lx", table->s->db.str,
|
||||
@ -8516,12 +8525,12 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
|
||||
}
|
||||
}
|
||||
while (unused_tables && !unused_tables->s->version)
|
||||
VOID(hash_delete(&open_cache,(uchar*) unused_tables));
|
||||
VOID(my_hash_delete(&open_cache,(uchar*) unused_tables));
|
||||
|
||||
DBUG_PRINT("info", ("Removing table from table_def_cache"));
|
||||
/* Remove table from table definition cache if it's not in use */
|
||||
if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key,
|
||||
key_length)))
|
||||
if ((share= (TABLE_SHARE*) my_hash_search(&table_def_cache,(uchar*) key,
|
||||
key_length)))
|
||||
{
|
||||
DBUG_PRINT("info", ("share version: %lu ref_count: %u",
|
||||
share->version, share->ref_count));
|
||||
@ -8529,7 +8538,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
|
||||
if (share->ref_count == 0)
|
||||
{
|
||||
pthread_mutex_lock(&share->mutex);
|
||||
VOID(hash_delete(&table_def_cache, (uchar*) share));
|
||||
VOID(my_hash_delete(&table_def_cache, (uchar*) share));
|
||||
}
|
||||
}
|
||||
|
||||
@ -8777,11 +8786,11 @@ void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table
|
||||
key_length=(uint) (strmov(strmov(key,lpt->db)+1,lpt->table_name)-key)+1;
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
HASH_SEARCH_STATE state;
|
||||
for (table= (TABLE*) hash_first(&open_cache,(uchar*) key,key_length,
|
||||
&state) ;
|
||||
for (table= (TABLE*) my_hash_first(&open_cache,(uchar*) key,key_length,
|
||||
&state) ;
|
||||
table;
|
||||
table= (TABLE*) hash_next(&open_cache,(uchar*) key,key_length,
|
||||
&state))
|
||||
table= (TABLE*) my_hash_next(&open_cache,(uchar*) key,key_length,
|
||||
&state))
|
||||
{
|
||||
THD *in_use= table->in_use;
|
||||
table->s->version= 0L;
|
||||
|
Reference in New Issue
Block a user