aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/cache/structuredcachestore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenserver/cache/structuredcachestore.cpp')
-rw-r--r--src/zenserver/cache/structuredcachestore.cpp12
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);
}
}