diff options
| author | Dan Engelbrecht <[email protected]> | 2023-05-12 15:37:46 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-12 15:37:46 +0200 |
| commit | a3738d2613d61fc0dccfaac6533674d76d1b9c9f (patch) | |
| tree | 044f856073cfb49422484808c6c8d43742385dbd /src/zenserver/cache/structuredcachestore.cpp | |
| parent | implemented structured cache logging (#296) (diff) | |
| download | zen-a3738d2613d61fc0dccfaac6533674d76d1b9c9f.tar.xz zen-a3738d2613d61fc0dccfaac6533674d76d1b9c9f.zip | |
fix gc bucket index compaction (#299)
* fix compaction of m_Payloads and m_AccessTimes in ZenCacheDiskLayer::CacheBucket
* changelog
Diffstat (limited to 'src/zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | src/zenserver/cache/structuredcachestore.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/zenserver/cache/structuredcachestore.cpp b/src/zenserver/cache/structuredcachestore.cpp index a95ae4ca2..2fd8e8be8 100644 --- a/src/zenserver/cache/structuredcachestore.cpp +++ b/src/zenserver/cache/structuredcachestore.cpp @@ -1691,10 +1691,11 @@ ZenCacheDiskLayer::CacheBucket::CollectGarbage(GcContext& GcCtx) Index.reserve(EntryCount); for (auto It : m_Index) { - size_t EntryIndex = Payloads.size(); - Payloads.push_back(m_Payloads[EntryIndex]); - AccessTimes.push_back(m_AccessTimes[EntryIndex]); - Index.insert({It.first, EntryIndex}); + size_t OldEntryIndex = It.second; + size_t NewEntryIndex = Payloads.size(); + Payloads.push_back(m_Payloads[OldEntryIndex]); + AccessTimes.push_back(m_AccessTimes[OldEntryIndex]); + Index.insert({It.first, NewEntryIndex}); } m_Index.swap(Index); m_Payloads.swap(Payloads); |