diff options
author | unknown <mats@romeo.(none)> | 2006-11-10 15:10:41 +0100 |
---|---|---|
committer | unknown <mats@romeo.(none)> | 2006-11-10 15:10:41 +0100 |
commit | baaa102de52611e2eef0822bd129bf2ef343e4f1 (patch) | |
tree | d2bcf30804ac9fe4cbb41f7d84d8e565ef8ffe5f /sql/slave.cc | |
parent | 5bf5ccff63669bd8fcee74ecf0b1347058fb1be8 (diff) | |
download | mariadb-git-baaa102de52611e2eef0822bd129bf2ef343e4f1.tar.gz |
BUG#23171 (Illegal slave restart group position):
Second patch to fix skipping code. Moving relay and binary log
position changing code from do_apply_event [old exec_event()] into
do_update_pos() and doing other changes necessary to support that.
Fixing a bug that can cause deadlock if rotating binary log when committing
a changes to a transactional table that is not inside a transaction and
cause a rotate log.
sql/log.cc:
Changing condition in binlog_commit() to skip calling
binlog_end_trans() twice to match condition in binlog_end_trans().
sql/log_event.cc:
Name change: apply_event_impl() -> do_apply_event()
Name change: advance_coord_impl() -> do_update_pos()
do_apply_event() now uses pointer to constant RELAY_LOG_INFO to prevent
inadvertandly changing the position in the code. Doing this would make
the skipping code loose track of where it is. All position changing code
shall now be in do_update_pos().
Factoring out relay and binary log position updating code from
do_apply_event() [previously exec_event()] into do_update_pos().
Using a safe approach to make it work: will refine the refactoring
when the skipping code is implemented.
Adding const casts where needed.
Changing signature to use pointers to constant objects where needed.
sql/rpl_rli.cc:
Making cached_charset_compare() const to work with constant instances of RELAY_LOG_INFO.
Debriding code.
sql/rpl_rli.h:
Making cached_charset_compare() const to work with constant instances of RELAY_LOG_INFO.
Debriding code.
sql/rpl_utility.cc:
Using pointer to const RELAY_LOG_INFO to make it work with other code.
sql/rpl_utility.h:
Using pointer to const RELAY_LOG_INFO to make it work with other code.
sql/slave.cc:
Using pointer to const RELAY_LOG_INFO to make it work with other code.
Adding const cast where necessary.
sql/slave.h:
Using pointer to const RELAY_LOG_INFO to make it work with other code.
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 87f11417fcc..ed5f2aa5c44 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -555,7 +555,7 @@ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli) void */ -void slave_print_msg(enum loglevel level, RELAY_LOG_INFO* rli, +void slave_print_msg(enum loglevel level, RELAY_LOG_INFO const *rli, int err_code, const char* msg, ...) { void (*report_function)(const char *, ...); @@ -577,9 +577,9 @@ void slave_print_msg(enum loglevel level, RELAY_LOG_INFO* rli, It's an error, it must be reported in Last_error and Last_errno in SHOW SLAVE STATUS. */ - pbuff= rli->last_slave_error; + pbuff= const_cast<RELAY_LOG_INFO*>(rli)->last_slave_error; pbuffsize= sizeof(rli->last_slave_error); - rli->last_slave_errno = err_code; + const_cast<RELAY_LOG_INFO*>(rli)->last_slave_errno = err_code; report_function= sql_print_error; break; case WARNING_LEVEL: @@ -1376,7 +1376,7 @@ void set_slave_thread_options(THD* thd) DBUG_VOID_RETURN; } -void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli) +void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO const *rli) { DBUG_ENTER("set_slave_thread_default_charset"); @@ -1387,7 +1387,14 @@ void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli) thd->variables.collation_server= global_system_variables.collation_server; thd->update_charset(); - rli->cached_charset_invalidate(); + + /* + We use a const cast here since the conceptual (and externally + visible) behavior of the function is to set the default charset of + the thread. That the cache has to be invalidated is a secondary + effect. + */ + const_cast<RELAY_LOG_INFO*>(rli)->cached_charset_invalidate(); DBUG_VOID_RETURN; } @@ -1607,7 +1614,8 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings) } -int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int expected_error) +int check_expected_error(THD* thd, RELAY_LOG_INFO const *rli, + int expected_error) { DBUG_ENTER("check_expected_error"); |