diff options
| author | Dan Engelbrecht <[email protected]> | 2024-02-27 09:39:30 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-27 09:39:30 +0100 |
| commit | badf0c81d059e3cdd6051dba310dc7db5b7cc8d1 (patch) | |
| tree | ef19fc779ce5232b80a40dd9aea3cba478ada2df /src/zenstore/include | |
| parent | hashing fixes (#657) (diff) | |
| download | zen-badf0c81d059e3cdd6051dba310dc7db5b7cc8d1.tar.xz zen-badf0c81d059e3cdd6051dba310dc7db5b7cc8d1.zip | |
remove reference caching (#658)
* remove reference caching
Diffstat (limited to 'src/zenstore/include')
| -rw-r--r-- | src/zenstore/include/zenstore/cache/cachedisklayer.h | 51 |
1 files changed, 8 insertions, 43 deletions
diff --git a/src/zenstore/include/zenstore/cache/cachedisklayer.h b/src/zenstore/include/zenstore/cache/cachedisklayer.h index 6997a12e4..7aced67ad 100644 --- a/src/zenstore/include/zenstore/cache/cachedisklayer.h +++ b/src/zenstore/include/zenstore/cache/cachedisklayer.h @@ -105,11 +105,10 @@ class ZenCacheDiskLayer public: struct BucketConfiguration { - uint64_t MaxBlockSize = 1ull << 30; - uint32_t PayloadAlignment = 1u << 4; - uint64_t MemCacheSizeThreshold = 1 * 1024; - uint64_t LargeObjectThreshold = 128 * 1024; - bool EnableReferenceCaching = false; + uint64_t MaxBlockSize = 1ull << 30; + uint32_t PayloadAlignment = 1u << 4; + uint64_t MemCacheSizeThreshold = 1 * 1024; + uint64_t LargeObjectThreshold = 128 * 1024; }; struct Configuration @@ -248,20 +247,6 @@ public: inline auto operator<=>(const MemCachedIndex& Other) const = default; }; - struct ReferenceIndex - { - uint32_t Index = std::numeric_limits<uint32_t>::max(); - - static const ReferenceIndex Unknown() { return ReferenceIndex{std::numeric_limits<uint32_t>::max()}; } - static const ReferenceIndex None() { return ReferenceIndex{std::numeric_limits<uint32_t>::max() - 1}; } - - ReferenceIndex() = default; - explicit ReferenceIndex(size_t InIndex) : Index(uint32_t(InIndex)) {} - operator size_t() const { return Index; }; - operator bool() const { return Index != std::numeric_limits<uint32_t>::max(); }; - inline auto operator<=>(const ReferenceIndex& Other) const = default; - }; - struct PayloadIndex { uint32_t Index = std::numeric_limits<uint32_t>::max(); @@ -330,11 +315,8 @@ public: std::vector<MetaDataIndex> m_FreeMetaDatas; std::vector<MemCacheData> m_MemCachedPayloads; std::vector<MemCachedIndex> m_FreeMemCachedPayloads; - std::vector<ReferenceIndex> m_FirstReferenceIndex; - std::vector<IoHash> m_ReferenceHashes; - std::vector<ReferenceIndex> m_NextReferenceHashesIndexes; - std::unique_ptr<HashSet> m_UpdatedKeys; - size_t m_ReferenceCount = 0; + std::unique_ptr<HashSet> m_TrackedCacheKeys; + std::unique_ptr<HashSet> m_TrackedReferences; std::atomic_uint64_t m_StandaloneSize{}; std::atomic_uint64_t m_MemCachedSize{}; @@ -349,21 +331,6 @@ public: IoBuffer GetInlineCacheValue(const DiskLocation& Loc) const; CacheValueDetails::ValueDetails GetValueDetails(RwLock::SharedLockScope&, const IoHash& Key, PayloadIndex Index) const; - void CompactReferences(RwLock::ExclusiveLockScope&); - void SetReferences(RwLock::ExclusiveLockScope&, ReferenceIndex& FirstReferenceIndex, std::span<IoHash> References); - void RemoveReferences(RwLock::ExclusiveLockScope&, ReferenceIndex& FirstReferenceIndex); - inline bool GetReferences(RwLock::SharedLockScope&, ReferenceIndex FirstReferenceIndex, std::vector<IoHash>& OutReferences) const - { - return LockedGetReferences(FirstReferenceIndex, OutReferences); - } - inline bool GetReferences(RwLock::ExclusiveLockScope&, ReferenceIndex FirstReferenceIndex, std::vector<IoHash>& OutReferences) const - { - return LockedGetReferences(FirstReferenceIndex, OutReferences); - } - ReferenceIndex AllocateReferenceEntry(RwLock::ExclusiveLockScope&, const IoHash& Key); - bool LockedGetReferences(ReferenceIndex FirstReferenceIndex, std::vector<IoHash>& OutReferences) const; - void ClearReferenceCache(); - void SetMetaData(RwLock::ExclusiveLockScope&, BucketPayload& Payload, const ZenCacheDiskLayer::CacheBucket::BucketMetaData& MetaData); @@ -391,14 +358,12 @@ public: } void WriteIndexSnapshotLocked(const std::function<uint64_t()>& ClaimDiskReserveFunc = []() { return 0; }); - void CompactState(RwLock::ExclusiveLockScope&, + void CompactState(RwLock::ExclusiveLockScope& IndexLock, std::vector<BucketPayload>& Payloads, std::vector<AccessTime>& AccessTimes, std::vector<BucketMetaData>& MetaDatas, std::vector<MemCacheData>& MemCachedPayloads, - std::vector<ReferenceIndex>& FirstReferenceIndex, - IndexMap& Index, - RwLock::ExclusiveLockScope& IndexLock); + IndexMap& Index); void AddMemCacheUsage(uint64_t ValueSize) { |