Respect projections in 01600_parts

This commit is contained in:
Nikolai Kochetov 2023-05-01 16:42:55 +00:00
parent 698c3d876b
commit 631e81c53f
3 changed files with 7 additions and 25 deletions

View File

@ -316,7 +316,7 @@ class IColumn;
M(Float, opentelemetry_start_trace_probability, 0., "Probability to start an OpenTelemetry trace for an incoming query.", 0) \
M(Bool, opentelemetry_trace_processors, false, "Collect OpenTelemetry spans for processors.", 0) \
M(Bool, prefer_column_name_to_alias, false, "Prefer using column names instead of aliases if possible.", 0) \
M(Bool, allow_experimental_analyzer, true, "Allow experimental analyzer", 0) \
M(Bool, allow_experimental_analyzer, false, "Allow experimental analyzer", 0) \
M(Bool, prefer_global_in_and_join, false, "If enabled, all IN/JOIN operators will be rewritten as GLOBAL IN/JOIN. It's useful when the to-be-joined tables are only available on the initiator and we need to always scatter their data on-the-fly during distributed processing with the GLOBAL keyword. It's also useful to reduce the need to access the external sources joining external tables.", 0) \
\
\

View File

@ -7,27 +7,18 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# NOTE: database = $CLICKHOUSE_DATABASE is unwanted
verify_sql="SELECT
(SELECT sumIf(value, metric = 'PartsActive'), sumIf(value, metric = 'PartsOutdated') FROM system.metrics)
= (SELECT sum(active), sum(NOT active) FROM system.parts)"
= (SELECT sum(active), sum(NOT active) FROM
(SELECT active FROM system.parts UNION ALL SELECT active FROM system.projection_parts))"
# The query is not atomic - it can compare states between system.parts and system.metrics from different points in time.
# So, there is inherent race condition. But it should get expected result eventually.
# In case of test failure, this code will do infinite loop and timeout.
verify()
{
for i in $(seq 1 3001)
while true
do
result=$( $CLICKHOUSE_CLIENT -m --query="$verify_sql" )
[ "$result" = "1" ] && break
if [ "$i" = "3000" ]; then
echo "======="
$CLICKHOUSE_CLIENT --query="SELECT * FROM system.parts format TSVWithNames"
echo "======="
$CLICKHOUSE_CLIENT --query="SELECT * FROM system.metrics format TSVWithNames"
echo "======="
return
fi
sleep 0.1
done
echo 1

View File

@ -11,7 +11,8 @@ set -o pipefail
# NOTE: database = $CLICKHOUSE_DATABASE is unwanted
verify_sql="SELECT
(SELECT sumIf(value, metric = 'PartsInMemory'), sumIf(value, metric = 'PartsCompact'), sumIf(value, metric = 'PartsWide') FROM system.metrics) =
(SELECT countIf(part_type == 'InMemory'), countIf(part_type == 'Compact'), countIf(part_type == 'Wide') FROM system.parts)"
(SELECT countIf(part_type == 'InMemory'), countIf(part_type == 'Compact'), countIf(part_type == 'Wide')
FROM (SELECT part_type FROM system.parts UNION ALL SELECT part_type FROM system.projection_parts))"
# The query is not atomic - it can compare states between system.parts and system.metrics from different points in time.
# So, there is inherent race condition (especially in fasttest that runs tests in parallel).
@ -20,22 +21,12 @@ verify_sql="SELECT
# In case of test failure, this code will do infinite loop and timeout.
verify()
{
for i in $(seq 1 3001); do
while true; do
result=$( $CLICKHOUSE_CLIENT -m --query="$verify_sql" )
if [ "$result" = "1" ]; then
echo 1
return
fi
if [ "$i" = "3000" ]; then
echo "======="
$CLICKHOUSE_CLIENT --query="SELECT * FROM system.parts format TSVWithNames"
echo "======="
$CLICKHOUSE_CLIENT --query="SELECT * FROM system.metrics format TSVWithNames"
echo "======="
return
fi
sleep 0.1
done
}