summaryrefslogtreecommitdiff
path: root/sql/log_event.h
diff options
context:
space:
mode:
authorPedro Gomes <pedro.gomes@oracle.com>2013-02-15 21:57:35 +0000
committerPedro Gomes <pedro.gomes@oracle.com>2013-02-15 21:57:35 +0000
commit7e8c887786dc76c0057acb5a73ff4355a4ea87b1 (patch)
tree76e93daf7767dbb400bbf4724d4e52c5f9285a16 /sql/log_event.h
parent795b8acc2a50e9d47945841ce2c3f08d4ad9db03 (diff)
downloadmariadb-git-7e8c887786dc76c0057acb5a73ff4355a4ea87b1.tar.gz
BUG#13545447: RPL_ROTATE_LOGS FAILS DUE TO CONCURRENCY ISSUES IN REP. CODE
In method mysql_binlog_send, right after detecting a EOF in the read event loop, and before deciding if we should change to a new binlog file there is a execution window where new events can be written to the binlog and a rotation can happen. When reaching the test, the function will then change to a new binlog file ignoring all the events written in this window. This will result in events not being replicated. Only when the binlog is detected as deactivated in the event loop of the dump thread, can we really know that no more events remain. For this reason, this test is now made under the log lock in the beginning of the event loop when reading the events.
Diffstat (limited to 'sql/log_event.h')
-rw-r--r--sql/log_event.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/sql/log_event.h b/sql/log_event.h
index 4c8580eb2fd..4fabb83aac7 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -945,8 +945,34 @@ public:
pthread_mutex_t* log_lock,
const Format_description_log_event
*description_event);
+
+ /**
+ Reads an event from a binlog or relay log. Used by the dump thread
+ this method reads the event into a raw buffer without parsing it.
+
+ @Note If mutex is 0, the read will proceed without mutex.
+
+ @Note If a log name is given than the method will check if the
+ given binlog is still active.
+
+ @param[in] file log file to be read
+ @param[out] packet packet to hold the event
+ @param[in] lock the lock to be used upon read
+ @param[in] log_file_name_arg the log's file name
+ @param[out] is_binlog_active is the current log still active
+
+ @retval 0 success
+ @retval LOG_READ_EOF end of file, nothing was read
+ @retval LOG_READ_BOGUS malformed event
+ @retval LOG_READ_IO io error while reading
+ @retval LOG_READ_MEM packet memory allocation failed
+ @retval LOG_READ_TRUNC only a partial event could be read
+ @retval LOG_READ_TOO_LARGE event too large
+ */
static int read_log_event(IO_CACHE* file, String* packet,
- pthread_mutex_t* log_lock);
+ pthread_mutex_t* log_lock,
+ const char *log_file_name_arg= NULL,
+ bool* is_binlog_active= false);
/*
init_show_field_list() prepares the column names and types for the
output of SHOW BINLOG EVENTS; it is used only by SHOW BINLOG