Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
80bb1371
Commit
80bb1371
authored
Jun 10, 2004
by
mronstrom@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Randomise time-out to avoid aborting both transactions in deadlock
parent
8742612a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
49 deletions
+58
-49
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
+57
-49
No files found.
BitKeeper/etc/logging_ok
View file @
80bb1371
...
...
@@ -93,6 +93,7 @@ miguel@hegel.local
miguel@light.
miguel@light.local
miguel@sartre.local
mikron@mikael-ronstr-ms-dator.local
mmatthew@markslaptop.
monty@bitch.mysql.fi
monty@butch.
...
...
ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
View file @
80bb1371
...
...
@@ -5950,55 +5950,58 @@ void Dbtc::checkStartFragTimeout(Signal* signal)
/* BEEN DELAYED FOR SO LONG THAT WE ARE FORCED TO PERFORM */
/* SOME ACTION, EITHER ABORT OR RESEND OR REMOVE A NODE FROM */
/* 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
TapiConP
tr
)
void
Dbtc
::
timeOutLoopStartLab
(
Signal
*
signal
,
Uint32
api_con_p
tr
)
{
UintR
texpiredTime
[
8
];
UintR
TloopCount
=
0
;
Uint32
end_ptr
,
time_passed
,
time_out_value
,
mask_value
;
const
Uint32
api_con_sz
=
capiConnectFilesize
;
const
Uint32
tc_timer
=
ctcTimer
;
const
Uint32
time_out_param
=
ctimeOutValue
;
ctimeOutCheckHeartbeat
=
ctcT
imer
;
ctimeOutCheckHeartbeat
=
tc_t
imer
;
const
Uint32
TapiConSz
=
capiConnectFilesize
;
const
Uint32
TtcTimer
=
ctcTimer
;
const
Uint32
TtimeOutValue
=
ctimeOutValue
;
while
((
TapiConPtr
+
8
)
<
TapiConSz
)
{
if
(
api_con_ptr
+
1024
<
api_con_sz
)
{
jam
();
texpiredTime
[
0
]
=
TtcTimer
-
getApiConTimer
(
TapiConPtr
+
0
);
texpiredTime
[
1
]
=
TtcTimer
-
getApiConTimer
(
TapiConPtr
+
1
);
texpiredTime
[
2
]
=
TtcTimer
-
getApiConTimer
(
TapiConPtr
+
2
);
texpiredTime
[
3
]
=
TtcTimer
-
getApiConTimer
(
TapiConPtr
+
3
);
texpiredTime
[
4
]
=
TtcTimer
-
getApiConTimer
(
TapiConPtr
+
4
);
texpiredTime
[
5
]
=
TtcTimer
-
getApiConTimer
(
TapiConPtr
+
5
);
texpiredTime
[
6
]
=
TtcTimer
-
getApiConTimer
(
TapiConPtr
+
6
);
texpiredTime
[
7
]
=
TtcTimer
-
getApiConTimer
(
TapiConPtr
+
7
);
for
(
Uint32
Ti
=
0
;
Ti
<
8
;
Ti
++
)
{
if
(
getApiConTimer
(
TapiConPtr
+
Ti
)
!=
0
)
{
if
(
texpiredTime
[
Ti
]
>
TtimeOutValue
)
{
end_ptr
=
api_con_ptr
+
1024
;
}
else
{
jam
();
timeOutFoundLab
(
signal
,
TapiConPtr
+
Ti
);
return
;
}
//if
}
//if
}
//for
TapiConPtr
+=
8
;
if
(
TloopCount
++
>
128
)
{
end_ptr
=
api_con_sz
;
}
if
(
time_out_param
>
300
)
{
jam
();
sendContinueTimeOutControl
(
signal
,
TapiConPtr
);
return
;
}
//if
}
//while
for
(
;
TapiConPtr
<
TapiConSz
;
TapiConPtr
++
)
{
mask_value
=
63
;
}
else
if
(
time_out_param
<
30
)
{
jam
();
if
(
getApiConTimer
(
TapiConPtr
)
!=
0
)
{
texpiredTime
[
0
]
=
TtcTimer
-
getApiConTimer
(
TapiConPtr
);
if
(
texpiredTime
[
0
]
>
TtimeOutValue
)
{
mask_value
=
7
;
}
else
{
jam
();
mask_value
=
31
;
}
for
(
;
api_con_ptr
<
end_ptr
;
api_con_ptr
++
)
{
Uint32
api_timer
=
getApiConTimer
(
api_con_ptr
);
jam
();
if
(
api_timer
!=
0
)
{
time_out_value
=
time_out_param
+
(
api_con_ptr
&
31
);
time_passed
=
tc_timer
-
api_timer
;
if
(
time_passed
>
time_out_value
)
{
jam
();
timeOutFoundLab
(
signal
,
TapiConP
tr
);
timeOutFoundLab
(
signal
,
api_con_p
tr
);
return
;
}
//if
}
//if
}
//for
}
}
}
if
(
api_con_ptr
==
api_con_sz
)
{
jam
();
/*------------------------------------------------------------------*/
/* */
/* WE HAVE NOW CHECKED ALL TRANSACTIONS FOR TIME-OUT AND ALSO */
...
...
@@ -6006,6 +6009,11 @@ void Dbtc::timeOutLoopStartLab(Signal* signal, Uint32 TapiConPtr)
/* READY AND CAN WAIT FOR THE NEXT TIME-OUT CHECK. */
/*------------------------------------------------------------------*/
ctimeOutCheckActive
=
TOCS_FALSE
;
}
else
{
jam
();
sendContinueTimeOutControl
(
signal
,
api_con_ptr
);
}
return
;
}
//Dbtc::timeOutLoopStartLab()
void
Dbtc
::
timeOutFoundLab
(
Signal
*
signal
,
Uint32
TapiConPtr
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment