Merge pull request #71977 from ClickHouse/fix_00098_primary_key_memory_allocated

Fix 00098_primary_key_memory_allocated
This commit is contained in:
Alexander Gololobov 2024-11-16 02:00:54 +00:00 committed by GitHub
commit 5ca9f2e570
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View File

@ -988,6 +988,8 @@ void IMergeTreeDataPart::loadIndex() const
"{}, read: {})", index_path, marks_count, loaded_index[i]->size());
}
LOG_TEST(storage.log, "Loaded primary key index for part {}, {} columns are kept in memory", name, key_size);
if (!index_file->eof())
throw Exception(ErrorCodes::EXPECTED_END_OF_FILE, "Index file {} is unexpectedly long", index_path);

View File

@ -1 +1,4 @@
SELECT primary_key_bytes_in_memory < 16000, primary_key_bytes_in_memory_allocated < 16000, primary_key_bytes_in_memory_allocated / primary_key_bytes_in_memory < 1.1 FROM system.parts WHERE database = 'test' AND table = 'hits';
-- Force PK load
SELECT CounterID FROM test.hits WHERE CounterID > 0 LIMIT 1 FORMAT Null;
-- Check PK size
SELECT primary_key_bytes_in_memory > 0, primary_key_bytes_in_memory < 16000, primary_key_bytes_in_memory_allocated < 16000, primary_key_bytes_in_memory_allocated / primary_key_bytes_in_memory < 1.1 FROM system.parts WHERE database = 'test' AND table = 'hits';