diff options
| author | Dan Engelbrecht <[email protected]> | 2023-05-10 17:12:51 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-10 17:12:51 +0200 |
| commit | 98ca5f6bebaed548026ddf218ea37414262ce8c6 (patch) | |
| tree | 156acc6a38c366f9b9e9d73127b5a23ea5b8fce8 /src/zenserver/cache/structuredcachestore.cpp | |
| parent | make sure we create gc root directory before checking disk space (diff) | |
| download | zen-98ca5f6bebaed548026ddf218ea37414262ce8c6.tar.xz zen-98ca5f6bebaed548026ddf218ea37414262ce8c6.zip | |
clean up log/index reading and fix incorrect logging about bad log files (#286)
Diffstat (limited to 'src/zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | src/zenserver/cache/structuredcachestore.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/zenserver/cache/structuredcachestore.cpp b/src/zenserver/cache/structuredcachestore.cpp index 99ca23407..d4e00d675 100644 --- a/src/zenserver/cache/structuredcachestore.cpp +++ b/src/zenserver/cache/structuredcachestore.cpp @@ -1007,16 +1007,20 @@ ZenCacheDiskLayer::CacheBucket::OpenLog(const bool IsNew) std::unordered_map<uint32_t, uint64_t> BlockSizes = m_BlockStore.Initialize(m_BlocksBasePath, MaxBlockSize, BlockStoreDiskLocation::MaxBlockIndex + 1); - uint64_t LogEntryCount = 0; + if (std::filesystem::is_regular_file(IndexPath)) { uint32_t IndexVersion = 0; m_LogFlushPosition = ReadIndexFile(IndexPath, IndexVersion); - if (IndexVersion == 0 && std::filesystem::is_regular_file(IndexPath)) + if (IndexVersion == 0) { ZEN_WARN("removing invalid index file at '{}'", IndexPath); - fs::remove(IndexPath); + std::filesystem::remove(IndexPath); } + } + uint64_t LogEntryCount = 0; + if (std::filesystem::is_regular_file(LogPath)) + { if (TCasLogFile<DiskIndexEntry>::IsValid(LogPath)) { LogEntryCount = ReadLog(LogPath, m_LogFlushPosition); @@ -1024,7 +1028,7 @@ ZenCacheDiskLayer::CacheBucket::OpenLog(const bool IsNew) else { ZEN_WARN("removing invalid cas log at '{}'", LogPath); - fs::remove(LogPath); + std::filesystem::remove(LogPath); } } |