Commit 14f5002d authored by unknown's avatar unknown

Merge: bug#27417,23333 manual work for fixing tests and a source code.


mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  results changed due to 
  1. tt table made temporary is it's supposed to; 
  2. show master status is turned into binlog pos masking-out macro
  3. merge defect for select_insert::abort()
mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam.test:
  masking-out binlog postions in the results via 
  source include/show_binlog_events.inc;
sql/sql_insert.cc:
  merging defect in not applied hunk for select_insert::abort() is fixed
parent 68297025
...@@ -426,11 +426,18 @@ insert into ti values (2) /* to make the dup error in the following */; ...@@ -426,11 +426,18 @@ insert into ti values (2) /* to make the dup error in the following */;
insert into tt select * from ti /* one affected and error */; insert into tt select * from ti /* one affected and error */;
ERROR 23000: Duplicate entry '2' for key 'a' ERROR 23000: Duplicate entry '2' for key 'a'
rollback; rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106 master-bin.000001 589
show binlog events from <binlog_start>; show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Query # # use `test`; insert into ti values (1)
master-bin.000001 # Query # # use `test`; insert into ti values (2) /* to make the dup error in the following */
master-bin.000001 # Query # # use `test`; insert into tt select * from ti /* one affected and error */
master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from ti /* zero */; select count(*) from ti /* zero */;
count(*) count(*)
0 0
...@@ -456,10 +463,11 @@ insert into t2 select bug27417(2); ...@@ -456,10 +463,11 @@ insert into t2 select bug27417(2);
reset master; reset master;
insert into t2 values (bug27417(2)); insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY' ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show master status; show binlog events from <binlog_start>;
File Position Binlog_Do_DB Binlog_Ignore_DB Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 222 master-bin.000001 # Table_map # # table_id: # (test.t2)
/* only (!) with fixes for #23333 will show there is the query */; master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
select count(*) from t1 /* must be 3 */; select count(*) from t1 /* must be 3 */;
count(*) count(*)
3 3
...@@ -471,10 +479,11 @@ delete from t2 where a=bug27417(3); ...@@ -471,10 +479,11 @@ delete from t2 where a=bug27417(3);
select count(*) from t2 /* nothing got deleted */; select count(*) from t2 /* nothing got deleted */;
count(*) count(*)
2 2
show master status; show binlog events from <binlog_start>;
File Position Binlog_Do_DB Binlog_Ignore_DB Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 227 master-bin.000001 # Table_map # # table_id: # (test.t2)
/* the query must be in regardless of #23333 */; master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
select count(*) from t1 /* must be 5 */; select count(*) from t1 /* must be 5 */;
count(*) count(*)
5 5
...@@ -491,9 +500,12 @@ insert into t2 values (1); ...@@ -491,9 +500,12 @@ insert into t2 values (1);
reset master; reset master;
insert into t2 values (bug27417(1)); insert into t2 values (bug27417(1));
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show master status /* the offset must denote there is the query */; show binlog events from <binlog_start>;
File Position Binlog_Do_DB Binlog_Ignore_DB Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 293 master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
count(*) count(*)
1 1
...@@ -503,9 +515,13 @@ insert into t2 values (2); ...@@ -503,9 +515,13 @@ insert into t2 values (2);
reset master; reset master;
insert into t2 select bug27417(1) union select bug27417(2); insert into t2 select bug27417(1) union select bug27417(2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY' ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show master status /* the offset must denote there is the query */; show binlog events from <binlog_start>;
File Position Binlog_Do_DB Binlog_Ignore_DB Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 332 master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
count(*) count(*)
2 2
...@@ -514,9 +530,13 @@ insert into t3 values (1,1),(2,3),(3,4); ...@@ -514,9 +530,13 @@ insert into t3 values (1,1),(2,3),(3,4);
reset master; reset master;
update t3 set b=b+bug27417(1); update t3 set b=b+bug27417(1);
ERROR 23000: Duplicate entry '4' for key 'b' ERROR 23000: Duplicate entry '4' for key 'b'
show master status /* the offset must denote there is the query */; show binlog events from <binlog_start>;
File Position Binlog_Do_DB Binlog_Ignore_DB Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 305 master-bin.000001 # Table_map # # table_id: # (test.t3)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
count(*) count(*)
2 2
...@@ -530,9 +550,13 @@ insert into t3 values (bug27417(1), 2); ...@@ -530,9 +550,13 @@ insert into t3 values (bug27417(1), 2);
reset master; reset master;
delete from t2; delete from t2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY' ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show master status /* the offset must denote there is the query */; show binlog events from <binlog_start>;
File Position Binlog_Do_DB Binlog_Ignore_DB Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 335 master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t3)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; ROLLBACK
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
count(*) count(*)
1 1
...@@ -548,9 +572,14 @@ a b ...@@ -548,9 +572,14 @@ a b
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
count(*) count(*)
2 2
show master status /* the offset must denote there is the query */; show binlog events from <binlog_start>;
File Position Binlog_Do_DB Binlog_Ignore_DB Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 362 master-bin.000001 # Table_map # # table_id: # (test.t4)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; ROLLBACK
drop trigger trg_del; drop trigger trg_del;
drop table t1,t2,t3,t4; drop table t1,t2,t3,t4;
drop function bug27417; drop function bug27417;
......
...@@ -121,14 +121,14 @@ reset master; ...@@ -121,14 +121,14 @@ reset master;
--error ER_DUP_ENTRY --error ER_DUP_ENTRY
insert into t2 values (bug27417(2)); insert into t2 values (bug27417(2));
show master status; /* only (!) with fixes for #23333 will show there is the query */; source include/show_binlog_events.inc; #only (!) with fixes for #23333 will show there is the query
select count(*) from t1 /* must be 3 */; select count(*) from t1 /* must be 3 */;
reset master; reset master;
select count(*) from t2; select count(*) from t2;
delete from t2 where a=bug27417(3); delete from t2 where a=bug27417(3);
select count(*) from t2 /* nothing got deleted */; select count(*) from t2 /* nothing got deleted */;
show master status; /* the query must be in regardless of #23333 */; source include/show_binlog_events.inc; # the query must be in regardless of #23333
select count(*) from t1 /* must be 5 */; select count(*) from t1 /* must be 5 */;
--enable_info --enable_info
...@@ -166,7 +166,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); ...@@ -166,7 +166,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique);
# check # check
show master status /* the offset must denote there is the query */; source include/show_binlog_events.inc; # must be event of the query
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
# #
...@@ -186,7 +186,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); ...@@ -186,7 +186,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique);
# check # check
show master status /* the offset must denote there is the query */; source include/show_binlog_events.inc; # must be events of the query
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
# #
...@@ -203,7 +203,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); ...@@ -203,7 +203,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique);
update t3 set b=b+bug27417(1); update t3 set b=b+bug27417(1);
# check # check
show master status /* the offset must denote there is the query */; source include/show_binlog_events.inc; # must be events of the query
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
...@@ -225,7 +225,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); ...@@ -225,7 +225,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique);
--error ER_DUP_ENTRY --error ER_DUP_ENTRY
delete from t2; delete from t2;
# check # check
show master status /* the offset must denote there is the query */; source include/show_binlog_events.inc; # must be events of the query
select count(*) from t1 /* must be 1 */; select count(*) from t1 /* must be 1 */;
...@@ -245,7 +245,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique); ...@@ -245,7 +245,7 @@ CREATE TABLE t3 (a int, PRIMARY KEY (a), b int unique);
# check # check
select * from t4; select * from t4;
select count(*) from t1 /* must be 2 */; select count(*) from t1 /* must be 2 */;
show master status /* the offset must denote there is the query */; source include/show_binlog_events.inc; # must be events of the query
# #
# bug#23333 cleanup # bug#23333 cleanup
......
...@@ -3163,6 +3163,7 @@ void select_insert::abort() { ...@@ -3163,6 +3163,7 @@ void select_insert::abort() {
*/ */
if (table) if (table)
{ {
bool changed, transactional_table;
/* /*
If we are not in prelocked mode, we end the bulk insert started If we are not in prelocked mode, we end the bulk insert started
before. before.
...@@ -3184,20 +3185,20 @@ void select_insert::abort() { ...@@ -3184,20 +3185,20 @@ void select_insert::abort() {
If table creation failed, the number of rows modified will also be If table creation failed, the number of rows modified will also be
zero, so no check for that is made. zero, so no check for that is made.
*/ */
if (info.copied || info.deleted || info.updated) changed= (info.copied || info.deleted || info.updated);
{ transactional_table= table->file->has_transactions();
DBUG_ASSERT(table != NULL); if (thd->transaction.stmt.modified_non_trans_table)
if (!table->file->has_transactions())
{ {
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length, thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length,
table->file->has_transactions(), FALSE); transactional_table, FALSE);
if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table && if (!thd->current_stmt_binlog_row_based && !can_rollback_data())
!can_rollback_data())
thd->transaction.all.modified_non_trans_table= TRUE; thd->transaction.all.modified_non_trans_table= TRUE;
if (changed)
query_cache_invalidate3(thd, table, 1); query_cache_invalidate3(thd, table, 1);
} }
} DBUG_ASSERT(transactional_table || !changed ||
thd->transaction.stmt.modified_non_trans_table);
table->file->ha_release_auto_increment(); table->file->ha_release_auto_increment();
} }
......
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