diff options
| -rw-r--r-- | zenstore/compactcas.cpp | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp index 0c4a84dd1..1dd1a3906 100644 --- a/zenstore/compactcas.cpp +++ b/zenstore/compactcas.cpp @@ -280,7 +280,10 @@ namespace { TCasLogFile<CasDiskIndexEntry> CasLog; CasLog.Open(SlogPath, CasLogFile::EMode::kRead); - CasLog.Replay([&](const CasDiskIndexEntry& Record) { Entries.push_back(Record); }); + if (CasLog.Initialize()) + { + CasLog.Replay([&](const CasDiskIndexEntry& Record) { Entries.push_back(Record); }); + } } return Entries; } @@ -354,29 +357,32 @@ namespace { LegacyDiskIndex.size(), NiceTimeSpanMs(Timer.GetElapsedTimeMs())); }); - LegacyCasLog.Replay([&](const LegacyCasDiskIndexEntry& Record) { - std::string InvalidEntryReason; - if (Record.Flags & LegacyCasDiskIndexEntry::kTombstone) - { - LegacyDiskIndex.erase(Record.Key); - return; - } - if (!ValidateLegacyEntry(Record, InvalidEntryReason)) - { - ZEN_WARN("skipping invalid entry in '{}', '{}'", LegacyLogPath, InvalidEntryReason); - return; - } - uint64_t EntryEnd = Record.Location.GetOffset() + Record.Location.GetSize(); - if (EntryEnd > FileSize) - { - return; - } - if (ExistingChunks.contains(Record.Key)) - { - return; - } - LegacyDiskIndex[Record.Key] = Record; - }); + if (LegacyCasLog.Initialize()) + { + LegacyCasLog.Replay([&](const LegacyCasDiskIndexEntry& Record) { + std::string InvalidEntryReason; + if (Record.Flags & LegacyCasDiskIndexEntry::kTombstone) + { + LegacyDiskIndex.erase(Record.Key); + return; + } + if (!ValidateLegacyEntry(Record, InvalidEntryReason)) + { + ZEN_WARN("skipping invalid entry in '{}', '{}'", LegacyLogPath, InvalidEntryReason); + return; + } + uint64_t EntryEnd = Record.Location.GetOffset() + Record.Location.GetSize(); + if (EntryEnd > FileSize) + { + return; + } + if (ExistingChunks.contains(Record.Key)) + { + return; + } + LegacyDiskIndex[Record.Key] = Record; + }); + } } if (LegacyDiskIndex.empty()) |