diff options
| author | Stefan Boberg <[email protected]> | 2021-05-25 12:32:23 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-05-25 12:32:23 +0200 |
| commit | 9ebd2cf2dca60b400d67a14eaadb58bacecbbd3c (patch) | |
| tree | 7234d5ce54f5471a0aadd28251ccf63b33f2940a /zenserver/cache/structuredcachestore.cpp | |
| parent | constinit -> const for now so that the code builds with the non-preview compiler (diff) | |
| download | zen-9ebd2cf2dca60b400d67a14eaadb58bacecbbd3c.tar.xz zen-9ebd2cf2dca60b400d67a14eaadb58bacecbbd3c.zip | |
Bumped large object threshold to 64k, improved disk bucket replay mutex logic
Diffstat (limited to 'zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | zenserver/cache/structuredcachestore.cpp | 14 |
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; } |