Below is the list of changes that have just been committed into a local
5.0 repository of sergeyv. When sergeyv does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2025 05/11/03 18:25:43 SergeyV@selena. +3 -0
Fixes bug #13377. Additional patch - remove reference counting for
opened binlog files, introduced in initial patch of #13377.
sql/sql_repl.cc
1.145 05/11/03 18:02:46 SergeyV@selena. +6 -39
Fixes bug #13377. Additional patch - remove reference counting for
opened binlog files, introduced in initial patch of #13377.
sql/sql_class.h
1.272 05/11/03 18:02:45 SergeyV@selena. +1 -7
Fixes bug #13377. Additional patch - remove reference counting for
opened binlog files, introduced in initial patch of #13377.
sql/log.cc
1.181 05/11/03 18:02:45 SergeyV@selena. +1 -78
Fixes bug #13377. Additional patch - remove reference counting for
opened binlog files, introduced in initial patch of #13377.
# 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: SergeyV
# Host: selena.
# Root: H:/MYSQL/src/#13377-mysql-5.0
--- 1.180/sql/log.cc 2005-10-21 17:16:59 +04:00
+++ 1.181/sql/log.cc 2005-11-03 18:02:45 +03:00
@@ -357,8 +357,7 @@
MYSQL_LOG::MYSQL_LOG()
:bytes_written(0), last_time(0), query_start(0), name(0),
file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0), inited(0),
- need_start_event(1), reset_pending(false), readers_count(0),
- prepared_xids(0), description_event_for_exec(0),
+ need_start_event(1), prepared_xids(0), description_event_for_exec(0),
description_event_for_queue(0)
{
/*
@@ -385,9 +384,7 @@
delete description_event_for_exec;
(void) pthread_mutex_destroy(&LOCK_log);
(void) pthread_mutex_destroy(&LOCK_index);
- (void) pthread_mutex_destroy(&LOCK_readers);
(void) pthread_cond_destroy(&update_cond);
- (void) pthread_cond_destroy(&reset_cond);
}
DBUG_VOID_RETURN;
}
@@ -432,9 +429,7 @@
inited= 1;
(void) pthread_mutex_init(&LOCK_log,MY_MUTEX_INIT_SLOW);
(void) pthread_mutex_init(&LOCK_index, MY_MUTEX_INIT_SLOW);
- (void) pthread_mutex_init(&LOCK_readers, MY_MUTEX_INIT_SLOW);
(void) pthread_cond_init(&update_cond, 0);
- (void) pthread_cond_init(&reset_cond, 0);
}
const char *MYSQL_LOG::generate_name(const char *log_name,
@@ -938,12 +933,6 @@
pthread_mutex_lock(&LOCK_log);
pthread_mutex_lock(&LOCK_index);
- /*
- we need one more lock to block attempts to open a log while
- we are waiting untill all log files will be closed
- */
- pthread_mutex_lock(&LOCK_readers);
-
/*
The following mutex is needed to ensure that no threads call
'delete thd' as we would then risk missing a 'rollback' from this
@@ -966,19 +955,6 @@
goto err;
}
- reset_pending= true;
- /*
- send update signal just in case so that all reader threads waiting
- for log update will leave wait condition
- */
- signal_update();
- /*
- if there are active readers wait until all of them will
- release opened files
- */
- while (readers_count)
- pthread_cond_wait(&reset_cond, &LOCK_log);
-
for (;;)
{
my_delete(linfo.log_file_name, MYF(MY_WME));
@@ -997,10 +973,7 @@
my_free((gptr) save_name, MYF(0));
err:
- reset_pending= false;
-
(void) pthread_mutex_unlock(&LOCK_thread_count);
- pthread_mutex_unlock(&LOCK_readers);
pthread_mutex_unlock(&LOCK_index);
pthread_mutex_unlock(&LOCK_log);
DBUG_RETURN(error);
@@ -2073,9 +2046,6 @@
{
const char *old_msg;
DBUG_ENTER("wait_for_update");
-
- if (reset_pending)
- DBUG_VOID_RETURN;
old_msg= thd->enter_cond(&update_cond, &LOCK_log,
is_slave ?
@@ -2324,53 +2294,6 @@
{
DBUG_ENTER("MYSQL_LOG::signal_update");
pthread_cond_broadcast(&update_cond);
- DBUG_VOID_RETURN;
-}
-
-/*
- 21.10.05 SergeyV
- In order to avoid deleting of opened files as part of reset master
- it is implemented a reference counting code for log readers.
- On each log file open operation log reader should call readers_addref()
- On each log file close operation log reader should call readers_release()
-
- When there is at least one active reader (readers_count > 0) reset_master()
- will wait until (readers_count == 0).
-
- readers_release() does not block when reset_master is pending
- readers_addref() will block until reset_master is completed
-
- once (readers_count == 0) readers_release() broadcasts reset_cond event
- so that reset_master can procede, when reset_master procedes all reader
- threads will wait on LOCK_log mutex until reset_master is complete
-
- See also mysql_binlog_send() in sql_repl.cc, reset_master() in log.cc
-*/
-
-void MYSQL_LOG::readers_addref()
-{
- /*
- There is no necessity for reference counting on *nix, since it allows to
- delete opened files, however it is more clean way to wait
- untill all files will be closed on *nix as well.
- */
- DBUG_ENTER("MYSQL_LOG::reader_addref");
- pthread_mutex_lock(&LOCK_log);
- pthread_mutex_lock(&LOCK_readers);
- readers_count++;
- pthread_mutex_unlock(&LOCK_readers);
- pthread_mutex_unlock(&LOCK_log);
- DBUG_VOID_RETURN;
-}
-
-void MYSQL_LOG::readers_release()
-{
- DBUG_ENTER("MYSQL_LOG::reader_release");
- pthread_mutex_lock(&LOCK_log);
- readers_count--;
- if (!readers_count)
- pthread_cond_broadcast(&reset_cond);
- pthread_mutex_unlock(&LOCK_log);
DBUG_VOID_RETURN;
}
--- 1.271/sql/sql_class.h 2005-10-21 17:17:01 +04:00
+++ 1.272/sql/sql_class.h 2005-11-03 18:02:45 +03:00
@@ -189,9 +189,8 @@
{
private:
/* LOCK_log and LOCK_index are inited by init_pthread_objects() */
- pthread_mutex_t LOCK_log, LOCK_index, LOCK_readers;
+ pthread_mutex_t LOCK_log, LOCK_index;
pthread_cond_t update_cond;
- pthread_cond_t reset_cond;
ulonglong bytes_written;
time_t last_time,query_start;
IO_CACHE log_file;
@@ -225,8 +224,6 @@
fix_max_relay_log_size).
*/
ulong max_size;
- bool reset_pending;
- ulong readers_count;
ulong prepared_xids; /* for tc log - number of xids to remember */
pthread_mutex_t LOCK_prep_xids;
@@ -337,9 +334,6 @@
int purge_logs_before_date(time_t purge_time);
int purge_first_log(struct st_relay_log_info* rli, bool included);
bool reset_logs(THD* thd);
- inline bool is_reset_pending() { return reset_pending; }
- void readers_addref();
- void readers_release();
void close(uint exiting);
// iterating through the log index file
--- 1.144/sql/sql_repl.cc 2005-10-21 17:17:02 +04:00
+++ 1.145/sql/sql_repl.cc 2005-11-03 18:02:46 +03:00
@@ -343,7 +343,6 @@
}
#endif
-restart:
if (!mysql_bin_log.is_open())
{
errmsg = "Binary log is not open";
@@ -373,11 +372,6 @@
goto err;
}
- /*
- Call readers_addref before opening log to track count
- of binlog readers
- */
- mysql_bin_log.readers_addref();
if ((file=open_binlog(&log, log_file_name, &errmsg)) < 0)
{
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
@@ -575,8 +569,7 @@
goto err;
if (!(flags & BINLOG_DUMP_NON_BLOCK) &&
- mysql_bin_log.is_active(log_file_name) &&
- !mysql_bin_log.is_reset_pending())
+ mysql_bin_log.is_active(log_file_name))
{
/*
Block until there is more data in the log
@@ -691,16 +684,6 @@
bool loop_breaker = 0;
/* need this to break out of the for loop from switch */
- /* if we are going to switch log file anyway, close current log first */
- end_io_cache(&log);
- (void) my_close(file, MYF(MY_WME));
- file= -1;
- /* decrease reference count of binlog readers */
- mysql_bin_log.readers_release();
-
- if (mysql_bin_log.is_reset_pending())
- linfo.index_file_offset= 0;
-
thd->proc_info = "Finished reading one binlog; switching to next binlog";
switch (mysql_bin_log.find_next_log(&linfo, 1)) {
case LOG_INFO_EOF:
@@ -709,25 +692,16 @@
case 0:
break;
default:
- /* need following call to do release on err label */
- mysql_bin_log.readers_addref();
errmsg = "could not find next log";
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
goto err;
}
- if (loop_breaker)
- {
- /* need following call to do release on end label */
- mysql_bin_log.readers_addref();
- break;
- }
-
- /*
- Call readers_addref before opening log to track count
- of binlog readers
- */
- mysql_bin_log.readers_addref();
+ if (loop_breaker)
+ break;
+
+ end_io_cache(&log);
+ (void) my_close(file, MYF(MY_WME));
/*
Call fake_rotate_event() in case the previous log (the one which
@@ -760,12 +734,7 @@
end_io_cache(&log);
if (file >= 0)
- {
(void)my_close(file, MYF(MY_WME));
- file= -1;
- }
- /* decrease reference count of binlog readers */
- mysql_bin_log.readers_release();
send_eof(thd);
thd->proc_info = "Waiting to finalize termination";
@@ -792,8 +761,6 @@
pthread_mutex_unlock(&LOCK_thread_count);
if (file >= 0)
(void) my_close(file, MYF(MY_WME));
- /* decrease reference count of binlog readers */
- mysql_bin_log.readers_release();
my_message(my_errno, errmsg, MYF(0));
DBUG_VOID_RETURN;
| Thread |
|---|
| • bk commit into 5.0 tree (SergeyV:1.2025) BUG#13377 | sergeyv | 3 Nov |