Commit 93d97129 authored by unknown's avatar unknown

Merge mronstrom@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb

into mysql.com:/Users/mikron/wl1823


ndb/src/kernel/blocks/dbtc/DbtcMain.cpp:
  Auto merged
parents 9b55fbf3 0495242f
...@@ -93,6 +93,7 @@ miguel@hegel.local ...@@ -93,6 +93,7 @@ miguel@hegel.local
miguel@light. miguel@light.
miguel@light.local miguel@light.local
miguel@sartre.local miguel@sartre.local
mikron@mikael-ronstr-ms-dator.local
mmatthew@markslaptop. mmatthew@markslaptop.
monty@bitch.mysql.fi monty@bitch.mysql.fi
monty@butch. monty@butch.
......
...@@ -5950,62 +5950,70 @@ void Dbtc::checkStartFragTimeout(Signal* signal) ...@@ -5950,62 +5950,70 @@ void Dbtc::checkStartFragTimeout(Signal* signal)
/* BEEN DELAYED FOR SO LONG THAT WE ARE FORCED TO PERFORM */ /* BEEN DELAYED FOR SO LONG THAT WE ARE FORCED TO PERFORM */
/* SOME ACTION, EITHER ABORT OR RESEND OR REMOVE A NODE FROM */ /* SOME ACTION, EITHER ABORT OR RESEND OR REMOVE A NODE FROM */
/* THE WAITING PART OF A PROTOCOL. */ /* THE WAITING PART OF A PROTOCOL. */
/*
The algorithm used here is to check 1024 transactions at a time before
doing a real-time break.
To avoid aborting both transactions in a deadlock detected by time-out
we insert a random extra time-out of upto 630 ms by using the lowest
six bits of the api connect reference.
We spread it out from 0 to 630 ms if base time-out is larger than 3 sec,
we spread it out from 0 to 70 ms if base time-out is smaller than 300 msec,
and otherwise we spread it out 310 ms.
*/
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void Dbtc::timeOutLoopStartLab(Signal* signal, Uint32 TapiConPtr) void Dbtc::timeOutLoopStartLab(Signal* signal, Uint32 api_con_ptr)
{ {
UintR texpiredTime[8]; Uint32 end_ptr, time_passed, time_out_value, mask_value;
UintR TloopCount = 0; const Uint32 api_con_sz= capiConnectFilesize;
const Uint32 tc_timer= ctcTimer;
const Uint32 time_out_param= ctimeOutValue;
ctimeOutCheckHeartbeat = ctcTimer; ctimeOutCheckHeartbeat = tc_timer;
const Uint32 TapiConSz = capiConnectFilesize; if (api_con_ptr + 1024 < api_con_sz) {
const Uint32 TtcTimer = ctcTimer; jam();
const Uint32 TtimeOutValue = ctimeOutValue; end_ptr= api_con_ptr + 1024;
} else {
while ((TapiConPtr + 8) < TapiConSz) { jam();
jam(); end_ptr= api_con_sz;
texpiredTime[0] = TtcTimer - getApiConTimer(TapiConPtr + 0); }
texpiredTime[1] = TtcTimer - getApiConTimer(TapiConPtr + 1); if (time_out_param > 300) {
texpiredTime[2] = TtcTimer - getApiConTimer(TapiConPtr + 2); jam();
texpiredTime[3] = TtcTimer - getApiConTimer(TapiConPtr + 3); mask_value= 63;
texpiredTime[4] = TtcTimer - getApiConTimer(TapiConPtr + 4); } else if (time_out_param < 30) {
texpiredTime[5] = TtcTimer - getApiConTimer(TapiConPtr + 5); jam();
texpiredTime[6] = TtcTimer - getApiConTimer(TapiConPtr + 6); mask_value= 7;
texpiredTime[7] = TtcTimer - getApiConTimer(TapiConPtr + 7); } else {
for (Uint32 Ti = 0; Ti < 8; Ti++) { jam();
if (getApiConTimer(TapiConPtr + Ti) != 0) { mask_value= 31;
if (texpiredTime[Ti] > TtimeOutValue) { }
jam(); for ( ; api_con_ptr < end_ptr; api_con_ptr++) {
timeOutFoundLab(signal, TapiConPtr + Ti); Uint32 api_timer= getApiConTimer(api_con_ptr);
return;
}//if
}//if
}//for
TapiConPtr += 8;
if (TloopCount++ > 128) {
jam();
sendContinueTimeOutControl(signal, TapiConPtr);
return;
}//if
}//while
for ( ; TapiConPtr < TapiConSz; TapiConPtr++) {
jam(); jam();
if (getApiConTimer(TapiConPtr) != 0) { if (api_timer != 0) {
texpiredTime[0] = TtcTimer - getApiConTimer(TapiConPtr); time_out_value= time_out_param + (api_con_ptr & mask_value);
if (texpiredTime[0] > TtimeOutValue) { time_passed= tc_timer - api_timer;
if (time_passed > time_out_value) {
jam(); jam();
timeOutFoundLab(signal, TapiConPtr); timeOutFoundLab(signal, api_con_ptr);
return; return;
}//if }
}//if }
}//for }
/*------------------------------------------------------------------*/ if (api_con_ptr == api_con_sz) {
/* */ jam();
/* WE HAVE NOW CHECKED ALL TRANSACTIONS FOR TIME-OUT AND ALSO */ /*------------------------------------------------------------------*/
/* STARTED TIME-OUT HANDLING OF THOSE WE FOUND. WE ARE NOW */ /* */
/* READY AND CAN WAIT FOR THE NEXT TIME-OUT CHECK. */ /* WE HAVE NOW CHECKED ALL TRANSACTIONS FOR TIME-OUT AND ALSO */
/*------------------------------------------------------------------*/ /* STARTED TIME-OUT HANDLING OF THOSE WE FOUND. WE ARE NOW */
ctimeOutCheckActive = TOCS_FALSE; /* READY AND CAN WAIT FOR THE NEXT TIME-OUT CHECK. */
/*------------------------------------------------------------------*/
ctimeOutCheckActive = TOCS_FALSE;
} else {
jam();
sendContinueTimeOutControl(signal, api_con_ptr);
}
return;
}//Dbtc::timeOutLoopStartLab() }//Dbtc::timeOutLoopStartLab()
void Dbtc::timeOutFoundLab(Signal* signal, Uint32 TapiConPtr) void Dbtc::timeOutFoundLab(Signal* signal, Uint32 TapiConPtr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment