-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-39492 Parallel Query: Study how to create worker threads #5099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mariadb-RexJohnston
wants to merge
1
commit into
main
Choose a base branch
from
13.0-MDEV-39492-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # | ||
| # MDEV-39492 Parallel Query: Study how to create worker threads | ||
| # | ||
| connect killee, localhost, root, , ; | ||
| # check that kill query on a parallel worker is passed to the manager | ||
| connection killee; | ||
| set session parallel_worker_threads=3; | ||
| select seq from seq_1_to_2;; | ||
| connection default; | ||
| kill query ID; | ||
| connection killee; | ||
| ERROR 70100: Query execution was interrupted | ||
| # reset connection, discard any generated errors | ||
| disconnect killee; | ||
| connect killee, localhost, root, , ; | ||
| # check that kill on a parallel worker is passed to the manager | ||
| # doing this last so we don't need to restart default connection | ||
| set session parallel_worker_threads=3; | ||
| select seq from seq_1_to_2;; | ||
| connection default; | ||
| kill ID; | ||
| connection killee; | ||
| Got one of the listed errors | ||
| # generated error die with connection | ||
| connection default; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # | ||
| # Test KILL and KILL QUERY statements. | ||
| # | ||
|
|
||
| -- source include/count_sessions.inc | ||
| -- source include/not_embedded.inc | ||
| # this will be used in the future -- source include/have_innodb.inc | ||
| -- source include/have_sequence.inc | ||
|
|
||
| --disable_service_connection | ||
|
|
||
| --echo # | ||
| --echo # MDEV-39492 Parallel Query: Study how to create worker threads | ||
| --echo # | ||
|
|
||
| connect (killee, localhost, root, , ); | ||
|
|
||
| --echo # check that kill query on a parallel worker is passed to the manager | ||
|
|
||
| connection killee; | ||
| let $id= `select connection_id()`; | ||
| set session parallel_worker_threads=3; | ||
| --send select seq from seq_1_to_2; | ||
| connection default; | ||
| let $name= "%parallel worker $id"; | ||
| let $wait_condition= SELECT @kid:=ID from information_schema.processlist where info like $name limit 1; | ||
| source include/wait_condition.inc; | ||
| let $killID= `select @kid`; | ||
| --replace_result $killID ID | ||
| eval kill query $killID; | ||
| connection killee; | ||
| --error 1317 | ||
| --reap | ||
|
|
||
| --echo # reset connection, discard any generated errors | ||
| disconnect killee; | ||
| connect (killee, localhost, root, , ); | ||
|
|
||
| --echo # check that kill on a parallel worker is passed to the manager | ||
| --echo # doing this last so we don't need to restart default connection | ||
|
|
||
| let $id= `select connection_id()`; | ||
| set session parallel_worker_threads=3; | ||
| --send select seq from seq_1_to_2; | ||
| connection default; | ||
| let $name= "%parallel worker $id"; | ||
| let $wait_condition= SELECT @kid:=ID from information_schema.processlist where info like $name limit 1; | ||
| source include/wait_condition.inc; | ||
| let $killID= `select @kid`; | ||
| --replace_result $killID ID | ||
| eval kill $killID; | ||
| connection killee; | ||
| --error 1317,2013 | ||
| --reap | ||
| --echo # generated error die with connection | ||
|
|
||
| connection default; | ||
| --source include/wait_until_count_sessions.inc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # | ||
| # MDEV-39492 Parallel Query: OOM in worker error_to_queue surfaces a | ||
| # single ER_OUTOFMEMORY warning so worker diagnostics aren't silently | ||
| # lost. | ||
| # | ||
| set @save_dbug=@@global.debug_dbug; | ||
| set global debug_dbug="+d,pwt_error_to_queue_oom"; | ||
| set session parallel_worker_threads=1; | ||
| # The prototype worker emits either a warning or my_error() depending on the | ||
| # parity of its thread id. Either path runs through error_to_queue; the | ||
| # DBUG injection forces both into the OOM branch, so neither the original | ||
| # warning nor the original error reaches the user. We expect just the | ||
| # manager-surfaced ER_OUTOFMEMORY warning. | ||
| select count(*) from seq_1_to_2; | ||
| count(*) | ||
| 2 | ||
| show warnings; | ||
| Level Code Message | ||
| Warning 1037 Parallel worker diagnostics were dropped due to memory allocation failure | ||
| set global debug_dbug=@save_dbug; | ||
| set session parallel_worker_threads=default; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # | ||
| # Test OOM handling in the parallel worker error/warning queue. | ||
| # | ||
|
|
||
| -- source include/count_sessions.inc | ||
| -- source include/not_embedded.inc | ||
| -- source include/have_sequence.inc | ||
| -- source include/have_debug.inc | ||
|
|
||
| --disable_service_connection | ||
|
|
||
| --echo # | ||
| --echo # MDEV-39492 Parallel Query: OOM in worker error_to_queue surfaces a | ||
| --echo # single ER_OUTOFMEMORY warning so worker diagnostics aren't silently | ||
| --echo # lost. | ||
| --echo # | ||
|
|
||
| set @save_dbug=@@global.debug_dbug; | ||
| set global debug_dbug="+d,pwt_error_to_queue_oom"; | ||
| set session parallel_worker_threads=1; | ||
|
|
||
| --echo # The prototype worker emits either a warning or my_error() depending on the | ||
| --echo # parity of its thread id. Either path runs through error_to_queue; the | ||
| --echo # DBUG injection forces both into the OOM branch, so neither the original | ||
| --echo # warning nor the original error reaches the user. We expect just the | ||
| --echo # manager-surfaced ER_OUTOFMEMORY warning. | ||
| select count(*) from seq_1_to_2; | ||
| show warnings; | ||
|
|
||
| set global debug_dbug=@save_dbug; | ||
| set session parallel_worker_threads=default; | ||
|
|
||
| --source include/wait_until_count_sessions.inc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The macro name
MAX_THREAD_NAMEis quite generic and could potentially conflict with definitions in system headers or other libraries. It is recommended to use a more specific prefix, such asMY_MAX_THREAD_NAMEorMARIADB_MAX_THREAD_NAME.