mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
merge mysql-next-mr --> mysql-5.1-rpl-merge
Conflicts: Text conflict in sql/log.cc Text conflict in sql/slave.cc Text conflict in sql/sql_base.cc
This commit is contained in:
@ -99,7 +99,7 @@ TABLE *unused_tables; /* Used by mysql_test */
|
||||
HASH open_cache; /* Used by mysql_test */
|
||||
static HASH table_def_cache;
|
||||
static TABLE_SHARE *oldest_unused_share, end_of_unused_share;
|
||||
static pthread_mutex_t LOCK_table_share;
|
||||
static mysql_mutex_t LOCK_table_share;
|
||||
static bool table_def_inited= 0;
|
||||
|
||||
static int open_unireg_entry(THD *thd, TABLE *entry, TABLE_LIST *table_list,
|
||||
@ -271,10 +271,10 @@ static void table_def_free_entry(TABLE_SHARE *share)
|
||||
if (share->prev)
|
||||
{
|
||||
/* remove from old_unused_share list */
|
||||
pthread_mutex_lock(&LOCK_table_share);
|
||||
mysql_mutex_lock(&LOCK_table_share);
|
||||
*share->prev= share->next;
|
||||
share->next->prev= share->prev;
|
||||
pthread_mutex_unlock(&LOCK_table_share);
|
||||
mysql_mutex_unlock(&LOCK_table_share);
|
||||
}
|
||||
free_table_share(share);
|
||||
DBUG_VOID_RETURN;
|
||||
@ -284,7 +284,7 @@ static void table_def_free_entry(TABLE_SHARE *share)
|
||||
bool table_def_init(void)
|
||||
{
|
||||
table_def_inited= 1;
|
||||
pthread_mutex_init(&LOCK_table_share, MY_MUTEX_INIT_FAST);
|
||||
mysql_mutex_init(key_LOCK_table_share, &LOCK_table_share, MY_MUTEX_INIT_FAST);
|
||||
oldest_unused_share= &end_of_unused_share;
|
||||
end_of_unused_share.prev= &oldest_unused_share;
|
||||
|
||||
@ -300,7 +300,7 @@ void table_def_free(void)
|
||||
if (table_def_inited)
|
||||
{
|
||||
table_def_inited= 0;
|
||||
pthread_mutex_destroy(&LOCK_table_share);
|
||||
mysql_mutex_destroy(&LOCK_table_share);
|
||||
my_hash_free(&table_def_cache);
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
@ -360,7 +360,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
|
||||
Lock mutex to be able to read table definition from file without
|
||||
conflicts
|
||||
*/
|
||||
(void) pthread_mutex_lock(&share->mutex);
|
||||
mysql_mutex_lock(&share->mutex);
|
||||
|
||||
/*
|
||||
We assign a new table id under the protection of the LOCK_open and
|
||||
@ -391,7 +391,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key,
|
||||
share->ref_count++; // Mark in use
|
||||
DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u",
|
||||
(ulong) share, share->ref_count));
|
||||
(void) pthread_mutex_unlock(&share->mutex);
|
||||
mysql_mutex_unlock(&share->mutex);
|
||||
DBUG_RETURN(share);
|
||||
|
||||
found:
|
||||
@ -401,18 +401,18 @@ found:
|
||||
*/
|
||||
|
||||
/* We must do a lock to ensure that the structure is initialized */
|
||||
(void) pthread_mutex_lock(&share->mutex);
|
||||
mysql_mutex_lock(&share->mutex);
|
||||
if (share->error)
|
||||
{
|
||||
/* Table definition contained an error */
|
||||
open_table_error(share, share->error, share->open_errno, share->errarg);
|
||||
(void) pthread_mutex_unlock(&share->mutex);
|
||||
mysql_mutex_unlock(&share->mutex);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
if (share->is_view && !(db_flags & OPEN_VIEW))
|
||||
{
|
||||
open_table_error(share, 1, ENOENT, 0);
|
||||
(void) pthread_mutex_unlock(&share->mutex);
|
||||
mysql_mutex_unlock(&share->mutex);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
@ -423,20 +423,20 @@ found:
|
||||
Unlink share from this list
|
||||
*/
|
||||
DBUG_PRINT("info", ("Unlinking from not used list"));
|
||||
pthread_mutex_lock(&LOCK_table_share);
|
||||
mysql_mutex_lock(&LOCK_table_share);
|
||||
*share->prev= share->next;
|
||||
share->next->prev= share->prev;
|
||||
share->next= 0;
|
||||
share->prev= 0;
|
||||
pthread_mutex_unlock(&LOCK_table_share);
|
||||
mysql_mutex_unlock(&LOCK_table_share);
|
||||
}
|
||||
(void) pthread_mutex_unlock(&share->mutex);
|
||||
mysql_mutex_unlock(&share->mutex);
|
||||
|
||||
/* Free cache if too big */
|
||||
while (table_def_cache.records > table_def_size &&
|
||||
oldest_unused_share->next)
|
||||
{
|
||||
pthread_mutex_lock(&oldest_unused_share->mutex);
|
||||
mysql_mutex_lock(&oldest_unused_share->mutex);
|
||||
my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share);
|
||||
}
|
||||
|
||||
@ -567,7 +567,7 @@ void release_table_share(TABLE_SHARE *share, enum release_type type)
|
||||
|
||||
mysql_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
pthread_mutex_lock(&share->mutex);
|
||||
mysql_mutex_lock(&share->mutex);
|
||||
if (!--share->ref_count)
|
||||
{
|
||||
if (share->version != refresh_version)
|
||||
@ -578,12 +578,12 @@ void release_table_share(TABLE_SHARE *share, enum release_type type)
|
||||
DBUG_PRINT("info",("moving share to unused list"));
|
||||
|
||||
DBUG_ASSERT(share->next == 0);
|
||||
pthread_mutex_lock(&LOCK_table_share);
|
||||
mysql_mutex_lock(&LOCK_table_share);
|
||||
share->prev= end_of_unused_share.prev;
|
||||
*end_of_unused_share.prev= share;
|
||||
end_of_unused_share.prev= &share->next;
|
||||
share->next= &end_of_unused_share;
|
||||
pthread_mutex_unlock(&LOCK_table_share);
|
||||
mysql_mutex_unlock(&LOCK_table_share);
|
||||
|
||||
to_be_deleted= (table_def_cache.records > table_def_size);
|
||||
}
|
||||
@ -595,7 +595,7 @@ void release_table_share(TABLE_SHARE *share, enum release_type type)
|
||||
my_hash_delete(&table_def_cache, (uchar*) share);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
pthread_mutex_unlock(&share->mutex);
|
||||
mysql_mutex_unlock(&share->mutex);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -879,7 +879,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock,
|
||||
/* Free table shares */
|
||||
while (oldest_unused_share->next)
|
||||
{
|
||||
pthread_mutex_lock(&oldest_unused_share->mutex);
|
||||
mysql_mutex_lock(&oldest_unused_share->mutex);
|
||||
(void) my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share);
|
||||
}
|
||||
DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu",
|
||||
@ -2865,7 +2865,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
*/
|
||||
if (table->in_use != thd)
|
||||
{
|
||||
/* wait_for_conditionwill unlock LOCK_open for us */
|
||||
/* wait_for_condition will unlock LOCK_open for us */
|
||||
wait_for_condition(thd, &LOCK_open, &COND_refresh);
|
||||
}
|
||||
else
|
||||
@ -4458,6 +4458,7 @@ thr_lock_type read_lock_type_for_table(THD *thd, TABLE *table)
|
||||
bool log_on= mysql_bin_log.is_open() && (thd->variables.option_bits & OPTION_BIN_LOG);
|
||||
ulong binlog_format= thd->variables.binlog_format;
|
||||
if ((log_on == FALSE) || (binlog_format == BINLOG_FORMAT_ROW) ||
|
||||
(table->s->table_category == TABLE_CATEGORY_LOG) ||
|
||||
(table->s->table_category == TABLE_CATEGORY_PERFORMANCE))
|
||||
return TL_READ;
|
||||
else
|
||||
@ -5436,7 +5437,7 @@ bool rm_temporary_table(handlerton *base, char *path)
|
||||
DBUG_ENTER("rm_temporary_table");
|
||||
|
||||
strmov(ext= strend(path), reg_ext);
|
||||
if (my_delete(path,MYF(0)))
|
||||
if (mysql_file_delete(key_file_frm, path, MYF(0)))
|
||||
error=1; /* purecov: inspected */
|
||||
*ext= 0; // remove extension
|
||||
file= get_new_handler((TABLE_SHARE*) 0, current_thd->mem_root, base);
|
||||
@ -8225,7 +8226,7 @@ my_bool mysql_rm_tmp_tables(void)
|
||||
So we hide error messages which happnes during deleting of these
|
||||
files(MYF(0)).
|
||||
*/
|
||||
(void) my_delete(filePath, MYF(0));
|
||||
(void) mysql_file_delete(key_file_misc, filePath, MYF(0));
|
||||
}
|
||||
}
|
||||
my_dirend(dirp);
|
||||
@ -8403,7 +8404,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name,
|
||||
share->version= 0; // Mark for delete
|
||||
if (share->ref_count == 0)
|
||||
{
|
||||
pthread_mutex_lock(&share->mutex);
|
||||
mysql_mutex_lock(&share->mutex);
|
||||
my_hash_delete(&table_def_cache, (uchar*) share);
|
||||
}
|
||||
}
|
||||
@ -8862,19 +8863,18 @@ open_system_table_for_update(THD *thd, TABLE_LIST *one_table)
|
||||
}
|
||||
|
||||
/**
|
||||
Open a performance schema table.
|
||||
Open a log table.
|
||||
Opening such tables is performed internally in the server
|
||||
implementation, and is a 'nested' open, since some tables
|
||||
might be already opened by the current thread.
|
||||
The thread context before this call is saved, and is restored
|
||||
when calling close_performance_schema_table().
|
||||
when calling close_log_table().
|
||||
@param thd The current thread
|
||||
@param one_table Performance schema table to open
|
||||
@param one_table Log table to open
|
||||
@param backup [out] Temporary storage used to save the thread context
|
||||
*/
|
||||
TABLE *
|
||||
open_performance_schema_table(THD *thd, TABLE_LIST *one_table,
|
||||
Open_tables_state *backup)
|
||||
open_log_table(THD *thd, TABLE_LIST *one_table, Open_tables_state *backup)
|
||||
{
|
||||
uint flags= ( MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK |
|
||||
MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |
|
||||
@ -8883,13 +8883,13 @@ open_performance_schema_table(THD *thd, TABLE_LIST *one_table,
|
||||
TABLE *table;
|
||||
/* Save value that is changed in mysql_lock_tables() */
|
||||
ulonglong save_utime_after_lock= thd->utime_after_lock;
|
||||
DBUG_ENTER("open_performance_schema_table");
|
||||
DBUG_ENTER("open_log_table");
|
||||
|
||||
thd->reset_n_backup_open_tables_state(backup);
|
||||
|
||||
if ((table= open_ltable(thd, one_table, one_table->lock_type, flags)))
|
||||
{
|
||||
DBUG_ASSERT(table->s->table_category == TABLE_CATEGORY_PERFORMANCE);
|
||||
DBUG_ASSERT(table->s->table_category == TABLE_CATEGORY_LOG);
|
||||
/* Make sure all columns get assigned to a default value */
|
||||
table->use_all_columns();
|
||||
table->no_replicate= 1;
|
||||
@ -8917,18 +8917,18 @@ open_performance_schema_table(THD *thd, TABLE_LIST *one_table,
|
||||
}
|
||||
|
||||
/**
|
||||
Close a performance schema table.
|
||||
The last table opened by open_performance_schema_table()
|
||||
Close a log table.
|
||||
The last table opened by open_log_table()
|
||||
is closed, then the thread context is restored.
|
||||
@param thd The current thread
|
||||
@param backup [in] the context to restore.
|
||||
*/
|
||||
void close_performance_schema_table(THD *thd, Open_tables_state *backup)
|
||||
void close_log_table(THD *thd, Open_tables_state *backup)
|
||||
{
|
||||
bool found_old_table;
|
||||
|
||||
/*
|
||||
If open_performance_schema_table() fails,
|
||||
If open_log_table() fails,
|
||||
this function should not be called.
|
||||
*/
|
||||
DBUG_ASSERT(thd->lock != NULL);
|
||||
|
Reference in New Issue
Block a user