5069 Maitrayi Sabaratnam 2013-01-11
Bug#16028096 - DO NOT SEND EVENTS CONNECTED TO TABLE-OPTIMIZE
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
5068 Frazer Clement 2013-01-10
Bug #14537622 FORCED NODE SHUTDOWN COMPLETED. CAUSED BY ERROR 2339: SEND SIGNAL ERROR
Signal trace shows a badly formed DUMP_STATE_ORD signal resulted in the
crash.
DUMP 1000 reports resource usage and is used by some customers from their
monitoring middleware. Perhaps a malformed request was made.
This patch adds some validation to the received block reference, to ensure
that the receiving node id is in range.
This should make the DUMP 1000 handling more robust to misuse.
modified:
mysql-test/suite/ndb/r/ndb_mgm.result
mysql-test/suite/ndb/t/ndb_mgm.test
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
=== modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result'
--- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result 2008-02-25 13:50:20 +0000
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result 2013-01-11 16:21:06 +0000
@@ -49,3 +49,17 @@ select inserts,updates,deletes from
mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 0;
inserts updates deletes
2 0 0
+create table t1 (c1 int not null primary key, c2 blob default null) engine=ndbcluster default charset=latin1;
+insert into t1 values (1, null), (2, null), (3, null), (4, null);
+insert into t1 select c1+4,c2 from t1;
+insert into t1 select c1+8,c2 from t1;
+insert into t1 select c1+16,c2 from t1;
+insert into t1 select c1+32,c2 from t1;
+insert into t1 select c1+64,c2 from t1;
+insert into t1 select c1+128,c2 from t1;
+insert into t1 select c1+256,c2 from t1;
+insert into t1 select c1+512,c2 from t1;
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+drop table t1;
=== modified file 'mysql-test/suite/ndb_binlog/t/ndb_binlog_basic.test'
--- a/mysql-test/suite/ndb_binlog/t/ndb_binlog_basic.test 2008-02-25 13:50:20 +0000
+++ b/mysql-test/suite/ndb_binlog/t/ndb_binlog_basic.test 2013-01-11 16:21:06 +0000
@@ -79,3 +79,43 @@ drop table t1;
drop database mysqltest;
select inserts,updates,deletes from
mysql.ndb_binlog_index where epoch > @max_epoch and inserts > 0;
+
+#
+# Check optimize table does not send any event to binlog
+#
+
+create table t1 (c1 int not null primary key, c2 blob default null) engine=ndbcluster default charset=latin1;
+insert into t1 values (1, null), (2, null), (3, null), (4, null);
+insert into t1 select c1+4,c2 from t1;
+insert into t1 select c1+8,c2 from t1;
+insert into t1 select c1+16,c2 from t1;
+insert into t1 select c1+32,c2 from t1;
+insert into t1 select c1+64,c2 from t1;
+insert into t1 select c1+128,c2 from t1;
+insert into t1 select c1+256,c2 from t1;
+insert into t1 select c1+512,c2 from t1;
+
+# wait for last gcp to complete, ensuring that we have
+# the expected data in the binlog
+save_master_pos;
+
+let $before = `select count(*)
+ from mysql.ndb_binlog_index
+ where epoch > @max_epoch and
+ (inserts > 0 or updates > 0 or deletes > 0)`;
+
+optimize table t1;
+save_master_pos;
+
+# Ensure that optimize have not sent any event to binlog
+let $optimize_diff = `select count(*) <> $before
+ from mysql.ndb_binlog_index
+ where epoch > @max_epoch and
+ (inserts > 0 or updates > 0 or deletes > 0)`;
+
+if ($optimize_diff)
+{
+ die Optimize table should not send any events to binlog;
+}
+
+drop table t1;
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2011-12-01 10:45:07 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2013-01-11 16:21:06 +0000
@@ -834,6 +834,11 @@ struct Operationrec {
unsigned int m_load_diskpage_on_commit : 1;
unsigned int m_wait_log_buffer : 1;
unsigned int m_gci_written : 1;
+ /* If the op has no logical effect, it should not be logged
+ * or sent as an event. Example op is OPTIMIZE table,
+ * which uses ZUPDATE to move varpart values physically.
+ */
+ unsigned int m_physical_only_op : 1;
};
union {
OpBitFields op_struct;
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2012-12-03 09:00:33 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2013-01-11 16:21:06 +0000
@@ -626,6 +626,7 @@ void Dbtup::execTUPKEYREQ(Signal* signal
regOperPtr->m_copy_tuple_location.setNull();
regOperPtr->tupVersion= ZNIL;
+ regOperPtr->op_struct.m_physical_only_op = 0;
sig1= tupKeyReq->savePointId;
sig2= tupKeyReq->primaryReplica;
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2011-06-30 15:59:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp 2013-01-11 16:21:06 +0000
@@ -1743,6 +1743,11 @@ int Dbtup::updateAttributes(KeyReqStruct
AttributeHeader::OPTIMIZE_OPTIONS_MASK;
inBufIndex += 1 + sz;
req_struct->in_buf_index = inBufIndex;
+ if (inBufIndex == 1 + sz && inBufIndex == inBufLen)
+ {
+ // No table attributes are updated. Optimize op only.
+ regOperPtr->op_struct.m_physical_only_op = 1;
+ }
}
else if (attributeId == AttributeHeader::ROW_AUTHOR)
{
=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp 2011-12-23 11:04:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp 2013-01-11 16:21:06 +0000
@@ -1637,6 +1637,27 @@ bool Dbtup::readTriggerInfo(TupTriggerDa
req_struct->check_offset[DD]= regTabPtr->get_check_offset(DD);
req_struct->attr_descr= &tableDescriptor[descr_start];
+ if ((regOperPtr->op_struct.m_physical_only_op == 1) &&
+ (refToMain(trigPtr->m_receiverRef) == SUMA ||
+ refToMain(trigPtr->m_receiverRef) == BACKUP))
+ {
+ /* Operations that have no logical effect need not be backed up
+ * or sent as an event. Eg. OPTIMIZE TABLE is performed as a
+ * ZUPDATE operation on table records, moving the varpart
+ * column-values between pages, to be storage-effective.
+ */
+ Uint32 changed_attribs = 0;
+ for (Uint32 i = 0; i < regTabPtr->m_no_of_attributes; i++) {
+ jam();
+ if (req_struct->changeMask.get(i)) {
+ jam();
+ changed_attribs++;
+ }
+ }
+ ndbrequire(changed_attribs == 0);
+ return false;
+ }
+
//--------------------------------------------------------------------
// Read Primary Key Values
//--------------------------------------------------------------------
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (maitrayi.sabaratnam:5068 to 5069)Bug#16028096 | Maitrayi Sabaratnam | 18 Feb 2013 |