From 9d5b2023e80adef8b82dc8c6ec31b1d6d5c559e4 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 3 Jan 2021 19:12:22 +0300 Subject: [PATCH] Fix tests --- src/Common/FileChecker.cpp | 2 -- src/Storages/StorageTinyLog.cpp | 7 ++++--- tests/queries/0_stateless/01383_log_broken_table.sh | 8 ++++---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Common/FileChecker.cpp b/src/Common/FileChecker.cpp index 1092b50b741..b306c3af990 100644 --- a/src/Common/FileChecker.cpp +++ b/src/Common/FileChecker.cpp @@ -82,8 +82,6 @@ CheckResults FileChecker::check() const void FileChecker::repair() { - initialize(); - for (const auto & name_size : map) { const String & name = name_size.first; diff --git a/src/Storages/StorageTinyLog.cpp b/src/Storages/StorageTinyLog.cpp index a7ac592ac04..4f3dcec4ddc 100644 --- a/src/Storages/StorageTinyLog.cpp +++ b/src/Storages/StorageTinyLog.cpp @@ -205,6 +205,7 @@ public: if (!done) { /// Rollback partial writes. + LOG_WARNING(storage.log, "Rollback partial writes"); streams.clear(); storage.file_checker.repair(); } @@ -326,12 +327,12 @@ void TinyLogBlockOutputStream::writeSuffix() for (auto & pair : streams) column_files.push_back(storage.files[pair.first].data_file_path); + streams.clear(); + done = true; + for (const auto & file : column_files) storage.file_checker.update(file); storage.file_checker.save(); - - streams.clear(); - done = true; } diff --git a/tests/queries/0_stateless/01383_log_broken_table.sh b/tests/queries/0_stateless/01383_log_broken_table.sh index 37cd6e239e5..5cc0f24a87f 100755 --- a/tests/queries/0_stateless/01383_log_broken_table.sh +++ b/tests/queries/0_stateless/01383_log_broken_table.sh @@ -25,7 +25,7 @@ function test_func() $CLICKHOUSE_CLIENT --query "SELECT count(), sum(x + y + z) FROM log" > "${CLICKHOUSE_TMP}"/select_result 2>&1; - grep -o -F 'File not found' "${CLICKHOUSE_TMP}"/select_result || cat "${CLICKHOUSE_TMP}"/select_result + cat "${CLICKHOUSE_TMP}"/select_result [[ $MAX_MEM -gt 200000000 ]] && break; done @@ -33,9 +33,9 @@ function test_func() $CLICKHOUSE_CLIENT --query "DROP TABLE log"; } -test_func TinyLog | grep -v -P '^(Memory limit|0\t0|File not found|[1-9]000000\t)' -test_func StripeLog | grep -v -P '^(Memory limit|0\t0|File not found|[1-9]000000\t)' -test_func Log | grep -v -P '^(Memory limit|0\t0|File not found|[1-9]000000\t)' +test_func TinyLog | grep -v -P '^(Memory limit|0\t0|[1-9]000000\t)' +test_func StripeLog | grep -v -P '^(Memory limit|0\t0|[1-9]000000\t)' +test_func Log | grep -v -P '^(Memory limit|0\t0|[1-9]000000\t)' rm "${CLICKHOUSE_TMP}/insert_result" rm "${CLICKHOUSE_TMP}/select_result"