diff options
| author | Stefan Boberg <[email protected]> | 2023-10-09 11:42:18 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-10-09 11:42:18 +0200 |
| commit | 38d82c4c6be428b4eef4665766ef4f677915a82b (patch) | |
| tree | fc3c1fcc61e37418365489a3474111c8364f5a27 /src/zenserver/cache/structuredcachestore.cpp | |
| parent | Fixes to shared server config (diff) | |
| download | zen-38d82c4c6be428b4eef4665766ef4f677915a82b.tar.xz zen-38d82c4c6be428b4eef4665766ef4f677915a82b.zip | |
reject bad bucket reads (#456)
* extended bad bucket rejection logic to include GET operations as well as PUTs
Diffstat (limited to 'src/zenserver/cache/structuredcachestore.cpp')
| -rw-r--r-- | src/zenserver/cache/structuredcachestore.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/zenserver/cache/structuredcachestore.cpp b/src/zenserver/cache/structuredcachestore.cpp index f7960f498..fe0b84f33 100644 --- a/src/zenserver/cache/structuredcachestore.cpp +++ b/src/zenserver/cache/structuredcachestore.cpp @@ -416,6 +416,14 @@ ZenCacheStore::Get(const CacheRequestContext& Context, const IoHash& HashKey, ZenCacheValue& OutValue) { + // Ad hoc rejection of known bad usage patterns for DDC bucket names + + if (IsKnownBadBucketName(Bucket)) + { + m_RejectedReadCount++; + return false; + } + ZEN_TRACE_CPU("Z$::Get"); metrics::RequestStats::Scope OpScope(m_GetOps, 0); @@ -470,10 +478,6 @@ ZenCacheStore::Put(const CacheRequestContext& Context, const IoHash& HashKey, const ZenCacheValue& Value) { - ZEN_TRACE_CPU("Z$::Put"); - - metrics::RequestStats::Scope $(m_PutOps, Value.Value.GetSize()); - // Ad hoc rejection of known bad usage patterns for DDC bucket names if (IsKnownBadBucketName(Bucket)) @@ -482,6 +486,10 @@ ZenCacheStore::Put(const CacheRequestContext& Context, return; } + ZEN_TRACE_CPU("Z$::Put"); + + metrics::RequestStats::Scope $(m_PutOps, Value.Value.GetSize()); + if (m_WriteLogEnabled) { ZEN_TRACE_CPU("Z$::Get::WriteLog"); @@ -690,6 +698,7 @@ ZenCacheStore::Stats() .MissCount = m_MissCount, .WriteCount = m_WriteCount, .RejectedWriteCount = m_RejectedWriteCount, + .RejectedReadCount = m_RejectedReadCount, .PutOps = m_PutOps.Snapshot(), .GetOps = m_GetOps.Snapshot()}; IterateNamespaces([&](std::string_view NamespaceName, ZenCacheNamespace& Store) { |