mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Lots of code fixes to the replication code (especially the binary logging and index log file handling)
Fixed bugs in my last changeset that made MySQL hard to compile. Added mutex around some data that could cause table cache corruptions when using OPTIMIZE TABLE / REPAIR TABLE or automatic repair of MyISAM tables. Added mutex around some data in the slave start/stop code that could cause THD linked list corruptions Extended my_chsize() to allow one to specify a filler character. Extend vio_blocking to return the old state (This made some usage of this function much simpler) Added testing for some functions that they caller have got the required mutexes before calling the function. Use setrlimit() to ensure that we can write core file if one specifies --core-file. Added --slave-compressed-protocol Made 2 the minimum length for ft_min_word_len Added variables foreign_key_checks & unique_checks. Less logging from replication code (if not started with --log-warnings) Changed that SHOW INNODB STATUS requre the SUPER privilege More DBUG statements and a lot of new code comments
This commit is contained in:
@@ -279,6 +279,7 @@ void intern_close_table(TABLE *table)
|
||||
static void free_cache_entry(TABLE *table)
|
||||
{
|
||||
DBUG_ENTER("free_cache_entry");
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
intern_close_table(table);
|
||||
if (!table->in_use)
|
||||
@@ -425,6 +426,7 @@ void close_thread_tables(THD *thd, bool locked)
|
||||
/* VOID(pthread_sigmask(SIG_SETMASK,&thd->block_signals,NULL)); */
|
||||
if (!locked)
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
DBUG_PRINT("info", ("thd->open_tables=%p", thd->open_tables));
|
||||
|
||||
@@ -550,13 +552,10 @@ void close_temporary_tables(THD *thd)
|
||||
}
|
||||
if (query && found_user_tables && mysql_bin_log.is_open())
|
||||
{
|
||||
uint save_query_len = thd->query_length;
|
||||
*--end = 0; // Remove last ','
|
||||
thd->query_length = (uint)(end-query);
|
||||
Query_log_event qinfo(thd, query);
|
||||
/* The -1 is to remove last ',' */
|
||||
Query_log_event qinfo(thd, query, (ulong)(end-query)-1);
|
||||
qinfo.error_code=0;
|
||||
mysql_bin_log.write(&qinfo);
|
||||
thd->query_length = save_query_len;
|
||||
}
|
||||
thd->temporary_tables=0;
|
||||
}
|
||||
@@ -669,11 +668,13 @@ TABLE *unlink_open_table(THD *thd, TABLE *list, TABLE *find)
|
||||
|
||||
/*
|
||||
When we call the following function we must have a lock on
|
||||
LOCK_OPEN ; This lock will be unlocked on return.
|
||||
LOCK_open ; This lock will be unlocked on return.
|
||||
*/
|
||||
|
||||
void wait_for_refresh(THD *thd)
|
||||
{
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
/* Wait until the current table is up to date */
|
||||
const char *proc_info;
|
||||
thd->mysys_var->current_mutex= &LOCK_open;
|
||||
@@ -931,6 +932,7 @@ bool reopen_table(TABLE *table,bool locked)
|
||||
#endif
|
||||
if (!locked)
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
if (open_unireg_entry(current_thd,&tmp,db,table_name,table->table_name,
|
||||
locked))
|
||||
@@ -1022,6 +1024,8 @@ bool close_data_tables(THD *thd,const char *db, const char *table_name)
|
||||
bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
|
||||
{
|
||||
DBUG_ENTER("reopen_tables");
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
if (!thd->open_tables)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
@@ -1259,6 +1263,8 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
|
||||
table_list.next=0;
|
||||
if (!locked)
|
||||
pthread_mutex_lock(&LOCK_open);
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
if ((error=lock_table_name(thd,&table_list)))
|
||||
{
|
||||
if (error < 0)
|
||||
|
||||
Reference in New Issue
Block a user