From 18eec63704deaf63aa48a4942bdde23a705483d4 Mon Sep 17 00:00:00 2001 From: unknown <tomas@whalegate.ndb.mysql.com> Date: Wed, 18 Apr 2007 21:39:45 +0200 Subject: [PATCH] Bug #27076 - test case sql/ha_ndbcluster_binlog.cc: drop table not logged when it should mysql-test/r/ndb_binlog_log_bin.result: New BitKeeper file ``mysql-test/r/ndb_binlog_log_bin.result'' mysql-test/t/ndb_binlog_log_bin.test: New BitKeeper file ``mysql-test/t/ndb_binlog_log_bin.test'' --- mysql-test/r/ndb_binlog_log_bin.result | 80 ++++++++++++++++++++++++++ mysql-test/t/ndb_binlog_log_bin.test | 50 ++++++++++++++++ sql/ha_ndbcluster_binlog.cc | 2 +- 3 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 mysql-test/r/ndb_binlog_log_bin.result create mode 100644 mysql-test/t/ndb_binlog_log_bin.test diff --git a/mysql-test/r/ndb_binlog_log_bin.result b/mysql-test/r/ndb_binlog_log_bin.result new file mode 100644 index 00000000000..f80a46324e0 --- /dev/null +++ b/mysql-test/r/ndb_binlog_log_bin.result @@ -0,0 +1,80 @@ +drop table if exists t1,t2,t3; +reset master; +drop table if exists t1,t2,t3; +reset master; +set SQL_LOG_BIN=0; +create database mysqltest; +use mysqltest; +create table t1 (a int key, b int) engine=ndb; +create table t2 (a int key, b int) engine=ndb; +insert into t1 values (1,1); +alter table t1 add c int; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # COMMIT +reset master; +use mysqltest; +insert into t2 values (1,1); +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin1.000001 # Query 102 # BEGIN +master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t1) +master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) +master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F +master-bin1.000001 # Query 102 # COMMIT +master-bin1.000001 # Query 102 # BEGIN +master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t2) +master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) +master-bin1.000001 # Write_rows 102 # table_id: # +master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F +master-bin1.000001 # Query 102 # COMMIT +reset master; +use mysqltest; +drop table t1; +drop table t2; +create table t1 (d int key, e int) engine=ndb; +create table t2 (d int key, e int) engine=ndb; +insert into t1 values (1,1); +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t2) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows 1 # table_id: # +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # COMMIT +master-bin.000001 # Query 1 # use `mysqltest`; drop table t1 +master-bin.000001 # Query 1 # use `mysqltest`; drop table t2 +master-bin.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb +master-bin.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb +master-bin.000001 # Query 1 # BEGIN +master-bin.000001 # Table_map 1 # table_id: # (mysqltest.t1) +master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows 1 # table_id: # +master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query 1 # COMMIT +use mysqltest; +insert into t2 values (1,1); +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin1.000001 # Query 1 # use `mysqltest`; drop table `t1` +master-bin1.000001 # Query 1 # use `mysqltest`; drop table `t2` +master-bin1.000001 # Query 1 # use `mysqltest`; create table t1 (d int key, e int) engine=ndb +master-bin1.000001 # Query 1 # use `mysqltest`; create table t2 (d int key, e int) engine=ndb +master-bin1.000001 # Query 102 # BEGIN +master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t1) +master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) +master-bin1.000001 # Write_rows 102 # table_id: # +master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F +master-bin1.000001 # Query 102 # COMMIT +master-bin1.000001 # Query 102 # BEGIN +master-bin1.000001 # Table_map 102 # table_id: # (mysqltest.t2) +master-bin1.000001 # Table_map 102 # table_id: # (mysql.ndb_apply_status) +master-bin1.000001 # Write_rows 102 # table_id: # +master-bin1.000001 # Write_rows 102 # table_id: # flags: STMT_END_F +master-bin1.000001 # Query 102 # COMMIT +drop database mysqltest; diff --git a/mysql-test/t/ndb_binlog_log_bin.test b/mysql-test/t/ndb_binlog_log_bin.test new file mode 100644 index 00000000000..353041df5bf --- /dev/null +++ b/mysql-test/t/ndb_binlog_log_bin.test @@ -0,0 +1,50 @@ +-- source include/have_ndb.inc +-- source include/have_multi_ndb.inc +-- source include/have_binlog_format_row.inc + +--disable_warnings +connection server2; +drop table if exists t1,t2,t3; +reset master; +connection server1; +drop table if exists t1,t2,t3; +reset master; +--enable_warnings + +# basic SQL_LOG_BIN functionality +# see updates from one thread but not the other +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +# do some stuff with SQL_LOG_BIN=0 +connection con2; +set SQL_LOG_BIN=0; +create database mysqltest; +use mysqltest; +create table t1 (a int key, b int) engine=ndb; +create table t2 (a int key, b int) engine=ndb; +insert into t1 values (1,1); +alter table t1 add c int; +# we should not see it in the local server +-- source include/show_binlog_events.inc +reset master; +# we should not see it in another server +connection server2; +use mysqltest; +insert into t2 values (1,1); +-- source include/show_binlog_events.inc +reset master; +# but if you do stuff in "default" client setting +connection con1; +use mysqltest; +drop table t1; +drop table t2; +create table t1 (d int key, e int) engine=ndb; +create table t2 (d int key, e int) engine=ndb; +insert into t1 values (1,1); +-- source include/show_binlog_events.inc +# and in another server +connection server2; +use mysqltest; +insert into t2 values (1,1); +-- source include/show_binlog_events.inc +drop database mysqltest; diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 34d4ca931f2..55c31d04e0e 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -2108,10 +2108,10 @@ ndb_binlog_thread_handle_schema_event_post_epoch(THD *thd, log_query= 1; break; case SOT_DROP_TABLE: + log_query= 1; // invalidation already handled by binlog thread if (share && share->op) { - log_query= 1; break; } // fall through -- 2.30.9