From 291656044ff77ddee66629fd5eb5008b76242143 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Dec 2007 21:31:38 +0100 Subject: [PATCH] Bug #33168 Incorrectly handled parameters can make the TC crash during node failure - during commit deadlock timeout needs to be at least 5 times db hearbeat --- ndb/src/kernel/blocks/dbtc/Dbtc.hpp | 1 + ndb/src/kernel/blocks/dbtc/DbtcMain.cpp | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp index 6fb03fa2407..0c5ee128ce0 100644 --- a/ndb/src/kernel/blocks/dbtc/Dbtc.hpp +++ b/ndb/src/kernel/blocks/dbtc/Dbtc.hpp @@ -1674,6 +1674,7 @@ private: UintR cfailure_nr; UintR coperationsize; UintR ctcTimer; + UintR cDbHbInterval; ApiConnectRecordPtr tmpApiConnectptr; UintR tcheckGcpId; diff --git a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 40d5dcf7407..22fba0bd82c 100644 --- a/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -643,6 +643,10 @@ void Dbtc::execREAD_CONFIG_REQ(Signal* signal) ndb_mgm_get_int_parameter(p, CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT, &val); set_timeout_value(val); + val = 1500; + ndb_mgm_get_int_parameter(p, CFG_DB_HEARTBEAT_INTERVAL, &val); + cDbHbInterval = (val < 10) ? 10 : val; + val = 3000; ndb_mgm_get_int_parameter(p, CFG_DB_TRANSACTION_INACTIVE_TIMEOUT, &val); set_appl_timeout_value(val); @@ -6390,6 +6394,7 @@ void Dbtc::timeOutFoundLab(Signal* signal, Uint32 TapiConPtr, Uint32 errCode) // conditions should get us here. We ignore it. /*------------------------------------------------------------------*/ case CS_PREPARE_TO_COMMIT: + { jam(); /*------------------------------------------------------------------*/ /* WE ARE WAITING FOR DIH TO COMMIT THE TRANSACTION. WE SIMPLY*/ @@ -6398,12 +6403,16 @@ void Dbtc::timeOutFoundLab(Signal* signal, Uint32 TapiConPtr, Uint32 errCode) // To ensure against strange bugs we crash the system if we have passed // time-out period by a factor of 10 and it is also at least 5 seconds. /*------------------------------------------------------------------*/ - if (((ctcTimer - getApiConTimer(apiConnectptr.i)) > (10 * ctimeOutValue)) && - ((ctcTimer - getApiConTimer(apiConnectptr.i)) > 500)) { - jam(); - systemErrorLab(signal, __LINE__); + Uint32 time_passed = ctcTimer - getApiConTimer(apiConnectptr.i); + if (time_passed > 500 && + time_passed > (5 * cDbHbInterval) && + time_passed > (10 * ctimeOutValue)) + { + jam(); + systemErrorLab(signal, __LINE__); }//if break; + } case CS_COMMIT_SENT: jam(); /*------------------------------------------------------------------*/