diff options
| author | Dan Engelbrecht <[email protected]> | 2023-04-21 15:47:00 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-21 15:47:00 +0200 |
| commit | 3a774c0e15d86102a540d51c34cb35f9689df6a8 (patch) | |
| tree | f5b999068c20f3a9cb8c2e92e7dc55f3c2021ce4 /zenserver/cache/structuredcachestore.cpp | |
| parent | switch to juliangruber/read-file-action to avoid deprecated api usage (#252) (diff) | |
| download | zen-3a774c0e15d86102a540d51c34cb35f9689df6a8.tar.xz zen-3a774c0e15d86102a540d51c34cb35f9689df6a8.zip | |
save cache rawsize and rawhash in manifest file instead of log file (#251)
* save cache rawsize and rawhash in manifest file instead of log file
* don't use # as prefix for counts in log
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 320 |
1 files changed, 90 insertions, 230 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp index 44574ae19..26e970073 100644 --- a/zenserver/cache/structuredcachestore.cpp +++ b/zenserver/cache/structuredcachestore.cpp @@ -53,7 +53,7 @@ namespace { { static constexpr uint32_t ExpectedMagic = 0x75696478; // 'uidx'; static constexpr uint32_t Version2 = 2; - static constexpr uint32_t CurrentVersion = 3; + static constexpr uint32_t CurrentVersion = Version2; uint32_t Magic = ExpectedMagic; uint32_t Version = CurrentVersion; @@ -70,18 +70,10 @@ namespace { static_assert(sizeof(CacheBucketIndexHeader) == 32); - struct DiskIndexEntry_V2 - { - IoHash Key; // 20 bytes - DiskLocation Location; // 12 bytes - }; - - static_assert(sizeof(DiskIndexEntry_V2) == 32); #pragma pack(pop) const char* IndexExtension = ".uidx"; const char* LogExtension = ".slog"; - const char* LogExtensionV2 = ".v2.slog"; std::filesystem::path GetIndexPath(const std::filesystem::path& BucketDir, const std::string& BucketName) { @@ -93,42 +85,11 @@ namespace { return BucketDir / (BucketName + ".tmp"); } - std::filesystem::path GetLogPathV2(const std::filesystem::path& BucketDir, const std::string& BucketName) - { - return BucketDir / (BucketName + LogExtensionV2); - } - std::filesystem::path GetLogPath(const std::filesystem::path& BucketDir, const std::string& BucketName) { return BucketDir / (BucketName + LogExtension); } - bool ValidateEntry(const DiskIndexEntry_V2& Entry, std::string& OutReason) - { - if (Entry.Key == IoHash::Zero) - { - OutReason = fmt::format("Invalid hash key {}", Entry.Key.ToHexString()); - return false; - } - if (Entry.Location.GetFlags() & - ~(DiskLocation::kStandaloneFile | DiskLocation::kStructured | DiskLocation::kTombStone | DiskLocation::kCompressed)) - { - OutReason = fmt::format("Invalid flags {} for entry {}", Entry.Location.GetFlags(), Entry.Key.ToHexString()); - return false; - } - if (Entry.Location.IsFlagSet(DiskLocation::kTombStone)) - { - return true; - } - uint64_t Size = Entry.Location.Size(); - if (Size == 0) - { - OutReason = fmt::format("Invalid size {} for entry {}", Size, Entry.Key.ToHexString()); - return false; - } - return true; - } - bool ValidateEntry(const DiskIndexEntry& Entry, std::string& OutReason) { if (Entry.Key == IoHash::Zero) @@ -146,17 +107,9 @@ namespace { { return true; } - if (Entry.RawSize != 0) + if (Entry.Location.Reserved != 0) { - if (Entry.RawHash == IoHash::Zero) - { - OutReason = fmt::format("Invalid raw hash for entry {}", Entry.Key.ToHexString()); - return false; - } - } - else if (Entry.RawHash != IoHash::Zero) - { - OutReason = fmt::format("Invalid raw size for entry {}", Entry.Key.ToHexString()); + OutReason = fmt::format("Invalid reserved field {} for entry {}", Entry.Location.Reserved, Entry.Key.ToHexString()); return false; } uint64_t Size = Entry.Location.Size(); @@ -762,7 +715,7 @@ ZenCacheDiskLayer::CacheBucket::OpenOrCreate(std::filesystem::path BucketDir, bo if (Manifest) { - m_BucketId = Manifest["BucketId"].AsObjectId(); + m_BucketId = Manifest["BucketId"sv].AsObjectId(); if (m_BucketId == Oid::Zero) { return false; @@ -785,16 +738,35 @@ ZenCacheDiskLayer::CacheBucket::OpenOrCreate(std::filesystem::path BucketDir, bo OpenLog(IsNew); - for (CbFieldView Entry : Manifest["Timestamps"]) + if (!IsNew) { - const CbObjectView Obj = Entry.AsObjectView(); - const IoHash Key = Obj["Key"sv].AsHash(); + Stopwatch Timer; + const auto _ = + MakeGuard([&] { ZEN_INFO("read store manifest '{}' in {}", ManifestPath, NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - if (auto It = m_Index.find(Key); It != m_Index.end()) + for (CbFieldView Entry : Manifest["Timestamps"sv]) { - size_t EntryIndex = It.value(); - ZEN_ASSERT_SLOW(EntryIndex < m_AccessTimes.size()); - m_AccessTimes[EntryIndex] = Obj["LastAccess"sv].AsInt64(); + const CbObjectView Obj = Entry.AsObjectView(); + const IoHash Key = Obj["Key"sv].AsHash(); + + if (auto It = m_Index.find(Key); It != m_Index.end()) + { + size_t EntryIndex = It.value(); + ZEN_ASSERT_SLOW(EntryIndex < m_AccessTimes.size()); + m_AccessTimes[EntryIndex] = Obj["LastAccess"sv].AsInt64(); + } + } + for (CbFieldView Entry : Manifest["RawInfo"sv]) + { + const CbObjectView Obj = Entry.AsObjectView(); + const IoHash Key = Obj["Key"sv].AsHash(); + if (auto It = m_Index.find(Key); It != m_Index.end()) + { + size_t EntryIndex = It.value(); + ZEN_ASSERT_SLOW(EntryIndex < m_Payloads.size()); + m_Payloads[EntryIndex].RawHash = Obj["RawHash"sv].AsHash(); + m_Payloads[EntryIndex].RawSize = Obj["RawSize"sv].AsUInt64(); + } } } @@ -814,7 +786,7 @@ ZenCacheDiskLayer::CacheBucket::MakeIndexSnapshot() uint64_t EntryCount = 0; Stopwatch Timer; const auto _ = MakeGuard([&] { - ZEN_INFO("wrote store snapshot for '{}' containing #{} entries in {}", + ZEN_INFO("wrote store snapshot for '{}' containing {} entries in {}", m_BucketDir / m_BucketName, EntryCount, NiceTimeSpanMs(Timer.GetElapsedTimeMs())); @@ -849,8 +821,6 @@ ZenCacheDiskLayer::CacheBucket::MakeIndexSnapshot() DiskIndexEntry& IndexEntry = Entries[EntryIndex++]; IndexEntry.Key = Entry.first; IndexEntry.Location = m_Payloads[Entry.second].Location; - IndexEntry.RawHash = m_Payloads[Entry.second].RawHash; - IndexEntry.RawSize = m_Payloads[Entry.second].RawSize; } } @@ -892,12 +862,6 @@ ZenCacheDiskLayer::CacheBucket::ReadIndexFile(const std::filesystem::path& Index { if (std::filesystem::is_regular_file(IndexPath)) { - size_t EntryCount = 0; - Stopwatch Timer; - const auto _ = MakeGuard([&] { - ZEN_INFO("read store '{}' index containing #{} entries in {}", IndexPath, EntryCount, NiceTimeSpanMs(Timer.GetElapsedTimeMs())); - }); - BasicFile ObjectIndexFile; ObjectIndexFile.Open(IndexPath, BasicFile::Mode::kRead); uint64_t Size = ObjectIndexFile.FileSize(); @@ -912,48 +876,20 @@ ZenCacheDiskLayer::CacheBucket::ReadIndexFile(const std::filesystem::path& Index { case CacheBucketIndexHeader::Version2: { - uint64_t ExpectedEntryCount = (Size - sizeof(sizeof(CacheBucketIndexHeader))) / sizeof(DiskIndexEntry_V2); - if (Header.EntryCount > ExpectedEntryCount) - { - break; - } - m_PayloadAlignment = Header.PayloadAlignment; - - std::vector<DiskIndexEntry_V2> Entries; - Entries.resize(Header.EntryCount); - ObjectIndexFile.Read(Entries.data(), - Header.EntryCount * sizeof(DiskIndexEntry_V2), - sizeof(CacheBucketIndexHeader)); - - m_Payloads.reserve(Header.EntryCount); - m_AccessTimes.reserve(Header.EntryCount); - m_Index.reserve(Header.EntryCount); - - std::string InvalidEntryReason; - for (const DiskIndexEntry_V2& Entry : Entries) - { - if (!ValidateEntry(Entry, InvalidEntryReason)) - { - ZEN_WARN("skipping invalid entry in '{}', reason: '{}'", IndexPath, InvalidEntryReason); - continue; - } - size_t EntryIndex = m_Payloads.size(); - m_Payloads.emplace_back(BucketPayload{.Location = Entry.Location, .RawSize = 0, .RawHash = IoHash::Zero}); - m_AccessTimes.emplace_back(GcClock::TickCount()); - m_Index.insert_or_assign(Entry.Key, EntryIndex); - EntryCount++; - } - OutVersion = CacheBucketIndexHeader::Version2; - return Header.LogPosition; - } - break; - case CacheBucketIndexHeader::CurrentVersion: - { uint64_t ExpectedEntryCount = (Size - sizeof(sizeof(CacheBucketIndexHeader))) / sizeof(DiskIndexEntry); if (Header.EntryCount > ExpectedEntryCount) { break; } + size_t EntryCount = 0; + Stopwatch Timer; + const auto _ = MakeGuard([&] { + ZEN_INFO("read store '{}' index containing {} entries in {}", + IndexPath, + EntryCount, + NiceTimeSpanMs(Timer.GetElapsedTimeMs())); + }); + m_PayloadAlignment = Header.PayloadAlignment; std::vector<DiskIndexEntry> Entries; @@ -974,15 +910,13 @@ ZenCacheDiskLayer::CacheBucket::ReadIndexFile(const std::filesystem::path& Index ZEN_WARN("skipping invalid entry in '{}', reason: '{}'", IndexPath, InvalidEntryReason); continue; } - size_t EntryIndex = m_Payloads.size(); - m_Payloads.emplace_back( - BucketPayload{.Location = Entry.Location, .RawSize = Entry.RawSize, .RawHash = Entry.RawHash}); + m_Payloads.emplace_back(BucketPayload{.Location = Entry.Location, .RawSize = 0, .RawHash = IoHash::Zero}); m_AccessTimes.emplace_back(GcClock::TickCount()); m_Index.insert_or_assign(Entry.Key, EntryIndex); EntryCount++; } - OutVersion = CacheBucketIndexHeader::CurrentVersion; + OutVersion = CacheBucketIndexHeader::Version2; return Header.LogPosition; } break; @@ -997,61 +931,6 @@ ZenCacheDiskLayer::CacheBucket::ReadIndexFile(const std::filesystem::path& Index } uint64_t -ZenCacheDiskLayer::CacheBucket::ReadLogV2(const std::filesystem::path& LogPath, uint64_t SkipEntryCount) -{ - if (std::filesystem::is_regular_file(LogPath)) - { - uint64_t LogEntryCount = 0; - Stopwatch Timer; - const auto _ = MakeGuard([&] { - ZEN_INFO("read store '{}' log containing #{} entries in {}", LogPath, LogEntryCount, NiceTimeSpanMs(Timer.GetElapsedTimeMs())); - }); - TCasLogFile<DiskIndexEntry_V2> CasLog; - CasLog.Open(LogPath, CasLogFile::Mode::kRead); - if (CasLog.Initialize()) - { - uint64_t EntryCount = CasLog.GetLogCount(); - if (EntryCount < SkipEntryCount) - { - ZEN_WARN("reading full log at '{}', reason: Log position from index snapshot is out of range", LogPath); - SkipEntryCount = 0; - } - LogEntryCount = EntryCount - SkipEntryCount; - m_Index.reserve(LogEntryCount); - uint64_t InvalidEntryCount = 0; - CasLog.Replay( - [&](const DiskIndexEntry_V2& Record) { - std::string InvalidEntryReason; - if (Record.Location.Flags & DiskLocation::kTombStone) - { - m_Index.erase(Record.Key); - return; - } - if (!ValidateEntry(Record, InvalidEntryReason)) - { - ZEN_WARN("skipping invalid entry in '{}', reason: '{}'", LogPath, InvalidEntryReason); - ++InvalidEntryCount; - return; - } - size_t EntryIndex = m_Payloads.size(); - IoHash RawHash = IoHash::Zero; - uint64_t RawSize = 0u; - m_Payloads.emplace_back(BucketPayload{.Location = Record.Location, .RawSize = RawSize, .RawHash = RawHash}); - m_AccessTimes.emplace_back(GcClock::TickCount()); - m_Index.insert_or_assign(Record.Key, EntryIndex); - }, - SkipEntryCount); - if (InvalidEntryCount) - { - ZEN_WARN("found #{} invalid entries in '{}'", InvalidEntryCount, m_BucketDir / m_BucketName); - } - return LogEntryCount; - } - } - return 0; -}; - -uint64_t ZenCacheDiskLayer::CacheBucket::ReadLog(const std::filesystem::path& LogPath, uint64_t SkipEntryCount) { if (std::filesystem::is_regular_file(LogPath)) @@ -1059,7 +938,7 @@ ZenCacheDiskLayer::CacheBucket::ReadLog(const std::filesystem::path& LogPath, ui uint64_t LogEntryCount = 0; Stopwatch Timer; const auto _ = MakeGuard([&] { - ZEN_INFO("read store '{}' log containing #{} entries in {}", LogPath, LogEntryCount, NiceTimeSpanMs(Timer.GetElapsedTimeMs())); + ZEN_INFO("read store '{}' log containing {} entries in {}", LogPath, LogEntryCount, NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); TCasLogFile<DiskIndexEntry> CasLog; CasLog.Open(LogPath, CasLogFile::Mode::kRead); @@ -1089,15 +968,14 @@ ZenCacheDiskLayer::CacheBucket::ReadLog(const std::filesystem::path& LogPath, ui return; } size_t EntryIndex = m_Payloads.size(); - m_Payloads.emplace_back( - BucketPayload{.Location = Record.Location, .RawSize = Record.RawSize, .RawHash = Record.RawHash}); + m_Payloads.emplace_back(BucketPayload{.Location = Record.Location, .RawSize = 0u, .RawHash = IoHash::Zero}); m_AccessTimes.emplace_back(GcClock::TickCount()); m_Index.insert_or_assign(Record.Key, EntryIndex); }, SkipEntryCount); if (InvalidEntryCount) { - ZEN_WARN("found #{} invalid entries in '{}'", InvalidEntryCount, m_BucketDir / m_BucketName); + ZEN_WARN("found {} invalid entries in '{}'", InvalidEntryCount, m_BucketDir / m_BucketName); } return LogEntryCount; } @@ -1114,51 +992,41 @@ ZenCacheDiskLayer::CacheBucket::OpenLog(const bool IsNew) m_Payloads.clear(); m_AccessTimes.clear(); - std::filesystem::path LogPathV2 = GetLogPathV2(m_BucketDir, m_BucketName); std::filesystem::path LogPath = GetLogPath(m_BucketDir, m_BucketName); std::filesystem::path IndexPath = GetIndexPath(m_BucketDir, m_BucketName); if (IsNew) { fs::remove(LogPath); - fs::remove(LogPathV2); fs::remove(IndexPath); fs::remove_all(m_BlocksBasePath); } - bool RewriteLog = false; uint64_t LogEntryCount = 0; { uint32_t IndexVersion = 0; m_LogFlushPosition = ReadIndexFile(IndexPath, IndexVersion); - if ((IndexVersion != CacheBucketIndexHeader::CurrentVersion) && TCasLogFile<DiskIndexEntry_V2>::IsValid(LogPath)) + if (IndexVersion == 0 && std::filesystem::is_regular_file(IndexPath)) { - if (std::filesystem::exists(LogPathV2)) - { - std::filesystem::remove(LogPathV2); - } - std::filesystem::rename(LogPath, LogPathV2); - LogEntryCount = ReadLogV2(LogPathV2, m_LogFlushPosition); - RewriteLog = true; - // We have a new snapshot format, so we have not flushed any log entries - LogEntryCount += m_LogFlushPosition; - m_LogFlushPosition = 0; + ZEN_WARN("removing invalid index file at '{}'", IndexPath); + fs::remove(IndexPath); } - else + + if (TCasLogFile<DiskIndexEntry>::IsValid(LogPath)) { LogEntryCount = ReadLog(LogPath, m_LogFlushPosition); } + else + { + ZEN_WARN("removing invalid cas log at '{}'", LogPath); + fs::remove(LogPath); + } } CreateDirectories(m_BucketDir); m_SlogFile.Open(LogPath, CasLogFile::Mode::kWrite); - std::vector<DiskIndexEntry> ConvertedEntries; - if (RewriteLog) - { - ConvertedEntries.reserve(m_Index.size()); - } std::vector<BlockStoreLocation> KnownLocations; KnownLocations.reserve(m_Index.size()); for (const auto& Entry : m_Index) @@ -1167,11 +1035,6 @@ ZenCacheDiskLayer::CacheBucket::OpenLog(const bool IsNew) const BucketPayload& Payload = m_Payloads[EntryIndex]; const DiskLocation& Location = Payload.Location; - if (RewriteLog) - { - ConvertedEntries.push_back({.RawSize = Payload.RawSize, .Location = Location, .RawHash = Payload.RawHash, .Key = Entry.first}); - } - if (Location.IsFlagSet(DiskLocation::kStandaloneFile)) { m_TotalStandaloneSize.fetch_add(Location.Size(), std::memory_order::relaxed); @@ -1180,23 +1043,12 @@ ZenCacheDiskLayer::CacheBucket::OpenLog(const bool IsNew) const BlockStoreLocation& BlockLocation = Location.GetBlockLocation(m_PayloadAlignment); KnownLocations.push_back(BlockLocation); } - if (!ConvertedEntries.empty()) - { - m_SlogFile.Append(ConvertedEntries); - std::error_code Ec; - std::filesystem::remove(LogPathV2); - if (Ec) - { - ZEN_WARN("failed to remove legacy log file '{}' FAILED, reason: '{}'", LogPathV2, Ec.message()); - } - } m_BlockStore.Initialize(m_BlocksBasePath, MaxBlockSize, BlockStoreDiskLocation::MaxBlockIndex + 1, KnownLocations); if (IsNew || LogEntryCount > 0) { MakeIndexSnapshot(); } - // TODO: should validate integrity of container files here } @@ -1369,6 +1221,24 @@ ZenCacheDiskLayer::CacheBucket::SaveManifest() Writer.EndObject(); } Writer.EndArray(); + + Writer.BeginArray("RawInfo"sv); + { + for (auto& Kv : m_Index) + { + const IoHash& Key = Kv.first; + const BucketPayload& Payload = m_Payloads[Kv.second]; + if (Payload.RawHash != IoHash::Zero) + { + Writer.BeginObject(); + Writer << "Key"sv << Key; + Writer << "RawHash"sv << Payload.RawHash; + Writer << "RawSize"sv << Payload.RawSize; + Writer.EndObject(); + } + } + } + Writer.EndArray(); } SaveCompactBinaryObject(m_BucketDir / "zen_manifest", Writer.Save()); @@ -1512,7 +1382,7 @@ ZenCacheDiskLayer::CacheBucket::Scrub(ScrubContext& Ctx) if (!BadKeys.empty()) { - ZEN_WARN("Scrubbing found #{} bad chunks in '{}'", BadKeys.size(), m_BucketDir / m_BucketName); + ZEN_WARN("Scrubbing found {} bad chunks in '{}'", BadKeys.size(), m_BucketDir / m_BucketName); if (Ctx.RunRecovery()) { @@ -1530,8 +1400,7 @@ ZenCacheDiskLayer::CacheBucket::Scrub(ScrubContext& Ctx) const BucketPayload& Payload = m_Payloads[It->second]; DiskLocation Location = Payload.Location; Location.Flags |= DiskLocation::kTombStone; - LogEntries.push_back( - DiskIndexEntry{.RawSize = Payload.RawSize, .Location = Location, .RawHash = Payload.RawHash, .Key = BadKey}); + LogEntries.push_back(DiskIndexEntry{.Key = BadKey, .Location = Location}); m_Index.erase(BadKey); } } @@ -1712,9 +1581,9 @@ ZenCacheDiskLayer::CacheBucket::CollectGarbage(GcContext& GcCtx) const auto _ = MakeGuard([&] { ZEN_DEBUG( - "garbage collect from '{}' DONE after {}, write lock: {} ({}), read lock: {} ({}), collected {} bytes, deleted #{} and moved " - "#{} " - "of #{} " + "garbage collect from '{}' DONE after {}, write lock: {} ({}), read lock: {} ({}), collected {} bytes, deleted {} and moved " + "{} " + "of {} " "entires ({}).", m_BucketDir / m_BucketName, NiceTimeSpanMs(TotalTimer.GetElapsedTimeMs()), @@ -1810,10 +1679,7 @@ ZenCacheDiskLayer::CacheBucket::CollectGarbage(GcContext& GcCtx) if (auto It = Index.find(Key); It != Index.end()) { const BucketPayload& Payload = m_Payloads[It->second]; - DiskIndexEntry Entry = {.RawSize = Payload.RawSize, - .Location = Payload.Location, - .RawHash = Payload.RawHash, - .Key = It->first}; + DiskIndexEntry Entry = {.Key = It->first, .Location = Payload.Location}; if (Entry.Location.Flags & DiskLocation::kStandaloneFile) { Entry.Location.Flags |= DiskLocation::kTombStone; @@ -1889,10 +1755,9 @@ ZenCacheDiskLayer::CacheBucket::CollectGarbage(GcContext& GcCtx) { continue; } - m_SlogFile.Append( - DiskIndexEntry{.RawSize = Entry.RawSize, .Location = RestoreLocation, .RawHash = Entry.RawHash, .Key = Key}); + m_SlogFile.Append(DiskIndexEntry{.Key = Key, .Location = RestoreLocation}); size_t EntryIndex = m_Payloads.size(); - m_Payloads.emplace_back(BucketPayload{.Location = RestoreLocation, .RawSize = Entry.RawSize, .RawHash = Entry.RawHash}); + m_Payloads.emplace_back(BucketPayload{.Location = RestoreLocation}); m_AccessTimes.emplace_back(GcClock::TickCount()); m_Index.insert({Key, EntryIndex}); m_TotalStandaloneSize.fetch_add(RestoreLocation.Size(), std::memory_order::relaxed); @@ -1951,11 +1816,10 @@ ZenCacheDiskLayer::CacheBucket::CollectGarbage(GcContext& GcCtx) { m_BlockStore.ReclaimSpace(BlockStoreState, ChunkLocations, KeepChunkIndexes, m_PayloadAlignment, true); uint64_t CurrentTotalSize = TotalSize(); - ZEN_DEBUG("garbage collect from '{}' DISABLED, found #{} {} chunks of total #{} {}", + ZEN_DEBUG("garbage collect from '{}' DISABLED, found {} chunks of total {} {}", m_BucketDir / m_BucketName, DeleteCount, - 0, // NiceBytes(TotalSize - NewTotalSize), - CurrentTotalSize, + TotalChunkCount, NiceBytes(CurrentTotalSize)); return; } @@ -1976,22 +1840,18 @@ ZenCacheDiskLayer::CacheBucket::CollectGarbage(GcContext& GcCtx) const IoHash& ChunkHash = ChunkIndexToChunkHash[ChunkIndex]; const BucketPayload& OldPayload = m_Payloads[Index[ChunkHash]]; const DiskLocation& OldDiskLocation = OldPayload.Location; - LogEntries.push_back({.RawSize = OldPayload.RawSize, - .Location = DiskLocation(NewLocation, m_PayloadAlignment, OldDiskLocation.GetFlags()), - .RawHash = OldPayload.RawHash, - .Key = ChunkHash}); + LogEntries.push_back( + {.Key = ChunkHash, .Location = DiskLocation(NewLocation, m_PayloadAlignment, OldDiskLocation.GetFlags())}); } for (const size_t ChunkIndex : RemovedChunks) { const IoHash& ChunkHash = ChunkIndexToChunkHash[ChunkIndex]; const BucketPayload& OldPayload = m_Payloads[Index[ChunkHash]]; const DiskLocation& OldDiskLocation = OldPayload.Location; - LogEntries.push_back({.RawSize = OldPayload.RawSize, + LogEntries.push_back({.Key = ChunkHash, .Location = DiskLocation(OldDiskLocation.GetBlockLocation(m_PayloadAlignment), m_PayloadAlignment, - OldDiskLocation.GetFlags() | DiskLocation::kTombStone), - .RawHash = OldPayload.RawHash, - .Key = ChunkHash}); + OldDiskLocation.GetFlags() | DiskLocation::kTombStone)}); DeletedChunks.insert(ChunkHash); } @@ -2239,7 +2099,7 @@ ZenCacheDiskLayer::CacheBucket::PutStandaloneCacheValue(const IoHash& HashKey, c m_TotalStandaloneSize.fetch_sub(Loc.Size(), std::memory_order::relaxed); } - m_SlogFile.Append({.RawSize = Value.RawSize, .Location = Loc, .RawHash = Value.RawHash, .Key = HashKey}); + m_SlogFile.Append({.Key = HashKey, .Location = Loc}); m_TotalStandaloneSize.fetch_add(NewFileSize, std::memory_order::relaxed); } @@ -2259,7 +2119,7 @@ ZenCacheDiskLayer::CacheBucket::PutInlineCacheValue(const IoHash& HashKey, const m_BlockStore.WriteChunk(Value.Value.Data(), Value.Value.Size(), m_PayloadAlignment, [&](const BlockStoreLocation& BlockStoreLocation) { DiskLocation Location(BlockStoreLocation, m_PayloadAlignment, EntryFlags); - m_SlogFile.Append({.RawSize = Value.RawSize, .Location = Location, .RawHash = Value.RawHash, .Key = HashKey}); + m_SlogFile.Append({.Key = HashKey, .Location = Location}); RwLock::ExclusiveLockScope _(m_IndexLock); if (auto It = m_Index.find(HashKey); It != m_Index.end()) @@ -2606,7 +2466,7 @@ ZenCacheStore::ZenCacheStore(GcManager& Gc, const Configuration& Configuration) } } - ZEN_INFO("Found #{} namespaces in '{}'", Namespaces.size(), m_Configuration.BasePath); + ZEN_INFO("Found {} namespaces in '{}'", Namespaces.size(), m_Configuration.BasePath); if (std::find(Namespaces.begin(), Namespaces.end(), UE4DDCNamespaceName) == Namespaces.end()) { |