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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
fe29dcf9
Commit
fe29dcf9
authored
Dec 22, 2006
by
sunny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify que_fork_start_command() to do only one pass over the thread list
instead of three.
parent
a40a569c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
32 deletions
+33
-32
que/que0que.c
que/que0que.c
+33
-32
No files found.
que/que0que.c
View file @
fe29dcf9
...
...
@@ -335,6 +335,8 @@ que_fork_start_command(
que_fork_t
*
fork
)
/* in: a query fork */
{
que_thr_t
*
thr
;
que_thr_t
*
suspended_thr
=
NULL
;
que_thr_t
*
completed_thr
=
NULL
;
fork
->
state
=
QUE_FORK_ACTIVE
;
...
...
@@ -344,14 +346,18 @@ que_fork_start_command(
but in a parallelized select, which necessarily is non-scrollable,
there may be several to choose from */
/*---------------------------------------------------------------
First we try to find a query thread in the QUE_THR_COMMAND_WAIT state
*/
/* First we try to find a query thread in the QUE_THR_COMMAND_WAIT
state. Then we try to find a query thread in the QUE_THR_SUSPENDED
state, finally we try to find a query thread in the QUE_THR_COMPLETED
state */
thr
=
UT_LIST_GET_FIRST
(
fork
->
thrs
);
while
(
thr
!=
NULL
)
{
if
(
thr
->
state
==
QUE_THR_COMMAND_WAIT
)
{
/* We make a single pass over the thr list within which we note which
threads are ready to run. */
while
(
thr
)
{
switch
(
thr
->
state
)
{
case
QUE_THR_COMMAND_WAIT
:
/* We have to send the initial message to query thread
to start it */
...
...
@@ -359,49 +365,44 @@ que_fork_start_command(
que_thr_init_command
(
thr
);
return
(
thr
);
}
ut_ad
(
thr
->
state
!=
QUE_THR_LOCK_WAIT
);
thr
=
UT_LIST_GET_NEXT
(
thrs
,
thr
);
case
QUE_THR_SUSPENDED
:
/* In this case the execution of the thread was
suspended: no initial message is needed because
execution can continue from where it was left */
if
(
!
suspended_thr
)
{
suspended_thr
=
thr
;
}
/*----------------------------------------------------------------
Then we try to find a query thread in the QUE_THR_SUSPENDED state */
break
;
thr
=
UT_LIST_GET_FIRST
(
fork
->
thrs
);
case
QUE_THR_COMPLETED
:
if
(
!
completed_thr
)
{
completed_thr
=
thr
;
}
while
(
thr
!=
NULL
)
{
if
(
thr
->
state
==
QUE_THR_SUSPENDED
)
{
/* In this case the execution of the thread was
suspended: no initial message is needed because
execution can continue from where it was left */
break
;
que_thr_move_to_run_state
(
thr
);
case
QUE_THR_LOCK_WAIT
:
ut_error
;
return
(
thr
);
}
thr
=
UT_LIST_GET_NEXT
(
thrs
,
thr
);
}
/*-----------------------------------------------------------------
Then we try to find a query thread in the QUE_THR_COMPLETED state */
thr
=
UT_LIST_GET_FIRST
(
fork
->
thrs
);
if
(
suspended_thr
)
{
while
(
thr
!=
NULL
)
{
if
(
thr
->
state
==
QUE_THR_COMPLETED
)
{
que_thr_init_command
(
thr
);
thr
=
suspended_thr
;
que_thr_move_to_run_state
(
thr
);
return
(
thr
);
}
}
else
if
(
completed_thr
)
{
thr
=
UT_LIST_GET_NEXT
(
thrs
,
thr
);
thr
=
completed_thr
;
que_thr_init_command
(
thr
);
}
/* Else we return NULL */
return
(
NULL
);
return
(
thr
);
}
/**************************************************************************
...
...
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