Fix 02263_format_insert_settings flakiness

I guess the problem was with the async nature of the process
substitution ("2> >(cmd)"), let's avoid using this feature of bash.

CI: https://s3.amazonaws.com/clickhouse-test-reports/52683/b98cb7fa145d1a92c2c78421be1eeb8fe8353d53/stateless_tests__aarch64_.html
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
Co-authored-by: Alexey Milovidov <milovidov@clickhouse.com>

Update 02263_format_insert_settings.sh
This commit is contained in:
Azat Khuzhin 2023-08-05 13:47:57 +02:00
parent c3c4125328
commit 708fd914bc
2 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
insert into foo settings max_threads=1 [multi] insert into foo settings max_threads=1
Syntax error (query): failed at position 40 (end of query): Syntax error (query): failed at position 40 (end of query):
insert into foo format tsv settings max_threads=1 [multi] insert into foo format tsv settings max_threads=1
Can't format ASTInsertQuery with data, since data will be lost. Can't format ASTInsertQuery with data, since data will be lost.
[multi] insert into foo format tsv settings max_threads=1 [multi] insert into foo format tsv settings max_threads=1
INSERT INTO foo INSERT INTO foo
@ -8,7 +8,7 @@ SETTINGS max_threads = 1
FORMAT tsv FORMAT tsv
[oneline] insert into foo format tsv settings max_threads=1 [oneline] insert into foo format tsv settings max_threads=1
INSERT INTO foo SETTINGS max_threads = 1 FORMAT tsv INSERT INTO foo SETTINGS max_threads = 1 FORMAT tsv
insert into foo settings max_threads=1 format tsv settings max_threads=1 [multi] insert into foo settings max_threads=1 format tsv settings max_threads=1
You have SETTINGS before and after FORMAT You have SETTINGS before and after FORMAT
Cannot parse input: expected '\n' before: 'settings max_threads=1 1' Cannot parse input: expected '\n' before: 'settings max_threads=1 1'
1 1

View File

@ -8,7 +8,7 @@ function run_format()
{ {
local q="$1" && shift local q="$1" && shift
echo "$q" echo "[multi] $q"
$CLICKHOUSE_FORMAT "$@" <<<"$q" $CLICKHOUSE_FORMAT "$@" <<<"$q"
} }
function run_format_both() function run_format_both()
@ -22,20 +22,20 @@ function run_format_both()
} }
# NOTE: that those queries may work slow, due to stack trace obtaining # NOTE: that those queries may work slow, due to stack trace obtaining
run_format 'insert into foo settings max_threads=1' 2> >(grep -m1 -o "Syntax error (query): failed at position .* (end of query):") run_format 'insert into foo settings max_threads=1' |& grep --max-count 2 --only-matching -e "Syntax error (query): failed at position .* (end of query):" -e '^\[.*$'
# compatibility # compatibility
run_format 'insert into foo format tsv settings max_threads=1' 2> >(grep -m1 -F -o "Can't format ASTInsertQuery with data, since data will be lost.") run_format 'insert into foo format tsv settings max_threads=1' |& grep --max-count 2 --only-matching -e "Can't format ASTInsertQuery with data, since data will be lost." -e '^\[.*$'
run_format_both 'insert into foo format tsv settings max_threads=1' --allow_settings_after_format_in_insert run_format_both 'insert into foo format tsv settings max_threads=1' --allow_settings_after_format_in_insert
run_format 'insert into foo settings max_threads=1 format tsv settings max_threads=1' --allow_settings_after_format_in_insert 2> >(grep -m1 -F -o "You have SETTINGS before and after FORMAT") run_format 'insert into foo settings max_threads=1 format tsv settings max_threads=1' --allow_settings_after_format_in_insert |& grep --max-count 2 --only-matching -e "You have SETTINGS before and after FORMAT" -e '^\[.*$'
# and via server (since this is a separate code path) # and via server (since this is a separate code path)
$CLICKHOUSE_CLIENT -q 'drop table if exists data_02263' $CLICKHOUSE_CLIENT -q 'drop table if exists data_02263'
$CLICKHOUSE_CLIENT -q 'create table data_02263 (key Int) engine=Memory()' $CLICKHOUSE_CLIENT -q 'create table data_02263 (key Int) engine=Memory()'
$CLICKHOUSE_CLIENT -q 'insert into data_02263 format TSV settings max_threads=1 1' 2> >(grep -m1 -F -o "Cannot parse input: expected '\n' before: 'settings max_threads=1 1'") $CLICKHOUSE_CLIENT -q 'insert into data_02263 format TSV settings max_threads=1 1' |& grep --max-count 1 -F --only-matching "Cannot parse input: expected '\n' before: 'settings max_threads=1 1'"
$CLICKHOUSE_CLIENT --allow_settings_after_format_in_insert=1 -q 'insert into data_02263 format TSV settings max_threads=1 1' $CLICKHOUSE_CLIENT --allow_settings_after_format_in_insert=1 -q 'insert into data_02263 format TSV settings max_threads=1 1'
$CLICKHOUSE_CLIENT -q 'select * from data_02263' $CLICKHOUSE_CLIENT -q 'select * from data_02263'
$CLICKHOUSE_CLIENT --allow_settings_after_format_in_insert=1 -q 'insert into data_02263 settings max_threads=1 format tsv settings max_threads=1' 2> >(grep -m1 -F -o "You have SETTINGS before and after FORMAT") $CLICKHOUSE_CLIENT --allow_settings_after_format_in_insert=1 -q 'insert into data_02263 settings max_threads=1 format tsv settings max_threads=1' |& grep --max-count 1 -F --only-matching "You have SETTINGS before and after FORMAT"
$CLICKHOUSE_CLIENT -q 'drop table data_02263' $CLICKHOUSE_CLIENT -q 'drop table data_02263'
run_format_both 'insert into foo values' run_format_both 'insert into foo values'