3352 Andrei Elkin 2011-07-18
wl#5569 MTS
Cosmetic changes are done to address readability and clearness of source code of the MTS patch.
@ sql/binlog.cc
Comments improved.
@ sql/log_event.cc
Warning text is improved.
@ sql/log_event.h
More comments are added.
@ sql/rpl_rli.h
More comments are added.
@ sql/rpl_slave.cc
Error constant was changed.
@ sql/share/errmsg-utf8.txt
Error constant is changed.
modified:
sql/binlog.cc
sql/log_event.cc
sql/log_event.h
sql/rpl_rli.h
sql/rpl_slave.cc
sql/share/errmsg-utf8.txt
3351 Andrei Elkin 2011-07-18
wl#5569 MTS
Inadvertently introduced hunk two rev:s back is reverted to please rpl_*_mts_crash_safe.
modified:
sql/rpl_rli_pdb.cc
=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc 2011-07-16 17:08:31 +0000
+++ b/sql/binlog.cc 2011-07-18 18:46:45 +0000
@@ -4951,8 +4951,8 @@ THD::binlog_set_pending_rows_event(Rows_
@param db db name c-string to be inserted into alphabetically sorted
THD::binlog_accessed_db_names list.
- Note, as the list node data so the node
- struct itself are allocated in THD::main_mem_root.
+ Note, that space for both the data and the node
+ struct are allocated in THD::main_mem_root.
The list lasts for the top-level query time and is reset
in @c THD::cleanup_after_query().
*/
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2011-07-16 17:08:31 +0000
+++ b/sql/log_event.cc 2011-07-18 18:46:45 +0000
@@ -2735,8 +2735,9 @@ int Log_event::apply_event(Relay_log_inf
{
// handle synchronization error
rli->report(WARNING_LEVEL, 0,
- "Coordinator thread of multi-threaded slave found "
- "a failed to apply an event Worker.");
+ "Slave worker thread has failed to apply an event. As a "
+ "consequence, the coordinator thread is stopping "
+ "execution.");
DBUG_RETURN(-1);
}
/*
=== modified file 'sql/log_event.h'
--- a/sql/log_event.h 2011-07-16 21:51:45 +0000
+++ b/sql/log_event.h 2011-07-18 18:46:45 +0000
@@ -542,9 +542,11 @@ struct sql_ex_info
/**
MTS: group of events can be marked to force its execution
in isolation from any other Workers.
+ So it's a marker for Coordinator to memorize and perform necessary
+ operations in order to guarantee no interference from other Workers.
+ The flag can be set ON only for an event that terminates its group.
Typically that is done for a transaction that contains
a query accessing more than OVER_MAX_DBS_IN_EVENT_MTS databases.
- The flag can be set ON only for an event that terminates its group.
*/
#define LOG_EVENT_MTS_ISOLATE_F 0x200
@@ -1338,23 +1340,22 @@ private:
Besides the parallelizable case, some events have to be applied by
Coordinator concurrently with Workers and some to require synchronization
- with Workers before to apply them.
+ with Workers (@c see wait_for_workers_to_finish) before to apply them.
@retval EVENT_EXEC_PARALLEL if event is executed by a Worker
@retval EVENT_EXEC_ASYNC if event is executed by Coordinator
- @retval EVENT_EXEC_ASYNC if event is executed by Coordinator
+ @retval EVENT_EXEC_SYNC if event is executed by Coordinator
with synchronization against the Workers
*/
enum enum_mts_event_exec_mode get_mts_execution_mode(ulong slave_server_id,
bool mts_in_group)
{
if ((get_type_code() == FORMAT_DESCRIPTION_EVENT &&
- ((server_id == (uint32) ::server_id) || (log_pos == 0)))
- ||
+ ((server_id == (uint32) ::server_id) || (log_pos == 0))) ||
(get_type_code() == ROTATE_EVENT &&
((server_id == (uint32) ::server_id) ||
- (log_pos == 0 /* very first fake Rotate */
- && mts_in_group /* ignored events, R_f at slave restart */))))
+ (log_pos == 0 /* very first fake Rotate (R_f) */
+ && mts_in_group /* ignored event turned into R_f at slave stop */))))
return EVENT_EXEC_ASYNC;
else if (is_mts_sequential_exec())
return EVENT_EXEC_SYNC;
@@ -1385,6 +1386,8 @@ private:
in isolation from any other Workers.
Typically that is done for a transaction that contains
a query accessing more than OVER_MAX_DBS_IN_EVENT_MTS databases.
+ Factually that's a sequential mode where a Worker remains to
+ be the applier.
*/
virtual void set_mts_isolate_group()
{
@@ -1429,7 +1432,7 @@ public:
virtual bool starts_group() { return FALSE; }
/**
- @return TRUE if the event starts a group (transaction)
+ @return TRUE if the event ends a group (transaction)
FASE otherwise
*/
virtual bool ends_group() { return FALSE; }
=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h 2011-07-16 17:08:31 +0000
+++ b/sql/rpl_rli.h 2011-07-18 18:46:45 +0000
@@ -453,7 +453,12 @@ public:
/*
Ongoing excessive overrun counter to correspond to number of events that
are being scheduled while a WQ is close to be filled up.
- The counter describes level of saturation that Workers are experiencing.
+ `Close' is defined as (100 - mts_worker_underrun_level) %.
+ The counter is incremented each time a WQ get filled over that level
+ and decremented when the level drops below.
+ The counter therefore describes level of saturation that Workers
+ are experiencing and is used as a parameter to compute a nap time for
+ Coordinator in order to avoid reaching WQ limits.
*/
volatile long mts_wq_excess_cnt;
long mts_worker_underrun_level; // % of WQ size at which W is considered hungry
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2011-07-16 17:08:31 +0000
+++ b/sql/rpl_slave.cc 2011-07-18 18:46:45 +0000
@@ -1179,8 +1179,8 @@ static bool sql_slave_killed(THD* thd, R
if (is_parallel_warn)
rli->report(!rli->is_error() ? ERROR_LEVEL :
WARNING_LEVEL, // an error was reported by Worker
- ER_MTS_PARALLEL_INCONSISTENT_DATA,
- ER(ER_MTS_PARALLEL_INCONSISTENT_DATA),
+ ER_MTS_INCONSISTENT_DATA,
+ ER(ER_MTS_INCONSISTENT_DATA),
msg_stopped_mts);
else
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt 2011-07-16 17:08:31 +0000
+++ b/sql/share/errmsg-utf8.txt 2011-07-18 18:46:45 +0000
@@ -6518,5 +6518,5 @@ ER_MTS_UPDATED_DBS_GREATER_MAX
eng "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata."
ER_MTS_CANT_PARALLEL
eng "Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s."
-ER_MTS_PARALLEL_INCONSISTENT_DATA
+ER_MTS_INCONSISTENT_DATA
eng "%s"
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-next-mr-wl5569 branch (andrei.elkin:3351 to 3352) WL#5569 | Andrei Elkin | 19 Jul |