aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zenserver/cache/structuredcachestore.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/zenserver/cache/structuredcachestore.cpp b/zenserver/cache/structuredcachestore.cpp
index 764bce93e..a7904a1ab 100644
--- a/zenserver/cache/structuredcachestore.cpp
+++ b/zenserver/cache/structuredcachestore.cpp
@@ -222,7 +222,7 @@ private:
std::filesystem::path m_BucketDir;
Oid m_BucketId;
bool m_Ok = false;
- uint64_t m_LargeObjectThreshold = 1024;
+ uint64_t m_LargeObjectThreshold = 64 * 1024;
BasicFile m_SobsFile;
TCasLogFile<DiskIndexEntry> m_SlogFile;
@@ -256,7 +256,7 @@ ZenCacheDiskLayer::CacheBucket::OpenOrCreate(std::filesystem::path BucketDir)
CAtlFile ManifestFile;
- // Try opening existing file first
+ // Try opening existing manifest file first
bool IsNew = false;
@@ -285,7 +285,7 @@ ZenCacheDiskLayer::CacheBucket::OpenOrCreate(std::filesystem::path BucketDir)
if (!m_Ok)
{
- // This is a new bucket
+ // No manifest file found, this is a new bucket
hRes = ManifestFile.Create(ManifestPath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, CREATE_ALWAYS);
@@ -311,18 +311,16 @@ ZenCacheDiskLayer::CacheBucket::OpenOrCreate(std::filesystem::path BucketDir)
uint64_t MaxFileOffset = 0;
+ if (zen::RwLock::ExclusiveLockScope _(m_IndexLock); m_Index.empty())
{
- // This is not technically necessary but may help future static analysis
- zen::RwLock::ExclusiveLockScope _(m_IndexLock);
-
m_SlogFile.Replay([&](const DiskIndexEntry& Record) {
m_Index[Record.Key] = Record.Location;
MaxFileOffset = std::max<uint64_t>(MaxFileOffset, Record.Location.Offset() + Record.Location.Size);
});
- }
- m_WriteCursor = (MaxFileOffset + 15) & ~15;
+ m_WriteCursor = (MaxFileOffset + 15) & ~15;
+ }
m_Ok = true;
}