90.62% (319/352) Uncovered changed code (with context): ================================================================================ programs/server/Server.cpp ================================================================================ --- uncovered block 2041-2042 --- 2039 | if (unique_key_index_cache_size > max_cache_size) 2040 | { >> 2041 | unique_key_index_cache_size = max_cache_size; >> 2042 | LOG_INFO(log, "Lowered UNIQUE KEY index cache size to {} because the system has limited RAM", formatReadableSizeWithBinarySuffix(unique_key_index_cache_size)); 2043 | } 2044 | global_context->setUniqueKeyIndexCache(unique_key_index_cache_policy_name, unique_key_index_cache_size, unique_key_index_cache_size_ratio); ================================================================================ src/Interpreters/Context.cpp ================================================================================ --- uncovered block 3992-3992 --- 3990 | #if USE_ROCKSDB 3991 | if (max_cache_size_in_bytes == 0) >> 3992 | return; /// Explicit opt-out — callers get nullptr from getUniqueKeyIndexCache. 3993 | 3994 | shared->unique_key_index_cache = std::make_shared( --- uncovered block 4014-4014 --- 4012 | 4013 | if (!shared->unique_key_index_cache) >> 4014 | return; /// Cache disabled at startup — nothing to update. 4015 | 4016 | #if USE_ROCKSDB --- uncovered block 4020-4021 --- 4018 | if (size > max_cache_size) 4019 | { >> 4020 | size = max_cache_size; >> 4021 | LOG_DEBUG(shared->log, "Lowered UNIQUE KEY index cache size to {} because the system has limited RAM", formatReadableSizeWithBinarySuffix(size)); 4022 | } 4023 | const size_t before = shared->unique_key_index_cache->GetCapacity(); --- uncovered block 4036-4037 --- 4034 | UniqueKeyIndexCachePtr Context::getUniqueKeyIndexCache() const 4035 | { >> 4036 | SharedLockGuard lock(shared->mutex); >> 4037 | return shared->unique_key_index_cache; 4038 | } 4039 | --- uncovered block 4042-4046 --- 4040 | void Context::clearUniqueKeyIndexCache() const 4041 | { >> 4042 | #if USE_ROCKSDB >> 4043 | UniqueKeyIndexCachePtr cache = getUniqueKeyIndexCache(); >> 4044 | if (cache) >> 4045 | cache->clear(); >> 4046 | #endif 4047 | } 4048 | ================================================================================ src/Storages/MergeTree/UniqueKey/UniqueKeyIndexCache.cpp ================================================================================ --- uncovered block 109-111 --- 107 | if (strict_capacity_limit.load(std::memory_order_relaxed)) 108 | { >> 109 | const size_t max = backing->maxSizeInBytes(); >> 110 | if (max != 0 && charge > max) >> 111 | return ROCKSDB_NAMESPACE::Status::MemoryLimit(); 112 | } 113 | --- uncovered block 207-207 --- 205 | { 206 | if (!handle) >> 207 | return false; 208 | asPin(handle)->refs.fetch_add(1, std::memory_order_relaxed); 209 | return true; --- uncovered block 215-215 --- 213 | { 214 | if (!handle) >> 215 | return false; 216 | auto * pin = asPin(handle); 217 | /// fetch_sub returns the old value; we're the last ref when it returns 1. --- uncovered block 275-275 --- 273 | uint64_t UniqueKeyIndexCache::NewId() 274 | { >> 275 | return next_id.fetch_add(1, std::memory_order_relaxed); 276 | } 277 | --- uncovered block 280-280 --- 278 | void UniqueKeyIndexCache::SetCapacity(size_t capacity) 279 | { >> 280 | backing->setMaxSizeInBytes(capacity); 281 | } 282 | --- uncovered block 301-301 --- 299 | { 300 | if (!handle) >> 301 | return 0; 302 | const auto * pin = asPin(handle); 303 | /// Uncharged standalone (key==0 && charge==0): return 0 to match --- uncovered block 308-308 --- 306 | if (pin->key == UInt128{} && pin->entry->charge == 0) 307 | return 0; >> 308 | return pin->entry->charge + UniqueKeyIndexCacheEntryWeight::OVERHEAD; 309 | } 310 | --- uncovered block 324-324 --- 322 | UniqueKeyIndexCache::GetCacheItemHelper(Handle * handle) const 323 | { >> 324 | return handle ? asPin(handle)->entry->helper : nullptr; 325 | } 326 | --- uncovered block 343-345 --- 341 | const std::function & callback) 342 | { >> 343 | if (!handle) >> 344 | return; >> 345 | const auto * pin = asPin(handle); 346 | /// Key is unknown post-hashing; pass an empty Slice to keep the callback 347 | /// signature satisfied. Callers of ApplyToHandle in BlockBasedTable use the --- uncovered block 349-351 --- 347 | /// signature satisfied. Callers of ApplyToHandle in BlockBasedTable use the 348 | /// callback for reporting, not routing, so an empty key is tolerated. >> 349 | ROCKSDB_NAMESPACE::Slice empty_key; >> 350 | callback(empty_key, pin->entry->obj, pin->entry->charge, >> 351 | pin->entry->helper); 352 | } 353 | --- uncovered block 366-366 --- 364 | void UniqueKeyIndexCache::clear() 365 | { >> 366 | backing->clear(); 367 | } 368 | ================================================================================ src/Storages/MergeTree/UniqueKey/UniqueKeyIndexCache.h ================================================================================ --- uncovered block 116-116 --- 114 | 115 | /// --- rocksdb::Cache surface --- >> 116 | const char * Name() const override { return "ClickHouseUniqueKeyIndexCache"; } 117 | 118 | ROCKSDB_NAMESPACE::Status Insert( --- uncovered block 152-152 --- 150 | void SetCapacity(size_t capacity) override; 151 | void SetStrictCapacityLimit(bool value) override; >> 152 | bool HasStrictCapacityLimit() const override { return strict_capacity_limit; } 153 | 154 | size_t GetCapacity() const override; --- uncovered block 180-180 --- 178 | void clear(); 179 | >> 180 | UniqueKeyIndexCacheBacking & getBacking() { return *backing; } 181 | 182 | private: === Lost Baseline Coverage: 7 lines === ================================================================================ programs/server/Server.cpp ================================================================================ --- lost coverage block 1774-1775 --- 1772 | else 1773 | { >> 1774 | String calculated_binary_hash = getHashOfLoadedBinaryHex(); >> 1775 | if (calculated_binary_hash == stored_binary_hash) 1776 | { 1777 | LOG_INFO(log, "Integrity check of the executable successfully passed (checksum: {})", calculated_binary_hash); --- lost coverage block 1777-1777 --- 1775 | if (calculated_binary_hash == stored_binary_hash) 1776 | { >> 1777 | LOG_INFO(log, "Integrity check of the executable successfully passed (checksum: {})", calculated_binary_hash); 1778 | } 1779 | else ================================================================================ src/Interpreters/Context.cpp ================================================================================ --- lost coverage block 4046-4046 --- 4044 | if (cache) 4045 | cache->clear(); >> 4046 | #endif 4047 | } 4048 | --- lost coverage block 5066-5066 --- 5064 | } 5065 | >> 5066 | if (!hasZooKeeper()) 5067 | throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG, "There is no Zookeeper configuration in server config"); 5068 | --- lost coverage block 5069-5069 --- 5067 | throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG, "There is no Zookeeper configuration in server config"); 5068 | >> 5069 | if (!hasDistributedDDL()) 5070 | throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG, "There is no DistributedDDL configuration in server config"); 5071 | --- lost coverage block 5072-5072 --- 5070 | throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG, "There is no DistributedDDL configuration in server config"); 5071 | >> 5072 | throw Exception(ErrorCodes::NO_ELEMENTS_IN_CONFIG, "DDL background thread is not initialized"); 5073 | } 5074 | WARNING: Failed to get start time for [Print Uncovered Code] - start time and duration won't be set --- Coverage counts --- Lines : baseline 758,407/901,448 -> current 758,628/901,894 (delta +221 / +446) Functions : baseline 830,767/911,808 -> current 830,804/911,958 (delta +37 / +150) Branches : baseline 246,503/321,666 -> current 246,679/321,852 (delta +176 / +186)