forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 19
Antalya-26.6 - Fix races in the export_merge_tree_part test family #2255
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
Merged
Merged
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
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,56 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # EXPORT PART runs in the background, so wait for it instead of sleeping. | ||
| # $1 is how many exports should have completed by this point, counted from the start of | ||
| # the test (part_log is not cleared during a run, so the number is cumulative). | ||
| function wait_for_exports() | ||
| { | ||
| local expected=$1 | ||
| local database=${2:-$CLICKHOUSE_DATABASE} | ||
| local timeout=${3:-120} | ||
|
|
||
| while [[ $timeout -gt 0 ]] | ||
| do | ||
| ${CLICKHOUSE_CLIENT} --query="SYSTEM FLUSH LOGS" > /dev/null 2>&1 | ||
| res=$(${CLICKHOUSE_CLIENT} --query="SELECT count() FROM system.part_log WHERE event_type = 'ExportPart' AND database = '$database'") | ||
| [[ $res -ge $expected ]] && return 0 | ||
|
|
||
| sleep 1 | ||
| timeout=$((timeout - 1)) | ||
| done | ||
|
|
||
| echo "Timed out while waiting for $expected export(s) to complete!" >&2 | ||
| ${CLICKHOUSE_CLIENT} --query="SELECT source_table, part_name, elapsed FROM system.exports WHERE source_database = '$database'" | ||
| return 2 | ||
| } | ||
|
|
||
| # EXPORT PARTITION runs in the background, so wait for it instead of sleeping. | ||
| # $1 is how many partition exports should have completed by this point, counted from the | ||
| # start of the test (the table keeps one row per export operation). | ||
| function wait_for_partition_exports() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I think it's better if you provide the partition id or transaction id you are waiting for instead of the count. In any case, I suppose this is good enough for testing code |
||
| { | ||
| local expected=$1 | ||
| local database=${2:-$CLICKHOUSE_DATABASE} | ||
| local timeout=${3:-120} | ||
|
|
||
| while [[ $timeout -gt 0 ]] | ||
| do | ||
| res=$(${CLICKHOUSE_CLIENT} --query="SELECT countIf(status = 'COMPLETED') FROM system.replicated_partition_exports WHERE source_database = '$database'") | ||
| [[ $res -ge $expected ]] && return 0 | ||
|
|
||
| if [[ $(${CLICKHOUSE_CLIENT} --query="SELECT countIf(status IN ('FAILED', 'KILLED')) FROM system.replicated_partition_exports WHERE source_database = '$database'") -gt 0 ]]; then | ||
| echo "Partition export failed!" >&2 | ||
| ${CLICKHOUSE_CLIENT} --query="SELECT partition_id, status, exception_count, last_exception_per_replica FROM system.replicated_partition_exports WHERE source_database = '$database'" | ||
| return 2 | ||
| fi | ||
|
|
||
| sleep 1 | ||
| timeout=$((timeout - 1)) | ||
| done | ||
|
|
||
| echo "Timed out while waiting for $expected partition export(s) to complete!" >&2 | ||
| ${CLICKHOUSE_CLIENT} --query="SELECT partition_id, status, parts_count, parts_to_do FROM system.replicated_partition_exports WHERE source_database = '$database'" | ||
| return 2 | ||
| } | ||
|
|
||
| # vi: ft=bash | ||
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.
Uh oh!
There was an error while loading. Please reload this page.