From c81cb9e5632698d9bca5646f31093ea398fc8ea1 Mon Sep 17 00:00:00 2001 From: alesapin Date: Tue, 19 Apr 2022 01:12:07 +0200 Subject: [PATCH] Better --- src/Storages/StorageReplicatedMergeTree.cpp | 3 ++- tests/queries/0_stateless/02067_lost_part_s3.sql | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Storages/StorageReplicatedMergeTree.cpp b/src/Storages/StorageReplicatedMergeTree.cpp index 4403fd2617f..f4df673a483 100644 --- a/src/Storages/StorageReplicatedMergeTree.cpp +++ b/src/Storages/StorageReplicatedMergeTree.cpp @@ -7412,7 +7412,8 @@ std::pair StorageReplicatedMergeTree::unlockSharedDataByID( { files_not_to_remove.clear(); auto files_not_to_remove_str = zookeeper_ptr->get(zc_zookeeper_path); - boost::split(files_not_to_remove, files_not_to_remove_str, boost::is_any_of("\n ")); + if (!files_not_to_remove_str.empty()) + boost::split(files_not_to_remove, files_not_to_remove_str, boost::is_any_of("\n ")); String zookeeper_part_uniq_node = fs::path(zc_zookeeper_path) / part_id; diff --git a/tests/queries/0_stateless/02067_lost_part_s3.sql b/tests/queries/0_stateless/02067_lost_part_s3.sql index f3f529a7052..ac02318c261 100644 --- a/tests/queries/0_stateless/02067_lost_part_s3.sql +++ b/tests/queries/0_stateless/02067_lost_part_s3.sql @@ -1,6 +1,6 @@ -drop table if exists partslost_0; -drop table if exists partslost_1; -drop table if exists partslost_2; +DROP TABLE IF EXISTS partslost_0; +DROP TABLE IF EXISTS partslost_1; +DROP TABLE IF EXISTS partslost_2; CREATE TABLE partslost_0 (x String) ENGINE=ReplicatedMergeTree('/clickhouse/table/partslost/0', '0') ORDER BY tuple() SETTINGS min_rows_for_wide_part = 0, min_bytes_for_wide_part = 0, old_parts_lifetime = 1, cleanup_delay_period = 1, cleanup_delay_period_random_add = 1; @@ -12,8 +12,11 @@ CREATE TABLE partslost_2 (x String) ENGINE=ReplicatedMergeTree('/clickhouse/tabl INSERT INTO partslost_0 SELECT toString(number) AS x from system.numbers LIMIT 10000; ALTER TABLE partslost_0 ADD INDEX idx x TYPE tokenbf_v1(285000, 3, 12345) GRANULARITY 3; + ALTER TABLE partslost_0 MATERIALIZE INDEX idx; +-- FIXME +select sleep(3) FORMAT Null; select sleep(3) FORMAT Null; select sleep(3) FORMAT Null; select sleep(3) FORMAT Null; @@ -24,3 +27,7 @@ ALTER TABLE partslost_0 DROP INDEX idx; select count() from partslost_0; select count() from partslost_1; select count() from partslost_2; + +DROP TABLE IF EXISTS partslost_0; +DROP TABLE IF EXISTS partslost_1; +DROP TABLE IF EXISTS partslost_2;