Commit 970c6f15 authored by unknown's avatar unknown

WL#3023 (Use locks in a statement-based manner):

  Minor changes to make it work with NDB.
  


mysql-test/r/binlog_row_mix_innodb_myisam.result:
  Not updated result file
mysql-test/r/ndb_binlog_ignore_db.result:
  Result change
mysql-test/r/rpl_ndb_blob.result:
  Result change
mysql-test/r/rpl_ndb_charset.result:
  Result change
mysql-test/r/rpl_ndb_dd_basic.result:
  Result change
sql/ha_ndbcluster_binlog.cc:
  Only calling injector::use_table() if there are data events in epoch.
parent 40e371d2
...@@ -285,3 +285,27 @@ master-bin.000001 1260 Write_rows 1 # table_id: # flags: STMT_END_F ...@@ -285,3 +285,27 @@ master-bin.000001 1260 Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 1294 Query 1 # use `test`; create table t2 (n int) engine=innodb master-bin.000001 1294 Query 1 # use `test`; create table t2 (n int) engine=innodb
do release_lock("lock1"); do release_lock("lock1");
drop table t0,t2; drop table t0,t2;
reset master;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
select get_lock("a",10);
get_lock("a",10)
1
begin;
insert into t1 values(8);
insert into t2 select * from t1;
select get_lock("a",10);
get_lock("a",10)
1
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
is not null;
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
is not null
1
select
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%";
@a like "%#%error_code=0%ROLLBACK;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
1 1
drop table t1, t2;
...@@ -7,4 +7,8 @@ insert into t1 values (1, 1); ...@@ -7,4 +7,8 @@ insert into t1 values (1, 1);
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`; drop table if exists t1 master-bin.000001 # Query # # use `test`; drop table if exists t1
master-bin.000001 # Table_map # # table_id: # (mysql.proc)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (mysql.event)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
drop database mysqltest; drop database mysqltest;
...@@ -86,41 +86,43 @@ a int not null primary key, ...@@ -86,41 +86,43 @@ a int not null primary key,
b text not null b text not null
) engine=ndb ) engine=ndb
master-bin.000001 239 Query 1 303 BEGIN master-bin.000001 239 Query 1 303 BEGIN
master-bin.000001 303 Table_map 1 53 cluster.apply_status master-bin.000001 303 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 356 Write_rows 1 95 master-bin.000001 343 Table_map 1 93 table_id: # (cluster.apply_status)
master-bin.000001 398 Table_map 1 135 test.t1 master-bin.000001 396 Write_rows 1 135 table_id: #
master-bin.000001 438 Write_rows 1 806 master-bin.000001 438 Write_rows 1 806 table_id: #
master-bin.000001 1109 Write_rows 1 9841 master-bin.000001 1109 Write_rows 1 9841 table_id: # flags: STMT_END_F
master-bin.000001 10144 Query 1 10209 COMMIT master-bin.000001 10144 Query 1 10209 COMMIT
master-bin.000001 10209 Query 1 10273 BEGIN master-bin.000001 10209 Query 1 10273 BEGIN
master-bin.000001 10273 Table_map 1 53 cluster.apply_status master-bin.000001 10273 Table_map 1 40 table_id: # (test.t1)
master-bin.000001 10326 Write_rows 1 95 master-bin.000001 10313 Table_map 1 93 table_id: # (cluster.apply_status)
master-bin.000001 10368 Query 1 10433 COMMIT master-bin.000001 10366 Write_rows 1 135 table_id: # flags: STMT_END_F
master-bin.000001 10433 Query 1 10509 use `test`; drop table t1 master-bin.000001 10408 Query 1 10473 COMMIT
master-bin.000001 10509 Query 1 10684 use `test`; create table t1 ( master-bin.000001 10473 Query 1 10549 use `test`; drop table t1
master-bin.000001 10549 Query 1 10724 use `test`; create table t1 (
a int not null primary key, a int not null primary key,
b text not null, b text not null,
c int, c int,
d longblob, d longblob,
e tinyblob e tinyblob
) engine=ndbcluster ) engine=ndbcluster
master-bin.000001 10684 Query 1 10748 BEGIN master-bin.000001 10724 Query 1 10788 BEGIN
master-bin.000001 10748 Table_map 1 53 cluster.apply_status master-bin.000001 10788 Table_map 1 43 table_id: # (test.t1)
master-bin.000001 10801 Write_rows 1 95 master-bin.000001 10831 Table_map 1 96 table_id: # (cluster.apply_status)
master-bin.000001 10843 Table_map 1 138 test.t1 master-bin.000001 10884 Write_rows 1 138 table_id: #
master-bin.000001 10886 Write_rows 1 48922 master-bin.000001 10926 Write_rows 1 48922 table_id: #
master-bin.000001 59670 Write_rows 1 124424 master-bin.000001 59710 Write_rows 1 124424 table_id: #
master-bin.000001 135172 Write_rows 1 124530 master-bin.000001 135212 Write_rows 1 124530 table_id: #
master-bin.000001 135278 Write_rows 1 205949 master-bin.000001 135318 Write_rows 1 205949 table_id: #
master-bin.000001 216697 Write_rows 1 224233 master-bin.000001 216737 Write_rows 1 224233 table_id: #
master-bin.000001 234981 Write_rows 1 227511 master-bin.000001 235021 Write_rows 1 227511 table_id: #
master-bin.000001 238259 Write_rows 1 242379 master-bin.000001 238299 Write_rows 1 242379 table_id: #
master-bin.000001 253127 Write_rows 1 254075 master-bin.000001 253167 Write_rows 1 254075 table_id: #
master-bin.000001 264823 Write_rows 1 304323 master-bin.000001 264863 Write_rows 1 304323 table_id: #
master-bin.000001 315071 Write_rows 1 330415 master-bin.000001 315111 Write_rows 1 330415 table_id: # flags: STMT_END_F
master-bin.000001 341163 Query 1 341228 COMMIT master-bin.000001 341203 Query 1 341268 COMMIT
master-bin.000001 341228 Query 1 341292 BEGIN master-bin.000001 341268 Query 1 341332 BEGIN
master-bin.000001 341292 Table_map 1 53 cluster.apply_status master-bin.000001 341332 Table_map 1 43 table_id: # (test.t1)
master-bin.000001 341345 Write_rows 1 95 master-bin.000001 341375 Table_map 1 96 table_id: # (cluster.apply_status)
master-bin.000001 341387 Query 1 341452 COMMIT master-bin.000001 341428 Write_rows 1 138 table_id: # flags: STMT_END_F
master-bin.000001 341452 Query 1 341528 use `test`; drop table t1 master-bin.000001 341470 Query 1 341535 COMMIT
master-bin.000001 341535 Query 1 341611 use `test`; drop table t1
...@@ -112,36 +112,56 @@ drop database mysqltest3; ...@@ -112,36 +112,56 @@ drop database mysqltest3;
show binlog events from 102; show binlog events from 102;
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 1 # drop database if exists mysqltest2 master-bin.000001 # Query 1 # drop database if exists mysqltest2
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # drop database if exists mysqltest3 master-bin.000001 # Query 1 # drop database if exists mysqltest3
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # create database mysqltest2 character set latin2 master-bin.000001 # Query 1 # create database mysqltest2 character set latin2
master-bin.000001 # Query 1 # create database mysqltest3 master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # drop database mysqltest3 master-bin.000001 # Query 1 # drop database mysqltest3
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # create database mysqltest3 master-bin.000001 # Query 1 # create database mysqltest3
master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1
master-bin.000001 # Table_map 1 # mysqltest2.t1 master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1)
master-bin.000001 # Write_rows 1 # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # drop database mysqltest2 master-bin.000001 # Query 1 # drop database mysqltest2
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # drop database mysqltest3 master-bin.000001 # Query 1 # drop database mysqltest3
master-bin.000001 # Table_map 1 # table_id: # (mysql.proc)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map 1 # table_id: # (mysql.event)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
select "--- --global--" as ""; select "--- --global--" as "";
--- --global-- --- --global--
......
...@@ -57,10 +57,10 @@ master-bin.000001 798 Query 1 978 use `test`; CREATE TABLE t1 ...@@ -57,10 +57,10 @@ master-bin.000001 798 Query 1 978 use `test`; CREATE TABLE t1
tablespace ts1 storage disk tablespace ts1 storage disk
engine ndb engine ndb
master-bin.000001 978 Query 1 1042 BEGIN master-bin.000001 978 Query 1 1042 BEGIN
master-bin.000001 1042 Table_map 1 53 cluster.apply_status master-bin.000001 1042 Table_map 1 41 table_id: # (test.t1)
master-bin.000001 1095 Write_rows 1 95 master-bin.000001 1083 Table_map 1 94 table_id: # (cluster.apply_status)
master-bin.000001 1137 Table_map 1 136 test.t1 master-bin.000001 1136 Write_rows 1 136 table_id: #
master-bin.000001 1178 Write_rows 1 178 master-bin.000001 1178 Write_rows 1 178 table_id: # flags: STMT_END_F
master-bin.000001 1220 Query 1 1285 COMMIT master-bin.000001 1220 Query 1 1285 COMMIT
drop table t1; drop table t1;
alter tablespace ts1 alter tablespace ts1
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "rpl_filter.h" #include "rpl_filter.h"
#include "slave.h" #include "slave.h"
#include "ha_ndbcluster_binlog.h" #include "ha_ndbcluster_binlog.h"
#include "NdbDictionary.hpp"
#ifdef ndb_dynamite #ifdef ndb_dynamite
#undef assert #undef assert
...@@ -2965,6 +2966,13 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -2965,6 +2966,13 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
DBUG_PRINT("info", ("no share or table !")); DBUG_PRINT("info", ("no share or table !"));
continue; continue;
} }
Uint32 const bits=
NdbDictionary::Event::TE_INSERT |
NdbDictionary::Event::TE_DELETE |
NdbDictionary::Event::TE_UPDATE;
if (event_types & bits)
{
TABLE* table=share->table; TABLE* table=share->table;
const LEX_STRING& name=table->s->table_name; const LEX_STRING& name=table->s->table_name;
DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str)); DBUG_PRINT("info", ("use_table: %.*s", name.length, name.str));
...@@ -2972,6 +2980,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -2972,6 +2980,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
trans.use_table(::server_id, tbl); trans.use_table(::server_id, tbl);
} }
} }
}
gci= pOp->getGCI(); gci= pOp->getGCI();
if (apply_status_share) if (apply_status_share)
{ {
......
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