From 156ba8a7fc25575fdf612a973cc9e8d6b90d2a39 Mon Sep 17 00:00:00 2001 From: alesapin Date: Mon, 5 Apr 2021 12:16:38 +0300 Subject: [PATCH] Disable setting by default and ban for old-syntax MergeTree --- src/Storages/MergeTree/MergeTreeSettings.h | 2 +- src/Storages/StorageMergeTree.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Storages/MergeTree/MergeTreeSettings.h b/src/Storages/MergeTree/MergeTreeSettings.h index aee25ee21a0..06d909eb912 100644 --- a/src/Storages/MergeTree/MergeTreeSettings.h +++ b/src/Storages/MergeTree/MergeTreeSettings.h @@ -54,7 +54,7 @@ struct Settings; M(UInt64, write_ahead_log_bytes_to_fsync, 100ULL * 1024 * 1024, "Amount of bytes, accumulated in WAL to do fsync.", 0) \ M(UInt64, write_ahead_log_interval_ms_to_fsync, 100, "Interval in milliseconds after which fsync for WAL is being done.", 0) \ M(Bool, in_memory_parts_insert_sync, false, "If true insert of part with in-memory format will wait for fsync of WAL", 0) \ - M(UInt64, non_replicated_deduplication_window, 100, "How many last blocks of hashes should be kept on disk (0 - disabled).", 0) \ + M(UInt64, non_replicated_deduplication_window, 0, "How many last blocks of hashes should be kept on disk (0 - disabled).", 0) \ \ /** Inserts settings. */ \ M(UInt64, parts_to_delay_insert, 150, "If table contains at least that many active parts in single partition, artificially slow down insert into table.", 0) \ diff --git a/src/Storages/StorageMergeTree.cpp b/src/Storages/StorageMergeTree.cpp index 5e192f76bc9..5f8032d7749 100644 --- a/src/Storages/StorageMergeTree.cpp +++ b/src/Storages/StorageMergeTree.cpp @@ -97,6 +97,9 @@ StorageMergeTree::StorageMergeTree( auto settings = getSettings(); if (settings->non_replicated_deduplication_window != 0) { + if (format_version < MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING) + throw Exception("Deduplication for non-replicated MergeTree in old syntax is not supported", ErrorCodes::BAD_ARGUMENTS); + std::string path = getDataPaths()[0] + "/deduplication_logs"; deduplication_log = std::make_unique(path, settings->non_replicated_deduplication_window, format_version); deduplication_log->load();