More correct version

This commit is contained in:
alesapin 2019-06-19 14:59:08 +03:00
parent d1de7431e1
commit f0c273ee4c
3 changed files with 7 additions and 9 deletions

View File

@ -138,7 +138,7 @@ MergeTreeDataPart::MergeTreeDataPart(MergeTreeData & storage_, const String & na
: storage(storage_) : storage(storage_)
, name(name_) , name(name_)
, info(MergeTreePartInfo::fromPartName(name_, storage.format_version)) , info(MergeTreePartInfo::fromPartName(name_, storage.format_version))
, index_granularity_info(storage.settings, storage.format_version) , index_granularity_info(storage.settings)
{ {
} }
@ -146,7 +146,7 @@ MergeTreeDataPart::MergeTreeDataPart(const MergeTreeData & storage_, const Strin
: storage(storage_) : storage(storage_)
, name(name_) , name(name_)
, info(info_) , info(info_)
, index_granularity_info(storage.settings, storage.format_version) , index_granularity_info(storage.settings)
{ {
} }

View File

@ -22,12 +22,11 @@ std::optional<std::string> MergeTreeIndexGranularityInfo::getMrkExtensionFromFS(
} }
MergeTreeIndexGranularityInfo::MergeTreeIndexGranularityInfo( MergeTreeIndexGranularityInfo::MergeTreeIndexGranularityInfo(
const MergeTreeSettings & storage_settings, const MergeTreeSettings & storage_settings)
const MergeTreeDataFormatVersion & format)
{ {
fixed_index_granularity = storage_settings.index_granularity; fixed_index_granularity = storage_settings.index_granularity;
/// Granularity is fixed /// Granularity is fixed
if (storage_settings.index_granularity_bytes == 0 || format < MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING) if (storage_settings.index_granularity_bytes == 0)
setNonAdaptive(); setNonAdaptive();
else else
setAdaptive(storage_settings.index_granularity_bytes); setAdaptive(storage_settings.index_granularity_bytes);
@ -43,7 +42,7 @@ void MergeTreeIndexGranularityInfo::changeGranularityIfRequired(const std::strin
void MergeTreeIndexGranularityInfo::setAdaptive(size_t index_granularity_bytes_) void MergeTreeIndexGranularityInfo::setAdaptive(size_t index_granularity_bytes_)
{ {
is_adaptive = false; is_adaptive = true;
mark_size_in_bytes = getAdaptiveMrkSize(); mark_size_in_bytes = getAdaptiveMrkSize();
marks_file_extension = getAdaptiveMrkExtension(); marks_file_extension = getAdaptiveMrkExtension();
index_granularity_bytes = index_granularity_bytes_; index_granularity_bytes = index_granularity_bytes_;
@ -51,7 +50,7 @@ void MergeTreeIndexGranularityInfo::setAdaptive(size_t index_granularity_bytes_)
void MergeTreeIndexGranularityInfo::setNonAdaptive() void MergeTreeIndexGranularityInfo::setNonAdaptive()
{ {
is_adaptive = true; is_adaptive = false;
mark_size_in_bytes = getNonAdaptiveMrkSize(); mark_size_in_bytes = getNonAdaptiveMrkSize();
marks_file_extension = getNonAdaptiveMrkExtension(); marks_file_extension = getNonAdaptiveMrkExtension();
index_granularity_bytes = 0; index_granularity_bytes = 0;

View File

@ -27,8 +27,7 @@ public:
size_t index_granularity_bytes; size_t index_granularity_bytes;
MergeTreeIndexGranularityInfo( MergeTreeIndexGranularityInfo(
const MergeTreeSettings & storage_settings, const MergeTreeSettings & storage_settings);
const MergeTreeDataFormatVersion & format);
void changeGranularityIfRequired(const std::string & path_to_part); void changeGranularityIfRequired(const std::string & path_to_part);