forked from ClickHouse/ClickHouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix summary reporting with parallel replicas with LIMIT (ClickHouse#5…
- Loading branch information
1 parent
a663f7e
commit e192d4c
Showing
13 changed files
with
166 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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
4 changes: 4 additions & 0 deletions
4
tests/queries/0_stateless/02841_parallel_replicas_summary.reference
This file contains 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,4 @@ | ||
1 | ||
1 | ||
02841_summary_default_interactive_0 2 | ||
02841_summary_default_interactive_high 2 |
61 changes: 61 additions & 0 deletions
61
tests/queries/0_stateless/02841_parallel_replicas_summary.sh
This file contains 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,61 @@ | ||
#!/usr/bin/env bash | ||
|
||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
# shellcheck source=../shell_config.sh | ||
. "$CUR_DIR"/../shell_config.sh | ||
|
||
function involved_parallel_replicas () { | ||
# Not using current_database = '$CLICKHOUSE_DATABASE' as nested parallel queries aren't run with it | ||
$CLICKHOUSE_CLIENT --query " | ||
SELECT | ||
initial_query_id, | ||
(count() - 2) / 2 as number_of_parallel_replicas | ||
FROM system.query_log | ||
WHERE event_date >= yesterday() | ||
AND initial_query_id LIKE '$1%' | ||
GROUP BY initial_query_id | ||
ORDER BY min(event_time_microseconds) ASC | ||
FORMAT TSV" | ||
} | ||
|
||
$CLICKHOUSE_CLIENT --query "CREATE TABLE replicas_summary (n Int64) ENGINE = MergeTree() ORDER BY n AS Select * from numbers(100_000)" | ||
|
||
# Note that we are not verifying the exact read rows and bytes (apart from not being 0) for 2 reasons: | ||
# - Different block sizes lead to different read rows | ||
# - Depending on how fast the replicas are they might need data that ends up being discarded because the coordinator | ||
# already has enough (but it has been read in parallel, so it's reported). | ||
|
||
query_id_base="02841_summary_$CLICKHOUSE_DATABASE" | ||
|
||
echo " | ||
SELECT * | ||
FROM replicas_summary | ||
LIMIT 100 | ||
SETTINGS | ||
max_parallel_replicas = 2, | ||
cluster_for_parallel_replicas = 'test_cluster_one_shard_three_replicas_localhost', | ||
allow_experimental_parallel_reading_from_replicas = 1, | ||
parallel_replicas_for_non_replicated_merge_tree = 1, | ||
use_hedged_requests = 0, | ||
interactive_delay=0 | ||
"\ | ||
| ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&wait_end_of_query=1&query_id=${query_id_base}_interactive_0" --data-binary @- -vvv 2>&1 \ | ||
| grep "Summary" | grep -cv '"read_rows":"0"' | ||
|
||
echo " | ||
SELECT * | ||
FROM replicas_summary | ||
LIMIT 100 | ||
SETTINGS | ||
max_parallel_replicas = 2, | ||
cluster_for_parallel_replicas = 'test_cluster_one_shard_three_replicas_localhost', | ||
allow_experimental_parallel_reading_from_replicas = 1, | ||
parallel_replicas_for_non_replicated_merge_tree = 1, | ||
use_hedged_requests = 0, | ||
interactive_delay=99999999999 | ||
"\ | ||
| ${CLICKHOUSE_CURL} -sS "${CLICKHOUSE_URL}&wait_end_of_query=1&query_id=${query_id_base}_interactive_high" --data-binary @- -vvv 2>&1 \ | ||
| grep "Summary" | grep -cv '"read_rows":"0"' | ||
|
||
$CLICKHOUSE_CLIENT --query "SYSTEM FLUSH LOGS" | ||
involved_parallel_replicas "${query_id_base}" |