List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:December 11 2010 7:00pm
Subject:bzr commit into mysql-next-mr-wl5569 branch (andrei.elkin:3241) WL#5569
View as plain text  
#At file:///home/andrei/MySQL/BZR/2a-23May/WL/mysql-next-mr-wl5569/ based on revid:andrei.elkin@stripped

 3241 Andrei Elkin	2010-12-11
      wl#5569 MTS
      
      1. Fixing recovery related issue of  
         DBUG_ASSERT(rli->get_event_relay_log_pos() >= BIN_LOG_HEADER_SIZE);
         at slave start with shifting mts_recovery_routine() at front of the assert.
      
      2. Making SKIP-ed event to commit to the central RLI. That is correct since
         Workers are not executing anything at this time.
      
      3. Fixing the default for mts_checkpoint_period which should not be zero normally.
         Zero makes sense solely for debugging (so we may stress that through VALID_RANGE(1,...).
      
      4. Introduced a general mts-unsupported error/warning to apply to cases of non-zero parallel
         workers and a feature that parallelization can't work with.
     @ mysql-test/suite/rpl/r/rpl_parallel_start_stop.result
        results are updated.
     @ mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
        Extending the test to cover UNTIL, SKIP, a temporary to the regular error escalation.

    modified:
      mysql-test/suite/rpl/r/rpl_parallel_start_stop.result
      mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
      sql/rpl_rli_pdb.cc
      sql/rpl_slave.cc
      sql/share/errmsg-utf8.txt
      sql/sys_vars.cc
=== modified file 'mysql-test/suite/rpl/r/rpl_parallel_start_stop.result'
--- a/mysql-test/suite/rpl/r/rpl_parallel_start_stop.result	2010-12-02 17:46:46 +0000
+++ b/mysql-test/suite/rpl/r/rpl_parallel_start_stop.result	2010-12-11 19:00:47 +0000
@@ -10,21 +10,77 @@ create view coord_proc_list  as SELECT i
 include/stop_slave.inc
 set @save.slave_parallel_workers= @@global.slave_parallel_workers;
 set @@global.slave_parallel_workers= 4;
+Warnings:
+Note	1724	Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
 include/start_slave.inc
 select min(id) from worker_proc_list into @w_id;
 kill query @w_id;
+Warnings:
+Note	1724	Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
 include/start_slave.inc
 select id from coord_proc_list into @c_id;
 kill query @c_id;
+Warnings:
+Note	1724	Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
 include/start_slave.inc
-CREATE TABLE t1 (a int primary key);
+CREATE TABLE t1 (a int primary key) engine=innodb;
 insert into t1 values (1),(2);
 insert into t1 values (3);
 insert into t1 values (3);
+delete from t1 where a=3;
+Warnings:
+Note	1724	Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
+include/start_slave.inc
 delete from t1;
+insert into t1 values (1),(2),(3);
+create table t2m (a int) engine=myisam;
+insert into t2m values (1);
+begin;
+update t1 set a=31 where a=3;
+insert into t1 values (5),(6),(7);
+begin;
+update t1 set a=20 where a=2;
+insert into t2m values (2);
+update t1 set a=30 where a=3;
+commit;
+update t1 set a=21 where a=2;
+rollback;
+Warnings:
+Note	1724	Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
+include/start_slave.inc
+stop slave sql_thread;
+set @@global.sql_slave_skip_counter=7;
+begin;
+select max(a) + 1 from t1 into @a;
+insert into t1 set a=@a;
+commit;
+begin;
+select max(a) + 1 from t1 into @a;
+insert into t1 set a=@a;
+commit;
+begin;
+select max(a) + 1 from t1 into @a;
+insert into t1 set a=@a;
+commit;
+set @save.slave_transaction_retries= @@global.slave_transaction_retries;
+set @@global.slave_transaction_retries= 1;
+start slave sql_thread;
+Warnings:
+Note	1724	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=2311;
+Warnings:
+Note	1724	UNTIL condtion is not supported in Parallel Slave. Slave is started in the sequential execution mode.
+Warnings:
+Note	1724	Temporary failed transaction retry is not supported in Parallel Slave. Such failure will force the slave to stop.
 include/start_slave.inc
 drop table t1;
+drop table t2m;
+drop table t2;
 drop view worker_proc_list;
 drop view coord_proc_list;
 set @@global.slave_parallel_workers= @save.slave_parallel_workers;
+set @@global.slave_transaction_retries= @save.slave_transaction_retries;
 end of the tests

=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_start_stop.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test	2010-12-10 12:10:20 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test	2010-12-11 19:00:47 +0000
@@ -3,6 +3,9 @@
 #
 # The test checks START and STOP, graceful, killing or 
 # due to an error of a Worker.
+# START is considered to be with UNTIL that forces the sequential execution mode
+# and with non-zero @@global.sql_slave_skip_counter that is compatible to
+# the parallel mode.
 #
 
 source include/master-slave.inc;
@@ -64,18 +67,21 @@ source include/wait_for_slave_sql_to_sto
 
 source include/start_slave.inc;
 
-#
+##
 # Errored-out Worker stops the pool and the Coordinator
+##
+
+# 
+# A. A regular error case
 #
 connection master;
 
 # make some load
 
-CREATE TABLE t1 (a int primary key);
+CREATE TABLE t1 (a int primary key) engine=innodb;
 
 insert into t1 values (1),(2);
 
-
 sync_slave_with_master;
 #connection slave;
 
@@ -98,14 +104,158 @@ let $table= worker_proc_list;
 source include/wait_until_rows_count.inc;
 
 source include/wait_for_slave_sql_to_stop.inc;
+delete from t1 where a=3;
+
+source include/start_slave.inc;
+
+connection master;
+
+sync_slave_with_master;
+#connection slave;
+
+# cleanup but leaving on t1
+
+connection master;
 delete from t1;
 
+sync_slave_with_master;
+#connection slave;
+
+#
+# B. In a temporary error execution is not retried
+#
+
+connection master;
+insert into t1 values (1),(2),(3);
+create table t2m (a int) engine=myisam; # non-trans engine to detect deadlock
+insert into t2m values (1);
+
+sync_slave_with_master;
+#connection slave;
+
+begin;
+# set up a deadlock
+update t1 set a=31 where a=3;
+insert into t1 values (5),(6),(7);
+
+connection master;
+
+begin;
+update t1 set a=20 where a=2;
+insert into t2m values (2);
+update t1 set a=30 where a=3;
+commit;
+
+
+connection slave;
+
+let $count= 2;
+let $table= t2m;
+source include/wait_until_rows_count.inc;
+
+# must victimize the master trans because of deadlock or timeout
+update t1 set a=21 where a=2;
+
+# slave is stopped
+
+let $slave_sql_errno= 1213, 1205; 
+source include/wait_for_slave_sql_error.inc;
+
+##source include/wait_for_slave_sql_to_stop.inc;
+
+rollback;
+
 source include/start_slave.inc;
 
-# cleanup
+connection master;
+
+# recovery is proved
+sync_slave_with_master;
+#connection slave;
+
+
+#
+# Skipping works with Parallel slave
+#
+
+connection slave;
+stop slave sql_thread;
+set @@global.sql_slave_skip_counter=7;
+
+connection master;
+
+# the following creates 8 events 
+begin;
+select max(a) + 1 from t1 into @a;
+insert into t1 set a=@a;
+commit;
+begin;
+select max(a) + 1 from t1 into @a;
+insert into t1 set a=@a;
+commit;
+
+# which will force to skip the two above transactions by the slave
+# And the third will be executed:
+
+begin;
+select max(a) + 1 from t1 into @a;
+insert into t1 set a=@a;
+commit;
+
+connection slave;
+
+set @save.slave_transaction_retries= @@global.slave_transaction_retries;
+set @@global.slave_transaction_retries= 1; # must cause a warning
+start slave sql_thread;
+
+connection master;
+let $a=`select max(a) from t1`;
+
+sync_slave_with_master;
+#connection slave;
+
+if (`select $a - max(a) from t1`)
+{
+    eval select $a as 'max(a) from t1 on master';
+    eval select max(a) as 'max(a) from t1 on slave' from t1;
+    --die Wrong skipping logics or a flaw in the test
+}
+
+#
+# UNTIL condition is not supported by Parallel slave to reject
+# with a warning and no Worker thread is started
+#
+
+connection slave;
+source include/stop_slave.inc;
+
+connection master;
+create table t2 (a int);
 
+let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1);
+let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+
+insert into t2 values (1);
+
+connection slave;
+eval start slave until master_log_file='$master_log_file', master_log_pos=$master_log_pos;
+
+source include/wait_for_slave_sql_to_stop.inc;
+if (`select count(*) from t2`)
+{
+    select count(*) from t2;
+    --die Wrong UNTIL condtion handling or a flaw in the test
+}
+
+source include/start_slave.inc;
+
+##
+# cleanup
+##
 connection master;
 drop table t1;
+drop table t2m;
+drop table t2;
 
 sync_slave_with_master;
 #connection slave;
@@ -113,6 +263,6 @@ sync_slave_with_master;
 drop view worker_proc_list;
 drop view coord_proc_list;
 set @@global.slave_parallel_workers= @save.slave_parallel_workers;
-
+set @@global.slave_transaction_retries= @save.slave_transaction_retries;
 --echo end of the tests
 

=== modified file 'sql/rpl_rli_pdb.cc'
--- a/sql/rpl_rli_pdb.cc	2010-12-10 15:50:03 +0000
+++ b/sql/rpl_rli_pdb.cc	2010-12-11 19:00:47 +0000
@@ -172,6 +172,9 @@ bool Slave_worker::commit_positions(Log_
 
     my_free(ptr_g->checkpoint_log_name);
     ptr_g->checkpoint_log_name= NULL;
+
+    // TODO: reset the current bitmap
+
   }
       
   // TODO: update the group bitmap ptr_g->checkpoint_seqno 'th bit

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2010-12-10 16:25:27 +0000
+++ b/sql/rpl_slave.cc	2010-12-11 19:00:47 +0000
@@ -2855,7 +2855,8 @@ int apply_event_and_update_pos(Log_event
       See sql/rpl_rli.h for further details.
     */
     int error= 0;
-    if (!rli->is_parallel_exec() ||
+    if (skip_event || 
+        !rli->is_parallel_exec() ||
         ev->only_sequential_exec(rli->run_query_in_parallel,
                                  ev->ends_group() ?
                                  rli->curr_group_is_parallel :
@@ -4389,6 +4390,14 @@ pthread_handler_t handle_slave_sql(void 
     goto err;
   }
   THD_CHECK_SENTRY(thd);
+
+  /* 
+     TODO: Alfranio, to settle invocation point. It's moved to possibly
+     please an assert in the following block
+  */
+  if (rli->is_parallel_exec() && mts_recovery_routine(rli))
+    goto err;
+
 #ifndef DBUG_OFF
   {
     char llbuf1[22], llbuf2[22];
@@ -4432,10 +4441,6 @@ log '%s' at position %s, relay log '%s' 
     goto err;
   }
 
-  /* This is a temporary fix for the recovery routine */
-  if (rli->is_parallel_exec() && mts_recovery_routine(rli))
-    goto err;
-
   /* execute init_slave variable */
   if (opt_init_slave.length)
   {
@@ -6441,13 +6446,25 @@ int start_slave(THD* thd , Master_info* 
           if (mi->rli->slave_parallel_workers != 0)
           {
             mi->rli->slave_parallel_workers= 0;
-            push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
-                         ER_NO_UNTIL_COND_WITH_PARALLEL_SLAVE,
-                         ER(ER_NO_UNTIL_COND_WITH_PARALLEL_SLAVE));
+            push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+                                ER_NO_FEATURE_ON_PARALLEL_SLAVE,
+                                ER(ER_NO_FEATURE_ON_PARALLEL_SLAVE),
+                                "UNTIL condtion",
+                                "Slave is started in the sequential execution mode.");
           }
         }
 
         mysql_mutex_unlock(&mi->rli->data_lock);
+
+        /* MTS technical limitation no support of trans retry */
+        if (mi->rli->slave_parallel_workers != 0 && slave_trans_retries != 0)
+        {
+          push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+                              ER_NO_FEATURE_ON_PARALLEL_SLAVE,
+                              ER(ER_NO_FEATURE_ON_PARALLEL_SLAVE),
+                              "Temporary failed transaction retry",
+                              "Such failure will force the slave to stop.");
+        }
       }
       else if (thd->lex->mi.pos || thd->lex->mi.relay_log_pos)
         push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED,

=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt	2010-12-08 00:33:48 +0000
+++ b/sql/share/errmsg-utf8.txt	2010-12-11 19:00:47 +0000
@@ -6451,5 +6451,5 @@ ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
 ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE
   eng "Replication event checksum verification failed while reading from a log file."
 
-ER_NO_UNTIL_COND_WITH_PARALLEL_SLAVE
-  eng "Until condition is not supported in Parallel Slave. Slave is started in the sequential mode."
+ER_NO_FEATURE_ON_PARALLEL_SLAVE
+  eng "%s is not supported in Parallel Slave. %s"

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-12-10 16:25:27 +0000
+++ b/sql/sys_vars.cc	2010-12-11 19:00:47 +0000
@@ -3106,11 +3106,11 @@ static Sys_var_uint Sys_sync_relayloginf
        VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
 
 static Sys_var_uint Sys_checkpoint_mts_period(
-       "mts_checkpoint_period", "Gather workers' activities and synchronously "
-       "flush relay log info to disk after every #th mili-seconds. Use 0 "
-       "(default) to disable checkpoint",
+       "mts_checkpoint_period", "Gather workers' activities to "
+       "flush the relay log info to disk after every #th milli-seconds. "
+       "The zero value disables the checkpoint routine (makes sense for debugging).",
        GLOBAL_VAR(mts_checkpoint_period), CMD_LINE(REQUIRED_ARG),
-       VALID_RANGE(0, UINT_MAX), DEFAULT(0), BLOCK_SIZE(1));
+       VALID_RANGE(0, UINT_MAX), DEFAULT(300), BLOCK_SIZE(1));
 #endif
 
 static Sys_var_uint Sys_sync_binlog_period(


Attachment: [text/bzr-bundle] bzr/andrei.elkin@oracle.com-20101211190047-4193ws2j1a8xdgwb.bundle
Thread
bzr commit into mysql-next-mr-wl5569 branch (andrei.elkin:3241) WL#5569Andrei Elkin11 Dec