3289 Andrei Elkin 2011-06-14
wl#5569 MTS
wl#5754 Query event parallel execution
Fixing failing tests and a failure in gathering accessed databases that was caused
by a recent merge from trunk.
@ mysql-test/suite/rpl/r/rpl_parallel_multi_db.result
results updated.
@ mysql-test/suite/rpl/r/rpl_parallel_seconds_behind_master.result
results updated.
@ mysql-test/suite/rpl/r/rpl_parallel_start_stop.result
results updated.
@ mysql-test/suite/rpl/t/rpl_parallel_multi_db.test
moving mtr.add_supp to eliminate possibility of warning in the slave's error;
adding graceful termination lines the test.
@ mysql-test/suite/rpl/t/rpl_parallel_seconds_behind_master.test
moving mtr.add_supp to eliminate possibility of warning in the slave's error.
@ mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
Suppression are added for errors that are expected by test logics;
adding graceful termination lines the test.
@ sql/log_event.cc
fixing the last argument to report() which should be c-string;
fixing gathering of db:s on the master side. Because of a query can be preceeded in binlog
by engineered BEGIN (the current pattern of logging from the trunk) resetting in Query::write()
can't be any longer.
However another reset point exists at the end of the top-level query and that suffices.
@ sql/rpl_rli.h
is_mts_in_group() to mimic STS' is_in_group() is added though semantics are different.
@ sql/rpl_slave.cc
further cleanup in sql_slave_killed() as requested by reviewers.
modified:
mysql-test/suite/rpl/r/rpl_parallel_multi_db.result
mysql-test/suite/rpl/r/rpl_parallel_seconds_behind_master.result
mysql-test/suite/rpl/r/rpl_parallel_start_stop.result
mysql-test/suite/rpl/t/rpl_parallel_multi_db.test
mysql-test/suite/rpl/t/rpl_parallel_seconds_behind_master.test
mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
sql/log_event.cc
sql/rpl_rli.h
sql/rpl_slave.cc
3288 Andrei Elkin 2011-06-14 [merge]
merge from trunk
modified:
mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
sql/rpl_info.cc
sql/rpl_info.h
sql/rpl_mi.cc
sql/rpl_mi.h
sql/rpl_rli.cc
sql/rpl_rli.h
sql/rpl_rli_pdb.cc
sql/rpl_rli_pdb.h
sql/rpl_slave.cc
=== modified file 'mysql-test/suite/rpl/r/rpl_parallel_multi_db.result'
--- a/mysql-test/suite/rpl/r/rpl_parallel_multi_db.result 2011-05-30 10:05:07 +0000
+++ b/mysql-test/suite/rpl/r/rpl_parallel_multi_db.result 2011-06-14 18:23:13 +0000
@@ -369,3 +369,5 @@ include/diff_tables.inc [master:d3.t1, s
include/diff_tables.inc [master:d2.t1, slave:d2.t1]
include/diff_tables.inc [master:d1.t1, slave:d1.t1]
set @@global.mts_slave_parallel_workers= @save.mts_slave_parallel_workers;
+include/rpl_end.inc
+end of the tests
=== modified file 'mysql-test/suite/rpl/r/rpl_parallel_seconds_behind_master.result'
--- a/mysql-test/suite/rpl/r/rpl_parallel_seconds_behind_master.result 2011-06-10 08:04:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_parallel_seconds_behind_master.result 2011-06-14 18:23:13 +0000
@@ -1,6 +1,5 @@
include/master-slave.inc
[connection master]
-call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT');
include/stop_slave.inc
set @save.mts_slave_parallel_workers= @@global.mts_slave_parallel_workers;
set @@global.mts_slave_parallel_workers= 4;
=== modified file 'mysql-test/suite/rpl/r/rpl_parallel_start_stop.result'
--- a/mysql-test/suite/rpl/r/rpl_parallel_start_stop.result 2011-02-27 17:35:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_parallel_start_stop.result 2011-06-14 18:23:13 +0000
@@ -1,5 +1,7 @@
include/master-slave.inc
[connection master]
+call mtr.add_suppression('Slave SQL: Could not execute Write_rows event on table test.t1');
+call mtr.add_suppression('Slave SQL: Could not execute Update_rows event on table test.t1; Deadlock found when trying to get lock');
create view worker_proc_list as SELECT id from Information_Schema.processlist
where state like 'Waiting for an event from sql thread%';
create view coord_proc_list as SELECT id from Information_Schema.processlist where state like 'Slave has read all relay log%';
@@ -56,17 +58,17 @@ set @save.slave_transaction_retries= @@g
set @@global.slave_transaction_retries= 1;
start slave sql_thread;
Warnings:
-Note 1726 Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
+Note 1737 Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
include/stop_slave.inc
create table t2 (a int);
insert into t2 values (1);
start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
Warnings:
-Note 1726 UNTIL condtion is not supported in Parallel Slave. Slave is started in the sequential execution mode.
+Note 1737 UNTIL condtion is not supported in Parallel Slave. Slave is started in the sequential execution mode.
include/wait_for_slave_sql_to_stop.inc
include/start_slave.inc
Warnings:
-Note 1726 Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
+Note 1737 Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
drop table t1;
drop table t2m;
drop table t2;
@@ -74,5 +76,5 @@ drop view worker_proc_list;
drop view coord_proc_list;
set @@global.mts_slave_parallel_workers= @save.mts_slave_parallel_workers;
set @@global.slave_transaction_retries= @save.slave_transaction_retries;
-end of the tests
include/rpl_end.inc
+end of the tests
=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_multi_db.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_multi_db.test 2011-05-24 14:29:35 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_multi_db.test 2011-06-14 18:23:13 +0000
@@ -8,10 +8,6 @@
--source include/master-slave.inc
--source include/have_binlog_format_statement.inc
---disable_query_log
-call mtr.add_suppression('.*Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*');
---enable_query_log
-
# restart in Parallel
let $workers= 4;
@@ -34,6 +30,10 @@ let $queries= `select $dbs*$tables * 4`;
connection master;
+--disable_query_log
+call mtr.add_suppression('.*Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*');
+--enable_query_log
+
# create & populate
let $n= $dbs;
@@ -349,4 +349,6 @@ sync_slave_with_master;
set @@global.mts_slave_parallel_workers= @save.mts_slave_parallel_workers;
-### TODO: --source include/rpl_end.inc
+--source include/rpl_end.inc
+
+--echo end of the tests
=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_seconds_behind_master.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_seconds_behind_master.test 2011-06-12 17:36:17 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_seconds_behind_master.test 2011-06-14 18:23:13 +0000
@@ -16,8 +16,6 @@
# on SHOW PROCESS LIST output in some of the tests)
-- source include/have_binlog_format_statement.inc
-# todo: sleep() is deterministic!!!
-call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT');
# restart slave in MTS mode
connection slave;
@@ -48,6 +46,11 @@ source include/wait_for_slave_io_to_star
connection master;
+--disable_query_log
+# todo: sleep() is deterministic!!!
+call mtr.add_suppression('.*Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*');
+--enable_query_log
+
create table t1 (f1 int) engine=innodb;
create table t2 (f1 int) engine=innodb;
save_master_pos;
=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_start_stop.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test 2011-05-16 19:43:58 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test 2011-06-14 18:23:13 +0000
@@ -13,6 +13,9 @@
connection slave;
+call mtr.add_suppression('Slave SQL: Could not execute Write_rows event on table test.t1');
+call mtr.add_suppression('Slave SQL: Could not execute Update_rows event on table test.t1; Deadlock found when trying to get lock');
+
create view worker_proc_list as SELECT id from Information_Schema.processlist
where state like 'Waiting for an event from sql thread%';
create view coord_proc_list as SELECT id from Information_Schema.processlist where state like 'Slave has read all relay log%';
@@ -271,7 +274,7 @@ drop view worker_proc_list;
drop view coord_proc_list;
set @@global.mts_slave_parallel_workers= @save.mts_slave_parallel_workers;
set @@global.slave_transaction_retries= @save.slave_transaction_retries;
---echo end of the tests
-### TODO: restore --source include/rpl_end.inc
---echo include/rpl_end.inc
+--source include/rpl_end.inc
+
+--echo end of the tests
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2011-06-14 09:27:38 +0000
+++ b/sql/log_event.cc 2011-06-14 18:23:13 +0000
@@ -2412,6 +2412,7 @@ Slave_worker *Log_event::get_slave_worke
int num_dbs= 0;
Slave_worker *ret_worker= NULL;
THD *thd= rli->info_thd;
+ char llbuff[22];
/* checking partioning properties and perform corresponding actions */
@@ -2497,6 +2498,7 @@ Slave_worker *Log_event::get_slave_worke
&mts_assigned_partitions[i],
TRUE, ret_worker)))
{
+ llstr(rli->get_event_relay_log_pos(), llbuff);
rli->report(ERROR_LEVEL, ER_MTS_CANT_PARALLEL,
ER(ER_MTS_CANT_PARALLEL),
get_type_str(), rli->get_event_relay_log_name(),
@@ -2554,11 +2556,12 @@ Slave_worker *Log_event::get_slave_worke
get_type_code() == APPEND_BLOCK_EVENT))
{
DBUG_ASSERT(!ret_worker);
-
+
+ llstr(rli->get_event_relay_log_pos(), llbuff);
rli->report(ERROR_LEVEL, ER_MTS_CANT_PARALLEL,
ER(ER_MTS_CANT_PARALLEL),
get_type_str(), rli->get_event_relay_log_name(),
- rli->get_event_relay_log_pos());
+ llbuff);
return ret_worker;
}
@@ -2896,11 +2899,13 @@ int Log_event::apply_event(Relay_log_inf
*/
if (rli->curr_group_da.elements > 0)
{
+ char llbuff[22];
/*
Possible reason is a old version binlog sequential event
wrappped with BEGIN/COMMIT or preceeded by User|Int|Random- var.
MTS has to stop to suggest restart in the permanent sequential mode.
*/
+ llstr(c_rli->get_event_relay_log_pos(), llbuff);
rli->report(ERROR_LEVEL, ER_MTS_CANT_PARALLEL,
ER(ER_MTS_CANT_PARALLEL),
get_type_str(), c_rli->get_event_relay_log_name(),
@@ -3468,7 +3473,6 @@ bool Query_log_event::write(IO_CACHE* fi
start += strlen(db_name) + 1;
}
}
- thd->clear_binlog_accessed_db_names();
}
/*
=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h 2011-06-14 10:35:20 +0000
+++ b/sql/rpl_rli.h 2011-06-14 18:23:13 +0000
@@ -531,6 +531,16 @@ public:
}
/**
+ returns true if Coordinator is scheduling events belonging to
+ the same group and has not reached yet its terminal event.
+ */
+ inline bool is_mts_in_group()
+ {
+ return is_parallel_exec() &&
+ mts_group_status == MTS_IN_GROUP;
+ }
+
+ /**
While a group is executed by a Worker the relay log can change.
Coordinator notifies Workers about this event. Worker is supposed
to commit to the recovery table with the new info.
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2011-06-14 10:35:20 +0000
+++ b/sql/rpl_slave.cc 2011-06-14 18:23:13 +0000
@@ -1023,14 +1023,14 @@ static bool io_slave_killed(THD* thd, Ma
The function analyzes a possible killed status and makes
a decision whether to accept it or not.
Normally upon accepting the sql thread goes to shutdown.
- In the event of deffering decision @rli->last_event_start_time waiting
+ In the event of deferring decision @rli->last_event_start_time waiting
timer is set to force the killed status be accepted upon its expiration.
- Notice Multi-Threaded-Slave behaives similarly in that when it's being
+ Notice Multi-Threaded-Slave behaves similarly in that when it's being
stopped and the current group of assigned events has not yet scheduled
- completely, Coordinator deferres to accept to leave its read-distribute
+ completely, Coordinator defers to accept to leave its read-distribute
state. The above timeout ensures waiting won't last endlessly, and in
- such case an error is repoted.
+ such case an error is reported.
@param thd pointer to a THD instance
@param rli pointer to Relay_log_info instance
@@ -1049,8 +1049,12 @@ static bool sql_slave_killed(THD* thd, R
DBUG_ASSERT(rli->slave_running == 1);
if (abort_loop || thd->killed || rli->abort_slave)
{
- if ((is_parallel_group= (rli->is_parallel_exec() &&
- rli->mts_group_status == Relay_log_info::MTS_IN_GROUP))
+ /*
+ Slave can execute stop being in one of two MTS or Single-Threaded mode.
+ The modes define different criteria to accept the stop.
+ In particular that relates to the concept of groupping.
+ */
+ if ((is_parallel_group= rli->is_mts_in_group())
||
(!rli->is_parallel_exec() &&
thd->transaction.all.cannot_safely_rollback() && rli->is_in_group()))
@@ -1074,7 +1078,8 @@ static bool sql_slave_killed(THD* thd, R
if (rli->abort_slave)
{
DBUG_PRINT("info", ("Request to stop slave SQL Thread received while "
- "applying a group that has non-transactional "
+ "applying an MTS group or a group that "
+ "has non-transactional "
"changes; waiting for completion of the group ... "));
/*
@@ -1104,8 +1109,8 @@ static bool sql_slave_killed(THD* thd, R
"applying a group that has non-transactional "
"changes; waiting for completion of the group ... "
:
- "Coordinator thread of multi-threaded slave is being stopped "
- "in the middle of assigning a group of events; "
+ "Coordinator thread of multi-threaded slave is being "
+ "stopped in the middle of assigning a group of events; "
"deferring to exit until the group completion ... ");
}
else
@@ -5900,7 +5905,10 @@ static Log_event* next_event(Relay_log_i
*/
/* shows zero while it is sleeping (and until the next event
- is about to be executed) */
+ is about to be executed).
+ Note, in MTS case Seconds_Behind_Master resetting follows
+ slightly different schema where reaching EOF is not enough.
+ */
if (!rli->is_parallel_exec())
rli->last_master_timestamp= 0;
@@ -5986,6 +5994,7 @@ static Log_event* next_event(Relay_log_i
mysql_mutex_unlock(log_lock);
mts_checkpoint_routine(rli, period, FALSE, FALSE); // TODO: ALFRANIO ERROR
mysql_mutex_lock(log_lock);
+ // More to the empty relay-log all assigned events done so reset it.
if (rli->gaq->empty())
rli->last_master_timestamp= 0;
Attachment: [text/bzr-bundle] bzr/andrei.elkin@oracle.com-20110614182313-8sfkqyq20ze7qtux.bundle
| Thread |
|---|
| • bzr push into mysql-next-mr-wl5569 branch (andrei.elkin:3288 to 3289)WL#5569 WL#5754 | Andrei Elkin | 14 Jun |