aboutsummaryrefslogtreecommitdiff
path: root/src/zenstore
diff options
context:
space:
mode:
authorzousar <[email protected]>2025-03-02 00:15:35 -0700
committerzousar <[email protected]>2025-03-02 00:15:35 -0700
commit6d07b0437ccb7800652708f76a7ee84e551f43cf (patch)
tree15d4ef7c9b69da20ea5da3dc18240d75bb64d17e /src/zenstore
parentMove utility methods in cachedisklayer (diff)
downloadzen-6d07b0437ccb7800652708f76a7ee84e551f43cf.tar.xz
zen-6d07b0437ccb7800652708f76a7ee84e551f43cf.zip
Control overwrite enforcement with a config setting
Diffstat (limited to 'src/zenstore')
-rw-r--r--src/zenstore/cache/cachedisklayer.cpp3
-rw-r--r--src/zenstore/include/zenstore/cache/cachedisklayer.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/zenstore/cache/cachedisklayer.cpp b/src/zenstore/cache/cachedisklayer.cpp
index 54f0c4bfc..d3748e70f 100644
--- a/src/zenstore/cache/cachedisklayer.cpp
+++ b/src/zenstore/cache/cachedisklayer.cpp
@@ -1840,7 +1840,8 @@ ZenCacheDiskLayer::CacheBucket::Put(const IoHash& HashKey,
metrics::RequestStats::Scope $(m_PutOps, Value.Value.Size());
- if (!Overwrite)
+ const bool CheckExisting = m_Configuration.LimitOverwrites && !Overwrite;
+ if (CheckExisting)
{
RwLock::SharedLockScope IndexLock(m_IndexLock);
auto It = m_Index.find(HashKey);
diff --git a/src/zenstore/include/zenstore/cache/cachedisklayer.h b/src/zenstore/include/zenstore/cache/cachedisklayer.h
index 7de707a7f..239b0d1aa 100644
--- a/src/zenstore/include/zenstore/cache/cachedisklayer.h
+++ b/src/zenstore/include/zenstore/cache/cachedisklayer.h
@@ -113,6 +113,7 @@ public:
uint32_t PayloadAlignment = 1u << 4;
uint64_t MemCacheSizeThreshold = 1 * 1024;
uint64_t LargeObjectThreshold = 128 * 1024;
+ bool LimitOverwrites = false;
};
struct Configuration