Below is the list of changes that have just been commited into a local
3.23. repository of sasha. When sasha does a push, they will be
propogaged to the main repository and within 24 hours after the push into
the public repository. For information on how to access
the public repository see
http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet@stripped, 2001-07-11 19:29:23-06:00, sasha@stripped
fixed race condition in automatic binlog rotation
remove extension from binary log if the user specifies one to avoid
non-rotatable logs
fixed possible use of unitialized IO_CACHE in debug mode
sql/log.cc
1.57 01/07/11 19:29:14 sasha@stripped +13 -8
fixed race condition in automatic binlog rotation
sql/mysqld.cc
1.189 01/07/11 19:29:14 sasha@stripped +7 -0
remove extension from binary log if the user specifies one to avoid
non-rotatable logs
sql/slave.cc
1.107 01/07/11 19:29:14 sasha@stripped +5 -0
fixed race condition with slave thread during server shutdown
sql/sql_class.h
1.66 01/07/11 19:29:14 sasha@stripped +1 -1
new_file() needed an argument to know if it was called withing the
log mutex or not
sql/sql_repl.cc
1.40 01/07/11 19:29:14 sasha@stripped +1 -1
fixed possible use of unitialized IO_CACHE in debug mode
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: sasha
# Host: mysql.sashanet.com
# Root: /home/sasha/src/bk/mysql
--- 1.56/sql/log.cc Thu Jun 21 15:59:50 2001
+++ 1.57/sql/log.cc Wed Jul 11 19:29:14 2001
@@ -511,17 +511,19 @@
return inited && !strcmp(log_file_name, this->log_file_name);
}
-void MYSQL_LOG::new_file()
+void MYSQL_LOG::new_file(bool inside_mutex)
{
// only rotate open logs that are marked non-rotatable
// (binlog with constant name are non-rotatable)
if (is_open() && ! no_rotate)
{
char new_name[FN_REFLEN], *old_name=name;
- VOID(pthread_mutex_lock(&LOCK_log));
+ if (!inside_mutex)
+ VOID(pthread_mutex_lock(&LOCK_log));
if (generate_new_name(new_name, name))
{
- VOID(pthread_mutex_unlock(&LOCK_log));
+ if (!inside_mutex)
+ VOID(pthread_mutex_unlock(&LOCK_log));
return; // Something went wrong
}
if (log_type == LOG_BIN)
@@ -540,7 +542,8 @@
my_free(old_name,MYF(0));
last_time=query_start=0;
write_error=0;
- VOID(pthread_mutex_unlock(&LOCK_log));
+ if (!inside_mutex)
+ VOID(pthread_mutex_unlock(&LOCK_log));
}
}
@@ -695,9 +698,9 @@
if (file == &log_file)
VOID(pthread_cond_broadcast(&COND_binlog_update));
}
+ if (should_rotate)
+ new_file(1); // inside mutex
VOID(pthread_mutex_unlock(&LOCK_log));
- if(should_rotate)
- new_file();
return error;
}
@@ -782,11 +785,13 @@
VOID(pthread_cond_broadcast(&COND_binlog_update));
}
}
+
+ if(should_rotate)
+ new_file(1); // inside mutex
+
VOID(pthread_mutex_unlock(&LOCK_log));
}
- if(should_rotate)
- new_file();
return error;
}
--- 1.188/sql/mysqld.cc Fri Jul 6 15:30:51 2001
+++ 1.189/sql/mysqld.cc Wed Jul 11 19:29:14 2001
@@ -1477,6 +1477,13 @@
strmov(strcend(tmp,'.'),extension);
opt_name=tmp;
}
+ // get rid of extention if the log is binary to avoid problems
+ if (type == LOG_BIN)
+ {
+ char* p = strrchr(opt_name, FN_EXTCHAR);
+ if (p)
+ *p = 0;
+ }
log->open(opt_name,type);
}
--- 1.106/sql/slave.cc Sat Jul 7 14:17:13 2001
+++ 1.107/sql/slave.cc Wed Jul 11 19:29:14 2001
@@ -189,6 +189,11 @@
void end_slave()
{
+ pthread_mutex_lock(&LOCK_slave);
+ while (slave_running)
+ pthread_cond_wait(&COND_slave_stopped, &LOCK_slave);
+ pthread_mutex_unlock(&LOCK_slave);
+
end_master_info(&glob_mi);
if(do_table_inited)
hash_free(&replicate_do_table);
--- 1.65/sql/sql_class.h Wed Apr 25 13:44:56 2001
+++ 1.66/sql/sql_class.h Wed Jul 11 19:29:14 2001
@@ -74,7 +74,7 @@
void init(enum_log_type log_type_arg);
void open(const char *log_name,enum_log_type log_type,
const char *new_name=0);
- void new_file(void);
+ void new_file(bool inside_mutex = 0);
bool open_index(int options);
void close_index();
bool write(THD *thd, enum enum_server_command command,const char *format,...);
--- 1.39/sql/sql_repl.cc Thu Jun 28 19:16:37 2001
+++ 1.40/sql/sql_repl.cc Wed Jul 11 19:29:14 2001
@@ -274,6 +274,7 @@
int left_events = max_binlog_dump_events;
#endif
DBUG_ENTER("mysql_binlog_send");
+ bzero((char*) &log,sizeof(log));
#ifndef DBUG_OFF
if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2))
@@ -283,7 +284,6 @@
}
#endif
- bzero((char*) &log,sizeof(log));
if(!mysql_bin_log.is_open())
{
| Thread |
|---|
| • bk commit into 3.23 tree | sasha | 12 Jul |