mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix system.data_skipping_indices for recreated indices
Fix secondary index size in system.data_skipping_indices table in the case of dropped and added again index.
This commit is contained in:
parent
97061f6806
commit
04d0b0c09a
@ -4858,17 +4858,18 @@ void MergeTreeData::removePartContributionToColumnAndSecondaryIndexSizes(const D
|
||||
log_subtract(total_column_size.marks, part_column_size.marks, ".marks");
|
||||
}
|
||||
|
||||
auto indexes_descriptions = getInMemoryMetadataPtr()->secondary_indices;
|
||||
for (const auto & index : indexes_descriptions)
|
||||
for (auto & [secondary_index_name, total_secondary_index_size] : secondary_index_sizes)
|
||||
{
|
||||
IndexSize & total_secondary_index_size = secondary_index_sizes[index.name];
|
||||
IndexSize part_secondary_index_size = part->getSecondaryIndexSize(index.name);
|
||||
if (!part->hasSecondaryIndex(secondary_index_name))
|
||||
continue;
|
||||
|
||||
IndexSize part_secondary_index_size = part->getSecondaryIndexSize(secondary_index_name);
|
||||
|
||||
auto log_subtract = [&](size_t & from, size_t value, const char * field)
|
||||
{
|
||||
if (value > from)
|
||||
LOG_ERROR(log, "Possibly incorrect index size subtraction: {} - {} = {}, index: {}, field: {}",
|
||||
from, value, from - value, index.name, field);
|
||||
from, value, from - value, secondary_index_name, field);
|
||||
|
||||
from -= value;
|
||||
};
|
||||
|
@ -1 +1,2 @@
|
||||
default test_table value_index minmax minmax value 1 38 12 24
|
||||
default test_table value_index minmax minmax value 1 38 12 24
|
||||
|
@ -12,4 +12,10 @@ ORDER BY key SETTINGS compress_marks=false;
|
||||
INSERT INTO test_table VALUES (0, 'Value');
|
||||
SELECT * FROM system.data_skipping_indices WHERE database = currentDatabase();
|
||||
|
||||
ALTER TABLE test_table DROP INDEX value_index;
|
||||
ALTER TABLE test_table ADD INDEX value_index value TYPE minmax GRANULARITY 1;
|
||||
ALTER TABLE test_table MATERIALIZE INDEX value_index SETTINGS mutations_sync=1;
|
||||
|
||||
SELECT * FROM system.data_skipping_indices WHERE database = currentDatabase();
|
||||
|
||||
DROP TABLE test_table;
|
||||
|
Loading…
Reference in New Issue
Block a user