Commit be785cd8 authored by unknown's avatar unknown

Merge MDEV-6067 from 5.3 to 5.5.

parents 16d90e5a 65f80d40
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;
--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;
...@@ -3474,14 +3474,11 @@ int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt) ...@@ -3474,14 +3474,11 @@ int handler::ha_check(THD *thd, HA_CHECK_OPT *check_opt)
if it is started. if it is started.
*/ */
inline
void 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]; 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 When a storage engine method is called, the transaction must
have been started, unless it's a DDL call, for which the have been started, unless it's a DDL call, for which the
......
...@@ -1757,7 +1757,6 @@ class handler :public Sql_alloc ...@@ -1757,7 +1757,6 @@ class handler :public Sql_alloc
enum {NONE=0, INDEX, RND} inited; enum {NONE=0, INDEX, RND} inited;
bool locked; bool locked;
bool implicit_emptied; /* Can be !=0 only if HEAP */ bool implicit_emptied; /* Can be !=0 only if HEAP */
bool mark_trx_done;
const COND *pushed_cond; const COND *pushed_cond;
/** /**
next_insert_id is the next value which should be inserted into the next_insert_id is the next value which should be inserted into the
...@@ -1820,7 +1819,7 @@ class handler :public Sql_alloc ...@@ -1820,7 +1819,7 @@ class handler :public Sql_alloc
in_range_check_pushed_down(FALSE), in_range_check_pushed_down(FALSE),
ref_length(sizeof(my_off_t)), ref_length(sizeof(my_off_t)),
ft_handler(0), inited(NONE), ft_handler(0), inited(NONE),
locked(FALSE), implicit_emptied(0), mark_trx_done(FALSE), locked(FALSE), implicit_emptied(0),
pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0), pushed_cond(0), next_insert_id(0), insert_id_for_cur_row(0),
pushed_idx_cond(NULL), pushed_idx_cond(NULL),
pushed_idx_cond_keyno(MAX_KEY), pushed_idx_cond_keyno(MAX_KEY),
...@@ -1898,13 +1897,6 @@ class handler :public Sql_alloc ...@@ -1898,13 +1897,6 @@ class handler :public Sql_alloc
} }
int ha_rnd_init_with_error(bool scan) __attribute__ ((warn_unused_result)); int ha_rnd_init_with_error(bool scan) __attribute__ ((warn_unused_result));
int ha_reset(); 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 */ /* this is necessary in many places, e.g. in HANDLER command */
int ha_index_or_rnd_end() int ha_index_or_rnd_end()
{ {
...@@ -2773,12 +2765,8 @@ class handler :public Sql_alloc ...@@ -2773,12 +2765,8 @@ class handler :public Sql_alloc
private: private:
/* Private helpers */ /* Private helpers */
void mark_trx_read_write_part2(); inline void mark_trx_read_write();
inline void mark_trx_read_write() private:
{
if (!mark_trx_done)
mark_trx_read_write_part2();
}
inline void increment_statistics(ulong SSV::*offset) const; inline void increment_statistics(ulong SSV::*offset) const;
inline void decrement_statistics(ulong SSV::*offset) const; inline void decrement_statistics(ulong SSV::*offset) const;
......
...@@ -3954,7 +3954,7 @@ void TABLE::init(THD *thd, TABLE_LIST *tl) ...@@ -3954,7 +3954,7 @@ void TABLE::init(THD *thd, TABLE_LIST *tl)
status= STATUS_NO_RECORD; status= STATUS_NO_RECORD;
insert_values= 0; insert_values= 0;
fulltext_searched= 0; fulltext_searched= 0;
file->ha_start_of_new_statement(); file->ft_handler= 0;
reginfo.impossible_range= 0; reginfo.impossible_range= 0;
created= TRUE; created= TRUE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment