test 01167_isolation_hermitage uses fallback to recreate table

This commit is contained in:
Sema Checherinda 2022-10-20 16:11:24 +02:00
parent 06ac225425
commit e54ca534b0
2 changed files with 15 additions and 7 deletions

View File

@ -1566,7 +1566,7 @@ void StorageMergeTree::truncate(const ASTPtr &, const StorageMetadataPtr &, Cont
LOG_TEST(log, "Made {} empty parts in order to cover {} parts. Empty parts: {}, covered parts: {}. With txn {}",
future_parts.size(), parts.size(),
fmt::join(getPartsNames(future_parts), ", "), fmt::join(getPartsNames(parts), ", "),
fmt::join(getPartsNames(future_parts), ", "), fmt::join(getPartsNamesWithStates(parts), ", "),
transaction.getTID());
captureTmpDirectoryHolders(*this, future_parts);

View File

@ -14,23 +14,31 @@ set -e
# https://github.com/ept/hermitage
$CLICKHOUSE_CLIENT -q "drop table if exists test"
# Merges aren;t blocked, when they runs they left parts which are removed after old_parts_lifetime
# Test have to set old_parts_lifetime in low value in order to be able to wait deleting empty parts
$CLICKHOUSE_CLIENT -q "create table test (id int, value int) engine=MergeTree order by id SETTINGS old_parts_lifetime = 10"
function hard_reset_table()
{
# Merges aren;t blocked, when they runs they left parts which are removed after old_parts_lifetime
# Test have to set old_parts_lifetime in low value in order to be able to wait deleting empty parts
$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 = 5"
$CLICKHOUSE_CLIENT -q "insert into test (id, value) values (1, 10);"
$CLICKHOUSE_CLIENT -q "insert into test (id, value) values (2, 20);"
}
function reset_table()
{
$CLICKHOUSE_CLIENT -q "truncate table test;"
$CLICKHOUSE_CLIENT -q "insert into test (id, value) values (1, 10);"
$CLICKHOUSE_CLIENT -q "insert into test (id, value) values (2, 20);"
wait_for_delete_empty_parts "test" $CLICKHOUSE_DATABASE 60
# The is a chance that old parts are held by the oldest snapshot existed on a node
# In order not to wait too long (>60s) there is used a fallback to table recreation
wait_for_delete_empty_parts "test" $CLICKHOUSE_DATABASE 1>/dev/null 2>&1 || hard_reset_table
}
# TODO update test after implementing Read Committed
# G0
reset_table
hard_reset_table
tx 1 "begin transaction"
tx 2 "begin transaction"
tx 1 "alter table test update value=11 where id=1"