From: Maitrayi Sabaratnam Date: October 7 2011 4:13pm Subject: bzr push into mysql-5.1-telco-7.0 branch (maitrayi.sabaratnam:4583 to 4584) List-Archive: http://lists.mysql.com/commits/141357 Message-Id: <20111007161334.16565.qmail@asator03> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4584 Maitrayi Sabaratnam 2011-10-07 Bug 12598636 - DATA NODE SHOULD SHUTDOWN WHEN IT DETECTS INCORRECT TUPLE CHECKSUM modified: storage/ndb/include/mgmapi/mgmapi_config_parameters.h storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp storage/ndb/src/mgmsrv/ConfigInfo.cpp 4583 jonas oreland 2011-10-07 ndb - add ndbinfo.transactions showing ongoing transactions (patch also remove unused states in TC) TODO: - SQL - verify all outstanding calculations - maybe use coord-trans type transaction id (not to confuse things too much) - expose transaction id per mysql-connection, maybe using information_schema - ndbinfo.operations (in LQH) modified: mysql-test/suite/ndb/r/ndbinfo.result storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp storage/ndb/src/kernel/vm/Ndbinfo.hpp storage/ndb/src/kernel/vm/NdbinfoTables.cpp === modified file 'storage/ndb/include/mgmapi/mgmapi_config_parameters.h' --- a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h 2011-08-30 09:40:52 +0000 +++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h 2011-10-07 16:12:13 +0000 @@ -197,6 +197,8 @@ #define CFG_DB_MAX_DML_OPERATIONS_PER_TRANSACTION 627 #define CFG_DB_MT_THREAD_CONFIG 628 +#define CFG_DB_CRASH_ON_CORRUPTED_TUPLE 629 + #define CFG_NODE_ARBIT_RANK 200 #define CFG_NODE_ARBIT_DELAY 201 #define CFG_RESERVED_SEND_BUFFER_MEMORY 202 === modified file 'storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp' --- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2011-09-01 18:42:31 +0000 +++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp 2011-10-07 16:12:13 +0000 @@ -579,6 +579,9 @@ typedef Ptr FragoperrecPtr; // for md5 of key (could maybe reuse existing temp buffer) Uint64 c_dataBuffer[ZWORDS_ON_PAGE/2 + 1]; + // Crash the node when a tuple got corrupted + bool c_crashOnCorruptedTuple; + struct Page_request { Page_request() {} @@ -2894,6 +2897,7 @@ private: Uint32 calculateChecksum(Tuple_header*, Tablerec* regTabPtr); void setChecksum(Tuple_header*, Tablerec* regTabPtr); + int corruptedTupleDetected(KeyReqStruct*); void complexTrigger(Signal* signal, KeyReqStruct *req_struct, === modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp' --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2011-05-25 13:19:02 +0000 +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp 2011-10-07 16:12:13 +0000 @@ -166,6 +166,20 @@ Dbtup::calculateChecksum(Tuple_header* t return checksum; } +int +Dbtup::corruptedTupleDetected(KeyReqStruct *req_struct) +{ + ndbout_c("Tuple corruption detected."); + if (c_crashOnCorruptedTuple) + { + ndbout_c(" Exiting."); + ndbrequire(false); + } + terrorCode= ZTUPLE_CORRUPTED_ERROR; + tupkeyErrorLab(req_struct); + return -1; +} + /* ----------------------------------------------------------------- */ /* ----------- INSERT_ACTIVE_OP_LIST -------------- */ /* ----------------------------------------------------------------- */ @@ -1014,10 +1028,7 @@ int Dbtup::handleReadReq(Signal* signal, if ((regTabPtr->m_bits & Tablerec::TR_Checksum) && (calculateChecksum(req_struct->m_tuple_ptr, regTabPtr) != 0)) { jam(); - ndbout_c("here2"); - terrorCode= ZTUPLE_CORRUPTED_ERROR; - tupkeyErrorLab(req_struct); - return -1; + return corruptedTupleDetected(req_struct); } const Uint32 node = refToNode(sendBref); @@ -1139,8 +1150,8 @@ int Dbtup::handleUpdateReq(Signal* signa if ((regTabPtr->m_bits & Tablerec::TR_Checksum) && (calculateChecksum(req_struct->m_tuple_ptr, regTabPtr) != 0)) { - terrorCode= ZTUPLE_CORRUPTED_ERROR; - goto error; + jam(); + return corruptedTupleDetected(req_struct); } req_struct->m_tuple_ptr= dst; === modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp' --- a/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp 2011-05-17 23:29:55 +0000 +++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp 2011-10-07 16:12:13 +0000 @@ -497,6 +497,14 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* } initialiseRecordsLab(signal, 0, ref, senderData); + + { + Uint32 val = 0; + ndb_mgm_get_int_parameter(p, CFG_DB_CRASH_ON_CORRUPTED_TUPLE, + &val); + c_crashOnCorruptedTuple = val ? true : false; + } + }//Dbtup::execSIZEALT_REP() void Dbtup::initRecords() === modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp' --- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2011-09-02 17:24:52 +0000 +++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp 2011-10-07 16:12:13 +0000 @@ -2122,6 +2122,22 @@ const ConfigInfo::ParamInfo ConfigInfo:: STR_VALUE(MAX_INT_RNIL) }, + { + CFG_DB_CRASH_ON_CORRUPTED_TUPLE, + "CrashOnCorruptedTuple", + DB_TOKEN, + "To be failfast or not, when checksum indicates corruption.", + ConfigInfo::CI_USED, + false, + ConfigInfo::CI_BOOL, +#if NDB_VERSION_D < NDB_MAKE_VERSION(7,2,1) + "false", +#else + "true", +#endif + "false", + "true"}, + /*************************************************************************** * API ***************************************************************************/ No bundle (reason: useless for push emails).