fix and stable some tests

This commit is contained in:
Sema Checherinda 2022-09-23 23:54:28 +02:00
parent c1e6b560f0
commit 29bfe6b78e
4 changed files with 57 additions and 35 deletions

View File

@ -15,12 +15,11 @@ set -e
# https://github.com/ept/hermitage
$CLICKHOUSE_CLIENT -q "drop table if exists test"
$CLICKHOUSE_CLIENT -q "create table test (id int, value int) engine=MergeTree order by id SETTINGS old_parts_lifetime=1"
$CLICKHOUSE_CLIENT -q "create table test (id int, value int) engine=MergeTree order by id"
function reset_table()
{
$CLICKHOUSE_CLIENT -q "truncate table test;"
wait_for_delete_empty_parts "test"
$CLICKHOUSE_CLIENT -q "insert into test (id, value) values (1, 10);"
$CLICKHOUSE_CLIENT -q "insert into test (id, value) values (2, 20);"
}
@ -84,6 +83,7 @@ $CLICKHOUSE_CLIENT -q "select 10, * from test order by id"
# OTV
reset_table
wait_for_delete_empty_parts "test" $CLICKHOUSE_DATABASE 60
tx 9 "begin transaction"
tx 10 "begin transaction"
tx 11 "begin transaction"

View File

@ -12,19 +12,19 @@ all_3_3_0 data Tuple(k1 Nested(k2 String, k3 Nested(k4 String)))
1 a 42
2 b 4200
4242
all_1_3_3 data Tuple(_dummy UInt8)
all_1_2_3 data Tuple(_dummy UInt8)
all_4_4_0 data Tuple(name String, value Int16)
1 a 42
2 b 4200
3 a 42.123
all_1_3_3 data Tuple(_dummy UInt8)
all_1_2_3 data Tuple(_dummy UInt8)
all_4_4_0 data Tuple(name String, value Int16)
all_5_5_0 data Tuple(name String, value Float64)
1 a 42
2 b 4200
3 a 42.123
4 a some
all_1_3_3 data Tuple(_dummy UInt8)
all_1_2_3 data Tuple(_dummy UInt8)
all_4_4_0 data Tuple(name String, value Int16)
all_5_5_0 data Tuple(name String, value Float64)
all_6_6_0 data Tuple(name String, value String)

View File

@ -1,6 +1,9 @@
concurrent_insert
2
all_1_4_1 0
all_1_1_1 0
all_2_2_1 0
all_3_3_1 0
all_4_4_1 0
all_5_5_0 1
all_6_6_1 0
concurrent_drop_part_before
@ -14,11 +17,21 @@ all_3_3_0 1
concurrent_drop_part_after
NO_SUCH_DATA_PART
INVALID_TRANSACTION
all_1_3_1 0
all_1_1_1 0
all_2_2_1 0
all_3_3_1 0
NewPart all_1_1_0
NewPart all_1_3_1
NewPart all_1_1_1
NewPart all_2_2_0
NewPart all_2_2_1
NewPart all_3_3_0
NewPart all_3_3_1
read_from_snapshot
tx61 3
tx61 3
tx62 0
tx61 3
0
concurrent_delete
tx41 41 3
tx41 41 3
@ -32,9 +45,3 @@ tx51 3
tx52 1
tx51 3
0
read_from_snapshot
tx61 3
tx61 3
tx62 0
tx61 3
0

View File

@ -16,6 +16,9 @@ function reset_table()
$CLICKHOUSE_CLIENT -q "drop table if exists $table"
$CLICKHOUSE_CLIENT -q "create table $table (n int) engine=MergeTree order by tuple()"
# In order to preserve parts names merges have to be disabled
$CLICKHOUSE_CLIENT -q "system stop merges $table"
$CLICKHOUSE_CLIENT -q "insert into $table values (1)" # inserts all_1_1_0
$CLICKHOUSE_CLIENT -q "insert into $table values (2)" # inserts all_2_2_0
$CLICKHOUSE_CLIENT -q "insert into $table values (3)" # inserts all_3_3_0
@ -90,12 +93,39 @@ function concurrent_drop_part_after()
concurrent_drop_part_after
function read_from_snapshot()
{
echo "read_from_snapshot"
reset_table
tx 61 "begin transaction"
tx 61 "select count() from tt"
tx 62 "begin transaction"
tx 62 "truncate table tt"
tx 61 "select count() from tt"
tx 62 "select count() from tt"
tx 62 "commit"
tx 61 "select count() from tt"
tx 61 "commit"
$CLICKHOUSE_CLIENT -q "select count() from tt"
}
read_from_snapshot
function concurrent_delete()
{
echo "concurrent_delete"
reset_table
# test runs mutation, merges have to be enabled
$CLICKHOUSE_CLIENT -q "system start merges $table"
# make parts name predictable
$CLICKHOUSE_CLIENT -q "optimize table $table final"
tx 41 "begin transaction"
tx 41 "select 41, count() from tt"
tx 42 "begin transaction"
@ -118,6 +148,12 @@ function concurrent_delete_rollback()
reset_table
# test runs mutation, merges have to be enabled
$CLICKHOUSE_CLIENT -q "system start merges $table"
# make parts name predictable
$CLICKHOUSE_CLIENT -q "optimize table $table final"
tx 51 "begin transaction"
tx 51 "select count() from tt"
tx 52 "begin transaction"
@ -133,24 +169,3 @@ function concurrent_delete_rollback()
}
concurrent_delete_rollback
function read_from_snapshot()
{
echo "read_from_snapshot"
reset_table
tx 61 "begin transaction"
tx 61 "select count() from tt"
tx 62 "begin transaction"
tx 62 "truncate table tt"
tx 61 "select count() from tt"
tx 62 "select count() from tt"
tx 62 "commit"
tx 61 "select count() from tt"
tx 61 "commit"
$CLICKHOUSE_CLIENT -q "select count() from tt"
}
read_from_snapshot