From: Jan Wedvik Date: January 21 2013 9:11am Subject: bzr push into mysql-5.5-cluster-7.2 branch (jan.wedvik:4155 to 4156) List-Archive: http://lists.mysql.com/commits/145620 Message-Id: <20130121091100.29693.27104.4156@fimafeng09.no.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4156 Jan Wedvik 2013-01-21 [merge] Merge 7.1 -> 7.2. modified: storage/ndb/src/kernel/vm/SimulatedBlock.cpp storage/ndb/src/kernel/vm/SimulatedBlock.hpp storage/ndb/src/kernel/vm/VMSignal.hpp 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 === modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.cpp' --- a/storage/ndb/src/kernel/vm/SimulatedBlock.cpp 2012-02-23 15:41:31 +0000 +++ b/storage/ndb/src/kernel/vm/SimulatedBlock.cpp 2013-01-21 09:09:32 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2003, 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 @@ -297,45 +297,34 @@ SimulatedBlock::signal_error(Uint32 gsn, extern class SectionSegmentPool g_sectionSegmentPool; -#define check_sections(signal, cnt, cnt2) do { if (unlikely(cnt)) { handle_invalid_sections_in_send_signal(signal); } else if (unlikely(cnt2 == 0 && (signal->header.m_fragmentInfo != 0 && signal->header.m_fragmentInfo != 3))) { handle_invalid_fragmentInfo(signal); } } while(0) - void -SimulatedBlock::handle_invalid_sections_in_send_signal(Signal* signal) const +SimulatedBlock::handle_invalid_sections_in_send_signal(const Signal* signal) +const { - //Uint32 cnt = signal->header.m_noOfSections; -#if defined VM_TRACE || defined ERROR_INSERT + char errMsg[160]; + BaseString::snprintf(errMsg, sizeof errMsg, + "Unhandled sections in sendSignal for GSN %u (%s).", + signal->header.theVerId_signalNumber, + getSignalName(signal->header.theVerId_signalNumber)); + // Print message and terminate. ErrorReporter::handleError(NDBD_EXIT_BLOCK_BNR_ZERO, - "Unhandled sections in sendSignal", - ""); -#else - infoEvent("Unhandled sections in sendSignal!!"); -#endif -} - -void -SimulatedBlock::handle_lingering_sections_after_execute(Signal* signal) const -{ - //Uint32 cnt = signal->header.m_noOfSections; -#if defined VM_TRACE || defined ERROR_INSERT - ErrorReporter::handleError(NDBD_EXIT_BLOCK_BNR_ZERO, - "Unhandled sections after execute", - ""); -#else - infoEvent("Unhandled sections after execute"); -#endif + errMsg, + ""); } void -SimulatedBlock::handle_lingering_sections_after_execute(SectionHandle* handle) const +SimulatedBlock::handle_lingering_sections_after_execute(const Signal* signal) +const { - //Uint32 cnt = signal->header.m_noOfSections; -#if defined VM_TRACE || defined ERROR_INSERT + char errMsg[160]; + BaseString::snprintf(errMsg, sizeof errMsg, + "Unhandled sections after execute for GSN %u (%s).", + signal->header.theVerId_signalNumber, + getSignalName(signal->header.theVerId_signalNumber)); + // Print message and terminate. ErrorReporter::handleError(NDBD_EXIT_BLOCK_BNR_ZERO, - "Unhandled sections(handle) after execute", - ""); -#else - infoEvent("Unhandled sections(handle) after execute"); -#endif + errMsg, + ""); } void @@ -510,18 +499,17 @@ SimulatedBlock::sendSignal(BlockReferenc BlockReference sendBRef = reference(); - Uint32 noOfSections = signal->header.m_noOfSections; Uint32 recBlock = refToBlock(ref); Uint32 recNode = refToNode(ref); Uint32 ourProcessor = globalData.ownId; + check_sections(signal, signal->header.m_noOfSections, 0); + signal->header.theLength = length; signal->header.theVerId_signalNumber = gsn; signal->header.theReceiversBlockNumber = recBlock; signal->header.m_noOfSections = 0; - check_sections(signal, noOfSections, 0); - Uint32 tSignalId = signal->header.theSignalId; if ((length == 0) || length > 25 || (recBlock == 0)) { === modified file 'storage/ndb/src/kernel/vm/SimulatedBlock.hpp' --- a/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2012-10-17 14:43:50 +0000 +++ b/storage/ndb/src/kernel/vm/SimulatedBlock.hpp 2013-01-21 09:09:32 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2003, 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 @@ -359,9 +359,8 @@ protected: bool dupSection(Uint32& copyFirstIVal, Uint32 srcFirstIVal); bool writeToSection(Uint32 firstSegmentIVal, Uint32 offset, const Uint32* src, Uint32 len); - void handle_invalid_sections_in_send_signal(Signal*) const; - void handle_lingering_sections_after_execute(Signal*) const; - void handle_lingering_sections_after_execute(SectionHandle*) const; + void handle_invalid_sections_in_send_signal(const Signal*) const; + void handle_lingering_sections_after_execute(const Signal*) const; void handle_invalid_fragmentInfo(Signal*) const; void handle_send_failed(SendStatus, Signal*) const; void handle_out_of_longsignal_memory(Signal*) const; @@ -912,6 +911,9 @@ private: void execUTIL_UNLOCK_REF(Signal* signal); void execUTIL_UNLOCK_CONF(Signal* signal); + void check_sections(Signal* signal, + Uint32 oldSecCount, + Uint32 newSecCount) const; protected: void fsRefError(Signal* signal, Uint32 line, const char *msg); @@ -1296,6 +1298,25 @@ SimulatedBlock::EXECUTE_DIRECT(Uint32 bl #endif } +// Do a consictency check before reusing a signal. +inline void +SimulatedBlock::check_sections(Signal* signal, + Uint32 oldSecCount, + Uint32 newSecCount) const +{ + // Sections from previous use should have been consumed by now. + if (unlikely(oldSecCount != 0)) + { + handle_invalid_sections_in_send_signal(signal); + } + else if (unlikely(newSecCount == 0 && + signal->header.m_fragmentInfo != 0 && + signal->header.m_fragmentInfo != 3)) + { + handle_invalid_fragmentInfo(signal); + } +} + /** * Defines for backward compatiblility */ @@ -1320,15 +1341,6 @@ BLOCK::addRecSignal(GlobalSignalNumber g #include "Mutex.hpp" -inline -SectionHandle::~SectionHandle() -{ - if (unlikely(m_cnt)) - { - m_block->handle_lingering_sections_after_execute(this); - } -} - #ifdef ERROR_INSERT #define RSS_AP_SNAPSHOT(x) Uint32 rss_##x #define RSS_AP_SNAPSHOT_SAVE(x) rss_##x = x.getNoOfFree() === modified file 'storage/ndb/src/kernel/vm/VMSignal.hpp' --- a/storage/ndb/src/kernel/vm/VMSignal.hpp 2011-02-01 23:27:25 +0000 +++ b/storage/ndb/src/kernel/vm/VMSignal.hpp 2013-01-21 08:51:46 +0000 @@ -1,5 +1,5 @@ /* - Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2003, 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 @@ -293,4 +293,15 @@ SectionHandle::getSection(SegmentedSecti return false; } +inline +SectionHandle::~SectionHandle() +{ + if (unlikely(m_cnt)) + { + ErrorReporter::handleError(NDBD_EXIT_BLOCK_BNR_ZERO, + "Unhandled sections(handle) after execute", + ""); + } +} + #endif No bundle (reason: useless for push emails).