From: Maitrayi Sabaratnam Date: January 18 2013 2:24pm Subject: bzr push into mysql-5.5-cluster-7.2 branch (maitrayi.sabaratnam:4154 to 4155) List-Archive: http://lists.mysql.com/commits/145618 Message-Id: <20130118142420.16705.93400.4155@asator03-z7.no.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4155 Maitrayi Sabaratnam 2013-01-18 [merge] Merge 7.1->7.2 modified: mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result mysql-test/suite/ndb_binlog/t/ndb_binlog_basic.test sql/ha_ndbcluster_binlog.cc 4154 Maitrayi Sabaratnam 2013-01-14 [merge] Merge 7.1->7.2 modified: mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result mysql-test/suite/ndb_binlog/t/ndb_binlog_basic.test storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp === modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result' --- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result 2013-01-14 12:22:19 +0000 +++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result 2013-01-18 14:17:45 +0000 @@ -63,3 +63,70 @@ optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status OK drop table t1; +SET GLOBAL ndb_log_empty_epochs=ON; +SHOW VARIABLES LIKE 'ndb_log_empty_epochs'; +Variable_name Value +ndb_log_empty_epochs ON +create table t1 (c1 int not null primary key, c2 blob default null) engine=ndbcluster default charset=latin1; +insert into t1 values (1, null); +show binlog events; +update t1 set c2=null; +select * from t1; +c1 c2 +1 NULL +show binlog events; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +select * from t1; +c1 c2 +1 NULL +drop table t1; +create table t1 (c1 int not null primary key, c2 varchar(1024) default null) engine=ndbcluster default charset=latin1; +insert into t1 values (3, null); +select * from t1; +c1 c2 +3 NULL +show binlog events; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +select * from t1; +c1 c2 +3 NULL +drop table t1; +SET GLOBAL ndb_log_empty_epochs=OFF; +show binlog events; +SHOW VARIABLES LIKE 'ndb_log_empty_epochs'; +Variable_name Value +ndb_log_empty_epochs OFF +create table t1 (c1 int not null primary key, c2 blob default null) engine=ndbcluster default charset=latin1; +insert into t1 values (1, null); +show binlog events; +update t1 set c2=null; +select * from t1; +c1 c2 +1 NULL +show binlog events; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +select * from t1; +c1 c2 +1 NULL +drop table t1; +create table t1 (c1 int not null primary key, c2 varchar(1024) default null) engine=ndbcluster default charset=latin1; +insert into t1 values (3, null); +select * from t1; +c1 c2 +3 NULL +show binlog events; +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +select * from t1; +c1 c2 +3 NULL +drop table t1; +SET GLOBAL ndb_log_empty_epochs=OFF; +show binlog events; === modified file 'mysql-test/suite/ndb_binlog/t/ndb_binlog_basic.test' --- a/mysql-test/suite/ndb_binlog/t/ndb_binlog_basic.test 2013-01-11 16:21:06 +0000 +++ b/mysql-test/suite/ndb_binlog/t/ndb_binlog_basic.test 2013-01-18 13:12:32 +0000 @@ -119,3 +119,58 @@ if ($optimize_diff) } drop table t1; + +# +# Make binlog to ignore an empty blob column update +# having before- and after-values 'null' +# when performed in a separate epoch and +# empty epochs are not logged. +# Run the test twice, with ndb_log_empty_epochs ON and OFF. +# + +let $repetitions=2; +SET GLOBAL ndb_log_empty_epochs=ON; +while ($repetitions) +{ + SHOW VARIABLES LIKE 'ndb_log_empty_epochs'; + create table t1 (c1 int not null primary key, c2 blob default null) engine=ndbcluster default charset=latin1; + insert into t1 values (1, null); + + # Avoid the following update being performed within the same epoch by + # synchronising with Binlog + --disable_result_log + show binlog events; + --enable_result_log + + update t1 set c2=null; + select * from t1; + + --disable_result_log + show binlog events; + --enable_result_log + + optimize table t1; + select * from t1; + drop table t1; + + create table t1 (c1 int not null primary key, c2 varchar(1024) default null) engine=ndbcluster default charset=latin1; + insert into t1 values (3, null); + select * from t1; + + --disable_result_log + show binlog events; + --enable_result_log + + optimize table t1; + select * from t1; + drop table t1; + + # Repeat the test with + SET GLOBAL ndb_log_empty_epochs=OFF; + + --disable_result_log + show binlog events; + --enable_result_log + + dec $repetitions; +} === modified file 'sql/ha_ndbcluster_binlog.cc' --- a/sql/ha_ndbcluster_binlog.cc 2012-11-28 12:50:14 +0000 +++ b/sql/ha_ndbcluster_binlog.cc 2013-01-18 14:17:45 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -7324,6 +7324,7 @@ restart_cluster_failure: while (trans.good()) { + commit_to_binlog: if (!ndb_log_empty_epochs()) { /* @@ -7353,7 +7354,6 @@ restart_cluster_failure: break; } } - commit_to_binlog: thd->proc_info= "Committing events to binlog"; if (int r= trans.commit()) { No bundle (reason: useless for push emails).