Skip to content
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

suppressing test inaccuracy 00738_lock_for_inner_table #46287

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 23 additions & 7 deletions tests/queries/0_stateless/00738_lock_for_inner_table.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Tags: no-ordinary-database
# Tags: no-ordinary-database, no-fasttest

set -e

Expand All @@ -19,7 +19,7 @@ CREATE MATERIALIZED VIEW mv UUID '$uuid' ENGINE = Log AS SELECT sleepEachRow(0.0

${CLICKHOUSE_CLIENT} --query_id insert_$CLICKHOUSE_DATABASE --query "INSERT INTO tab_00738 SELECT number FROM numbers(10000000)" &

function drop()
function drop_inner_id()
{
${CLICKHOUSE_CLIENT} --query "DROP TABLE \`.inner_id.$uuid\`" -n
}
Expand All @@ -35,16 +35,32 @@ function wait_for_query_to_start()

# query already finished, fail
if [[ $(${CLICKHOUSE_CLIENT} --query "SELECT count() FROM system.processes WHERE query_id = 'insert_$CLICKHOUSE_DATABASE'") == 0 ]]; then
exit 2
return 2
fi
}

function drop_at_exit()
{
echo "DROP TABLE IF EXISTS tab_00738;
DROP TABLE IF EXISTS mv;" | ${CLICKHOUSE_CLIENT} -n
}

ret_code=0
export -f wait_for_query_to_start
timeout 5 bash -c wait_for_query_to_start
timeout 15 bash -c wait_for_query_to_start || ret_code=$?

drop &
if [[ $ret_code == 124 ]] || [[ $ret_code == 2 ]]; then
# suppressing test inaccuracy
# $ret_code == 124 -- wait_for_query_to_start didn't catch the insert command in running state
# $ret_code == 2 -- wait_for_query_to_start caught the insert command running but command ended too fast
wait
drop_at_exit
exit 0
fi

drop_inner_id

wait

echo "DROP TABLE IF EXISTS tab_00738;
DROP TABLE IF EXISTS mv;" | ${CLICKHOUSE_CLIENT} -n
drop_at_exit