| 1167 | } |
| 1168 | |
| 1169 | Status DataCache::Partition::LoadMetaCache(const DumpData& dump_data) { |
| 1170 | lock_.DCheckLocked(); |
| 1171 | for (const DumpData::CacheKeyEntryData& key_entry : dump_data.meta_cache_data) { |
| 1172 | // Usually this shouldn't happen, and if it did, the dump file may be corrupted and |
| 1173 | // loading should be aborted. |
| 1174 | if (UNLIKELY(key_entry.index >= cache_files_.size())) { |
| 1175 | return Status("Failed to load meta cache, the dump file may be corrupted."); |
| 1176 | } |
| 1177 | |
| 1178 | // According to the index, find the corresponding file pointer, build entry and insert |
| 1179 | // into the cache like normal store. If the cache capacity has been changed, the entry |
| 1180 | // may be evicted, but that's no matter. |
| 1181 | CacheFile* file = cache_files_[key_entry.index].get(); |
| 1182 | CacheEntry entry(file, key_entry.offset, key_entry.len, key_entry.checksum); |
| 1183 | const int64_t charge_len = BitUtil::RoundUp(entry.len(), PAGE_SIZE); |
| 1184 | Cache::UniquePendingHandle pending_handle( |
| 1185 | meta_cache_->Allocate(Slice(key_entry.key), sizeof(CacheEntry), charge_len)); |
| 1186 | if (UNLIKELY(pending_handle.get() == nullptr)) continue; |
| 1187 | memcpy(meta_cache_->MutableValue(&pending_handle), &entry, sizeof(CacheEntry)); |
| 1188 | meta_cache_->Insert(std::move(pending_handle), this); |
| 1189 | ImpaladMetrics::IO_MGR_REMOTE_DATA_CACHE_TOTAL_BYTES->Increment(charge_len); |
| 1190 | ImpaladMetrics::IO_MGR_REMOTE_DATA_CACHE_NUM_ENTRIES->Increment(1); |
| 1191 | } |
| 1192 | return Status::OK(); |
| 1193 | } |
| 1194 | |
| 1195 | void DataCache::Partition::EvictedEntry(Slice key, Slice value) { |
| 1196 | if (closed_) return; |
nothing calls this directly
no test coverage detected