[Commits] Rev 3777: Merge MDEV-6067 from 5.2 to 5.3. in http://bazaar.launchpad.net/~maria-captains/maria/5.3

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Fri Apr 11 10:39:00 EEST 2014


At http://bazaar.launchpad.net/~maria-captains/maria/5.3

------------------------------------------------------------
revno: 3777 [merge]
revision-id: knielsen at knielsen-hq.org-20140411073855-l9czi7ebpqbl7bc6
parent: bar at mariadb.org-20140323120256-eld0j8vryj3jep8w
parent: knielsen at knielsen-hq.org-20140411070353-pln22m942ta021w4
committer: knielsen at knielsen-hq.org
branch nick: mariadb-5.3
timestamp: Fri 2014-04-11 09:38:55 +0200
message:
  Merge MDEV-6067 from 5.2 to 5.3.
added:
  mysql-test/suite/parts/r/partition_mdev6067.result partition_mdev6067.r-20140411070307-6pwl76zycz44ty1z-1
  mysql-test/suite/parts/t/partition_mdev6067.test partition_mdev6067.t-20140411070307-6pwl76zycz44ty1z-2
modified:
  sql/handler.cc                 sp1f-handler.cc-19700101030959-ta6zfrlbxzucylciyro3musjsdpocrdh
  sql/handler.h                  sp1f-handler.h-19700101030959-mumq2hpilkpgxuf22ftyv5kbilysnzvn
  sql/sql_base.cc                sp1f-sql_base.cc-19700101030959-w7tul2gb2n4jzayjwlslj3ybmf3uhk6a
=== added file 'mysql-test/suite/parts/r/partition_mdev6067.result'
--- a/mysql-test/suite/parts/r/partition_mdev6067.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/r/partition_mdev6067.result	2014-04-11 07:03:53 +0000
@@ -0,0 +1,38 @@
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
+PARTITION BY KEY (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (2,2), (3,8);
+INSERT INTO t1 VALUES (4,16);
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name        Pos     Event_type      Server_id       End_log_pos     Info
+master-bin.000001       #       Query   #       #       BEGIN
+master-bin.000001       #       Query   #       #       use `test`; INSERT INTO t1 VALUES (1,1)
+master-bin.000001       #       Xid     #       #       COMMIT /* XID */
+master-bin.000001       #       Query   #       #       BEGIN
+master-bin.000001       #       Query   #       #       use `test`; INSERT INTO t1 VALUES (2,2), (3,8)
+master-bin.000001       #       Xid     #       #       COMMIT /* XID */
+master-bin.000001       #       Query   #       #       BEGIN
+master-bin.000001       #       Query   #       #       use `test`; INSERT INTO t1 VALUES (4,16)
+master-bin.000001       #       Xid     #       #       COMMIT /* XID */
+DROP TABLE t1;
+SET binlog_format='row';
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
+PARTITION BY KEY (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (2,2), (3,8);
+INSERT INTO t1 VALUES (4,16);
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name        Pos     Event_type      Server_id       End_log_pos     Info
+master-bin.000001       #       Query   #       #       BEGIN
+master-bin.000001       #       Table_map       #       #       table_id: # (test.t1)
+master-bin.000001       #       Write_rows      #       #       table_id: # flags: STMT_END_F
+master-bin.000001       #       Xid     #       #       COMMIT /* XID */
+master-bin.000001       #       Query   #       #       BEGIN
+master-bin.000001       #       Table_map       #       #       table_id: # (test.t1)
+master-bin.000001       #       Write_rows      #       #       table_id: # flags: STMT_END_F
+master-bin.000001       #       Xid     #       #       COMMIT /* XID */
+master-bin.000001       #       Query   #       #       BEGIN
+master-bin.000001       #       Table_map       #       #       table_id: # (test.t1)
+master-bin.000001       #       Write_rows      #       #       table_id: # flags: STMT_END_F
+master-bin.000001       #       Xid     #       #       COMMIT /* XID */
+DROP TABLE t1;

=== added file 'mysql-test/suite/parts/t/partition_mdev6067.test'
--- a/mysql-test/suite/parts/t/partition_mdev6067.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/t/partition_mdev6067.test	2014-04-11 07:03:53 +0000
@@ -0,0 +1,32 @@
+--source include/have_innodb.inc
+--source include/have_partition.inc
+--source include/have_binlog_format_statement.inc
+
+# Test binlogging of some transactions on a partitioned InnoDB table.
+# The bug was seen as one of the inserts being logged with a COMMIT query
+# event instead of the correct XID event.
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
+  PARTITION BY KEY (a) PARTITIONS 2;
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (2,2), (3,8);
+INSERT INTO t1 VALUES (4,16);
+
+--source include/show_binlog_events.inc
+
+# Same thing in row mode.
+DROP TABLE t1;
+SET binlog_format='row';
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
+  PARTITION BY KEY (a) PARTITIONS 2;
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
+INSERT INTO t1 VALUES (1,1);
+INSERT INTO t1 VALUES (2,2), (3,8);
+INSERT INTO t1 VALUES (4,16);
+
+--source include/show_binlog_events.inc
+
+DROP TABLE t1;

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2014-03-16 20:03:01 +0000
+++ b/sql/handler.cc	2014-04-11 07:38:55 +0000
@@ -3335,14 +3335,11 @@ int handler::ha_check(THD *thd, HA_CHECK
   if it is started.
 */
 
+inline
 void
-handler::mark_trx_read_write_part2()
+handler::mark_trx_read_write()
 {
   Ha_trx_info *ha_info= &ha_thd()->ha_data[ht->slot].ha_info[0];
-
-  /* Don't call this function again for this statement */
-  mark_trx_done= TRUE;
-
   /*
     When a storage engine method is called, the transaction must
     have been started, unless it's a DDL call, for which the

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2012-03-28 10:58:14 +0000
+++ b/sql/handler.h	2014-04-11 07:38:55 +0000
@@ -1625,7 +1625,6 @@ class handler :public Sql_alloc
   enum {NONE=0, INDEX, RND} inited;
   bool locked;
   bool implicit_emptied;                /* Can be !=0 only if HEAP */
-  bool mark_trx_done;
   bool cloned;                          /* 1 if this was created with clone */
   const COND *pushed_cond;
   Item *pushed_idx_cond;
@@ -1674,7 +1673,7 @@ class handler :public Sql_alloc
     key_used_on_scan(MAX_KEY), active_index(MAX_KEY),
     ref_length(sizeof(my_off_t)),
     ft_handler(0), inited(NONE),
-    locked(FALSE), implicit_emptied(FALSE), mark_trx_done(FALSE), cloned(0),
+    locked(FALSE), implicit_emptied(FALSE), cloned(0),
     pushed_cond(0), pushed_idx_cond(NULL),
     pushed_idx_cond_keyno(MAX_KEY),
     next_insert_id(0), insert_id_for_cur_row(0),
@@ -1740,13 +1739,6 @@ class handler :public Sql_alloc
   }
   int ha_rnd_init_with_error(bool scan) __attribute__ ((warn_unused_result));
   int ha_reset();
-  /* Tell handler (not storage engine) this is start of a new statement */
-  void ha_start_of_new_statement()
-  {
-    ft_handler= 0;
-    mark_trx_done= FALSE;
-  }
-
   /* this is necessary in many places, e.g. in HANDLER command */
   int ha_index_or_rnd_end()
   {
@@ -2459,12 +2451,8 @@ class handler :public Sql_alloc
 
 private:
   /* Private helpers */
-  void mark_trx_read_write_part2();
-  inline void mark_trx_read_write()
-  {
-    if (!mark_trx_done)
-      mark_trx_read_write_part2();
-  }
+  inline void mark_trx_read_write();
+private:
   inline void increment_statistics(ulong SSV::*offset) const;
   inline void decrement_statistics(ulong SSV::*offset) const;
 

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2014-03-16 20:03:01 +0000
+++ b/sql/sql_base.cc	2014-04-11 07:38:55 +0000
@@ -3085,7 +3085,6 @@ TABLE *open_table(THD *thd, TABLE_LIST *
   table->status=STATUS_NO_RECORD;
   table->insert_values= 0;
   table->fulltext_searched= 0;
-  table->file->ha_start_of_new_statement();
   table->file->ft_handler= 0;
   /*
     Check that there is no reference to a condition from an earlier query



More information about the commits mailing list