From c8c4db5984bf9101478e0d1f33c3432c257ea7a0 Mon Sep 17 00:00:00 2001 From: kssenii Date: Mon, 11 Dec 2023 13:24:31 +0100 Subject: [PATCH] Fxi test --- src/Storages/MergeTree/IMergeTreeDataPart.cpp | 7 +++++++ .../queries/0_stateless/02916_broken_projection.reference | 7 ++++--- tests/queries/0_stateless/02916_broken_projection.sh | 4 +++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Storages/MergeTree/IMergeTreeDataPart.cpp b/src/Storages/MergeTree/IMergeTreeDataPart.cpp index 5418bcd83f3..7af49edf788 100644 --- a/src/Storages/MergeTree/IMergeTreeDataPart.cpp +++ b/src/Storages/MergeTree/IMergeTreeDataPart.cpp @@ -780,6 +780,13 @@ void IMergeTreeDataPart::loadProjections(bool require_columns_checksums, bool ch addProjectionPart(projection.name, std::move(part)); } } + else if (checksums.has(path)) + { + auto part = getProjectionPartBuilder(projection.name).withPartFormatFromDisk().build(); + part->setBrokenReason("Projection directory " + path + " does not exist while loading projections", ErrorCodes::NO_FILE_IN_DATA_PART); + addProjectionPart(projection.name, std::move(part)); + has_broken_projection = true; + } } } diff --git a/tests/queries/0_stateless/02916_broken_projection.reference b/tests/queries/0_stateless/02916_broken_projection.reference index b7764a6434e..358304de74a 100644 --- a/tests/queries/0_stateless/02916_broken_projection.reference +++ b/tests/queries/0_stateless/02916_broken_projection.reference @@ -406,7 +406,7 @@ SELECT d FROM test WHERE c == 12 OR c == 16 ORDER BY d; proj_2 check table 1 0 -broke all data of part 'proj' (parent part: all_2_2_0) +broke all data of part 'proj' (parent part: all_1_1_0) system.parts all_0_0_0 1 ['proj','proj_2'] all_1_1_0 1 ['proj','proj_2'] @@ -421,13 +421,13 @@ SELECT d FROM test WHERE c == 12 OR c == 16 ORDER BY d; proj_2 check table 0 broken projections info -all_2_2_0 proj FILE_DOESNT_EXIST +all_1_1_0 proj FILE_DOESNT_EXIST BACKUP_CREATED RESTORED system.parts all_0_0_0 1 ['proj','proj_2'] all_1_1_0 1 ['proj','proj_2'] -all_2_2_0 1 ['proj_2'] +all_2_2_0 1 ['proj','proj_2'] all_3_3_0 1 ['proj','proj_2'] select from projection 'proj' 12 @@ -442,3 +442,4 @@ SELECT d FROM test WHERE c == 12 OR c == 16 ORDER BY d; proj_2 check table 0 broken projections info +all_1_1_0 proj NO_FILE_IN_DATA_PART diff --git a/tests/queries/0_stateless/02916_broken_projection.sh b/tests/queries/0_stateless/02916_broken_projection.sh index 0910ba177fb..eb68f8621a2 100755 --- a/tests/queries/0_stateless/02916_broken_projection.sh +++ b/tests/queries/0_stateless/02916_broken_projection.sh @@ -410,6 +410,8 @@ function test2() check test2 } +CLICKHOUSE_DATABASE="default" +CLICKHOUSE_TEST_UNIQUE_NAME="test123456" function test3() { create_table test3 test 1 @@ -473,7 +475,7 @@ function test3() check test - break_projection test proj all_2_2_0 part + break_projection test proj all_1_1_0 part check test proj FILE_DOESNT_EXIST