diff options
| author | Dan Engelbrecht <[email protected]> | 2023-10-05 14:58:42 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-05 14:58:42 +0200 |
| commit | 45c7f6c6987fd24ed4f444dac34b13216bab108a (patch) | |
| tree | 068a10ae56a52787ee3ed83d245613fb21ff88ee /src/zenserver/cache/cachedisklayer.h | |
| parent | Merge branch 'main' of https://github.com/EpicGames/zen (diff) | |
| download | zen-45c7f6c6987fd24ed4f444dac34b13216bab108a.tar.xz zen-45c7f6c6987fd24ed4f444dac34b13216bab108a.zip | |
Fix curruption of disk cache bucket index on GC (#448)
* make sure we hold the index lock when reading payload data in reclaim space
* don't use index snapshot when updating index in reclaim space
* check that things have not moved under our feet
* don't touch m_Payloads without a lock
* start write block index on the highest block index
* we don't need to bump writeblockindex when stopping write to a block, we will bump appropriately when we start a new block
* changelog
Diffstat (limited to 'src/zenserver/cache/cachedisklayer.h')
| -rw-r--r-- | src/zenserver/cache/cachedisklayer.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/zenserver/cache/cachedisklayer.h b/src/zenserver/cache/cachedisklayer.h index c4bedfee8..62163100d 100644 --- a/src/zenserver/cache/cachedisklayer.h +++ b/src/zenserver/cache/cachedisklayer.h @@ -32,6 +32,8 @@ struct DiskLocation this->Location.BlockLocation = BlockStoreDiskLocation(Location, PayloadAlignment); } + inline bool operator!=(const DiskLocation& Rhs) const { return memcmp(&Location, &Rhs.Location, sizeof(Location)) != 0; } + inline BlockStoreLocation GetBlockLocation(uint64_t PayloadAlignment) const { ZEN_ASSERT(!(Flags & kStandaloneFile)); @@ -231,7 +233,7 @@ private: uint64_t ReadIndexFile(const std::filesystem::path& IndexPath, uint32_t& OutVersion); uint64_t ReadLog(const std::filesystem::path& LogPath, uint64_t LogPosition); void OpenLog(const bool IsNew); - CbObject MakeManifest(IndexMap&& Index, std::vector<AccessTime>&& AccessTimes, std::vector<BucketPayload>&& Payloads); + CbObject MakeManifest(IndexMap&& Index, std::vector<AccessTime>&& AccessTimes, const std::vector<BucketPayload>& Payloads); void SaveManifest(CbObject&& Manifest); CacheValueDetails::ValueDetails GetValueDetails(const IoHash& Key, size_t Index) const; // These locks are here to avoid contention on file creation, therefore it's sufficient |