List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:November 21 2011 7:51pm
Subject:bzr push into mysql-trunk branch (andrei.elkin:3630)
View as plain text  
 3630 Andrei Elkin	2011-11-21 [merge]
      merge from the main repo.

    modified:
      storage/innobase/srv/srv0start.c
=== modified file 'mysql-test/suite/rpl/r/rpl_parallel_ddl.result'
--- a/mysql-test/suite/rpl/r/rpl_parallel_ddl.result	2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_parallel_ddl.result	2011-11-21 19:50:04 +0000
@@ -1005,747 +1005,5 @@ t7.frm
 t8.MYD
 t8.MYI
 t8.frm
-"database d32:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d31:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t4.MYD
-t4.MYI
-t4.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d30:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d29:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d28:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d27:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d26:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d25:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d24:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d23:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d22:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d21:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d20:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d19:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d18:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d17:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d16:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d15:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d14:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d13:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d12:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d11:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d10:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d9:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d8:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d7:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d6:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d5:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d4:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d3:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d2:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
-"database d1:"
-db.opt
-t1.MYD
-t1.MYI
-t1.frm
-t2.MYD
-t2.MYI
-t2.frm
-t3.MYD
-t3.MYI
-t3.frm
-t4.MYD
-t4.MYI
-t4.frm
-t5.MYD
-t5.MYI
-t5.frm
-t6.MYD
-t6.MYI
-t6.frm
-t7.MYD
-t7.MYI
-t7.frm
-t8.MYD
-t8.MYI
-t8.frm
 set @@global.slave_parallel_workers= @save.slave_parallel_workers;
 include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/r/rpl_parallel_load_data.result'
--- a/mysql-test/suite/rpl/r/rpl_parallel_load_data.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_parallel_load_data.result	2011-11-21 17:46:02 +0000
@@ -0,0 +1,22 @@
+include/master-slave.inc
+[connection master]
+include/stop_slave.inc
+SET @save_slave_parallel_workers= @@slave_parallel_workers;
+SET @@global.slave_parallel_workers=4;
+include/start_slave.inc
+DROP DATABASE IF EXISTS db1;
+DROP DATABASE IF EXISTS db2;
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE TABLE db1.tb1 (f1 int) ENGINE=MyISAM;
+CREATE TABLE db2.tb2 (f1 int) ENGINE=InnoDB;
+CREATE TRIGGER db1.tr AFTER INSERT ON tb1 FOR EACH ROW INSERT INTO db2.tb2
+(f1) VALUES (new.f1);
+LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/load_bug12982188.txt' INTO TABLE db1.tb1;
+SELECT COUNT(*) FROM db2.tb2;
+COUNT(*)
+10
+DROP DATABASE db1;
+DROP DATABASE db2;
+include/stop_slave.inc
+SET @@global.slave_parallel_workers= @save_slave_parallel_workers;

=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_ddl.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_ddl.test	2011-10-13 12:12:19 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_ddl.test	2011-11-21 19:50:04 +0000
@@ -252,25 +252,74 @@ while ($n)
 
 connection master;
 
+let $n= $dbs;
 --disable_query_log
 
-let $n= $dbs;
+# Hunting after bug#13033076: to drop db:s on master concurrently as
+# well through 4 connections.
+
+--connect(con1, localhost, root,,)
+--connect(con2, localhost, root,,)
+--connect(con3, localhost, root,,)
+--connect(con4, localhost, root,,)
+
+let $reap_not_done= 0;
+
 while ($n)
 {
-  # DEBUG (to remove) bug#13033076
-  --connection slave
-  --echo "database d$n:"
-  --list_files $MYSQLD_DATADIR/d$n
-
-  --connection master
-  eval drop database d$n;
-  sync_slave_with_master;
+  --connection con1
+  if ($reap_not_done)
+  {
+    --reap
+  }
+  --send_eval drop database d$n;
+  dec $n;
+
+  --connection con2
+  if ($reap_not_done)
+  {
+    --reap
+  }
+  --send_eval drop database d$n;
   dec $n;
+
+  --connection con3
+  if ($reap_not_done)
+  {
+    --reap
+  }
+  --send_eval drop database d$n;
+  dec $n;
+
+  --connection con4
+  if ($reap_not_done)
+  {
+    --reap
+  }
+  --send_eval drop database d$n;
+  dec $n;
+  let $reap_not_done= 1;
 }
 
 --enable_query_log
 
---connection master
+  --connection con1
+  --reap
+  --disconnect con1
+ 
+  --connection con2
+  --reap
+  --disconnect con2
+  
+  --connection con3
+  --reap
+  --disconnect con3
+  
+  --connection con4
+  --reap
+  --disconnect con4
+
+connection master;
 sync_slave_with_master;
 
 set @@global.slave_parallel_workers= @save.slave_parallel_workers;

=== added file 'mysql-test/suite/rpl/t/rpl_parallel_load_data-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_parallel_load_data-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_load_data-slave.opt	2011-11-21 17:46:02 +0000
@@ -0,0 +1 @@
+--slave-transaction-retries=0

=== added file 'mysql-test/suite/rpl/t/rpl_parallel_load_data.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_load_data.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_load_data.test	2011-11-21 17:46:02 +0000
@@ -0,0 +1,53 @@
+#
+# Bug#12982188 MTS: SBR ABORTS WITH ERROR 1742 ON LOAD DATA WITH TRIGGER MYISAM TO INNODB
+#
+
+--source include/master-slave.inc
+--source include/have_binlog_format_statement.inc
+
+let $max_workers= 4;
+
+--write_file $MYSQLTEST_VARDIR/load_bug12982188.txt
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+EOF
+
+--connection slave
+--source include/stop_slave.inc
+SET @save_slave_parallel_workers= @@slave_parallel_workers;
+eval SET @@global.slave_parallel_workers=$max_workers;
+--source include/start_slave.inc
+
+--connection master
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+DROP DATABASE IF EXISTS db2;
+--enable_warnings
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE TABLE db1.tb1 (f1 int) ENGINE=MyISAM;
+CREATE TABLE db2.tb2 (f1 int) ENGINE=InnoDB;
+CREATE TRIGGER db1.tr AFTER INSERT ON tb1 FOR EACH ROW INSERT INTO db2.tb2
+(f1) VALUES (new.f1);
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/load_bug12982188.txt' INTO TABLE db1.tb1;
+--sync_slave_with_master
+SELECT COUNT(*) FROM db2.tb2;
+
+# cleanup
+--connection master
+DROP DATABASE db1;
+DROP DATABASE db2;
+--remove_file $MYSQLTEST_VARDIR/load_bug12982188.txt
+
+--sync_slave_with_master
+--source include/stop_slave.inc
+SET @@global.slave_parallel_workers= @save_slave_parallel_workers;

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-11-21 13:25:04 +0000
+++ b/sql/log_event.cc	2011-11-21 17:46:02 +0000
@@ -2367,12 +2367,48 @@ Log_event::continue_group(Relay_log_info
   return Log_event::do_shall_skip(rli);
 }
 
-
-bool Log_event::contains_partition_info()
+/**
+   @param end_group_sets_max_dbs  when true the group terminal event 
+                          can carry partition info, see a note below.
+   @return true  in cases the current event
+                 carries partition data,
+           false otherwise
+
+   @note Some events combination may force to adjust partition info.
+         In particular BEGIN, BEGIN_LOAD_QUERY_EVENT, COMMIT
+         where none of the events holds partitioning data
+         causes the sequential applying of the group through
+         assigning OVER_MAX_DBS_IN_EVENT_MTS to mts_accessed_dbs
+         of COMMIT query event.
+*/
+bool Log_event::contains_partition_info(bool end_group_sets_max_dbs)
 {
-  return (get_type_code() == TABLE_MAP_EVENT) ||
-    (get_type_code() == QUERY_EVENT && !ends_group() && !starts_group()) ||
-    (get_type_code() == EXECUTE_LOAD_QUERY_EVENT);
+  bool res;
+
+  switch (get_type_code()) {
+  case TABLE_MAP_EVENT:
+  case EXECUTE_LOAD_QUERY_EVENT:
+    res= true;
+
+    break;
+    
+  case QUERY_EVENT:
+    if (ends_group() && end_group_sets_max_dbs)
+    {
+      res= true;
+      static_cast<Query_log_event*>(this)->mts_accessed_dbs=
+        OVER_MAX_DBS_IN_EVENT_MTS;
+    }
+    else
+      res= (!ends_group() && !starts_group()) ? true : false;
+
+    break;
+
+  default:
+    res= false;
+  }
+
+  return res;
 }
 
 /**
@@ -2459,27 +2495,44 @@ Slave_worker *Log_event::get_slave_worke
     {
       Log_event *ptr_curr_ev= this;
       // B-event is appended to the Deferred Array associated with GCAP
-      insert_dynamic(&rli->curr_group_da,
-                     (uchar*) &ptr_curr_ev);
+      insert_dynamic(&rli->curr_group_da, (uchar*) &ptr_curr_ev);
 
       DBUG_ASSERT(rli->curr_group_da.elements == 1);
 
       // mark the current group as started with explicit B-event
       rli->curr_group_seen_begin= TRUE;
-
+      // pessimistic preparation of no db:s will be found in events
+      rli->mts_end_group_sets_max_dbs= true;
       return ret_worker;
     } 
   }
 
   // mini-group representative
 
-  if (contains_partition_info())
+  if (contains_partition_info(rli->mts_end_group_sets_max_dbs))
   {
     int i= 0;
     num_dbs= mts_number_dbs();
     List_iterator<char> it(*get_mts_dbs(&rli->mts_coor_mem_root));
     it++;
 
+    /*
+      Bug 12982188 - MTS: SBR ABORTS WITH ERROR 1742 ON LOAD DATA
+      Logging on master can create a group with no events holding
+      the partition info.
+      The following assert proves there's the only reason
+      for such group.
+    */
+    DBUG_ASSERT(!ends_group() ||
+                (rli->mts_end_group_sets_max_dbs &&
+                 rli->curr_group_da.elements == 2 &&
+                 ((*(Log_event **)
+                   dynamic_array_ptr(&rli->curr_group_da,
+                                     rli->curr_group_da.elements - 1))-> 
+                  get_type_code() == BEGIN_LOAD_QUERY_EVENT)));
+
+    // partioning info is found which drops the flag
+    rli->mts_end_group_sets_max_dbs= false;
     ret_worker= rli->last_assigned_worker;
     if (num_dbs == OVER_MAX_DBS_IN_EVENT_MTS)
     {
@@ -2782,7 +2835,16 @@ int Log_event::apply_event(Relay_log_inf
 
   DBUG_ASSERT(actual_exec_mode == EVENT_EXEC_PARALLEL);
   DBUG_ASSERT(!(rli->curr_group_seen_begin && ends_group()) ||
-              rli->last_assigned_worker);
+              rli->last_assigned_worker ||
+              /*
+                Begin_load_query can be logged w/o db info and within
+                Begin/Commit. That's a pattern forcing sequential
+                applying of LOAD-DATA.
+              */
+              (*(Log_event **)
+               dynamic_array_ptr(&rli->curr_group_da,
+                                 rli->curr_group_da.elements - 1))-> 
+              get_type_code() == BEGIN_LOAD_QUERY_EVENT);
 
   worker= NULL;
   rli->mts_group_status= Relay_log_info::MTS_IN_GROUP;
@@ -3987,10 +4049,10 @@ void Query_log_event::print(FILE* file, 
 */
 void Query_log_event::attach_temp_tables_worker(THD *thd)
 {
-  if (!is_mts_worker(thd) || !contains_partition_info())
+  if (!is_mts_worker(thd) || (ends_group() || starts_group()))
     return;
   
-  // in over max-db:s case just one special parttion is locked
+  // in over max-db:s case just one special partition is locked
   int parts= ((mts_accessed_dbs == OVER_MAX_DBS_IN_EVENT_MTS) ?
               1 : mts_accessed_dbs);
 

=== modified file 'sql/log_event.h'
--- a/sql/log_event.h	2011-11-15 13:04:11 +0000
+++ b/sql/log_event.h	2011-11-21 17:46:02 +0000
@@ -1405,7 +1405,7 @@ public:
   /**
      @return TRUE  if events carries partitioning data (database names).
   */
-  bool contains_partition_info();
+  bool contains_partition_info(bool);
 
   /*
     @return  the number of updated by the event databases.

=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h	2011-11-15 13:04:11 +0000
+++ b/sql/rpl_rli.h	2011-11-21 17:46:02 +0000
@@ -448,6 +448,7 @@ public:
   DYNAMIC_ARRAY curr_group_da;  // deferred array to hold partition-info-free events
   bool curr_group_seen_begin;   // current group started with B-event or not
   bool curr_group_isolated;     // current group requires execution in isolation
+  bool mts_end_group_sets_max_dbs; // flag indicates if partitioning info is discovered
   volatile ulong mts_wq_underrun_w_id;  // Id of a Worker whose queue is getting empty
   /* 
      Ongoing excessive overrun counter to correspond to number of events that

=== modified file 'sql/rpl_rli_pdb.cc'
--- a/sql/rpl_rli_pdb.cc	2011-11-10 06:53:27 +0000
+++ b/sql/rpl_rli_pdb.cc	2011-11-21 17:46:02 +0000
@@ -129,6 +129,7 @@ int Slave_worker::init_worker(Relay_log_
   workers= c_rli->workers; // shallow copying is sufficient
   wq_size_waits_cnt= groups_done= events_done= curr_jobs= 0;
   usage_partition= 0;
+  end_group_sets_max_dbs= false;
   last_group_done_index= c_rli->gaq->size; // out of range
 
   jobs.avail= 0;
@@ -1686,11 +1687,13 @@ int slave_worker_exec_job(Slave_worker *
 
   if (ev->starts_group())
   {
+    worker->end_group_sets_max_dbs= true;
     worker->curr_group_seen_begin= TRUE; // The current group is started with B-event
   } 
   else
   {
-    if ((part_event= ev->contains_partition_info()))
+    if ((part_event=
+         ev->contains_partition_info(worker->end_group_sets_max_dbs)))
     {
       uint num_dbs=  ev->mts_number_dbs();
       DYNAMIC_ARRAY *ep= &worker->curr_group_exec_parts;
@@ -1720,6 +1723,7 @@ int slave_worker_exec_job(Slave_worker *
           insert_dynamic(ep, (uchar*) &ev->mts_assigned_partitions[k]);
         }
       }
+      worker->end_group_sets_max_dbs= false;
     }
   }
   worker->set_future_event_relay_log_pos(ev->future_event_relay_log_pos);

=== modified file 'sql/rpl_rli_pdb.h'
--- a/sql/rpl_rli_pdb.h	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_rli_pdb.h	2011-11-21 17:46:02 +0000
@@ -312,6 +312,8 @@ public:
   volatile int curr_jobs; // number of active  assignments
   // number of partitions allocated to the worker at point in time
   long usage_partition;
+  // symmetric to rli->mts_end_group_sets_max_dbs
+  bool end_group_sets_max_dbs;
 
   volatile bool relay_log_change_notified; // Coord sets and resets, W can read
   volatile bool checkpoint_notified; // Coord sets and resets, W can read

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (andrei.elkin:3630) Andrei Elkin22 Nov