From c86159f6feba44e4d4838164dbdf4a0dba200f17 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Wed, 18 Nov 2015 21:00:37 -0800 Subject: [PATCH] Revert r13921: Migrate StoreEntry to using MEMPROXY_CLASS This change has been identified as teh trigger for several object caching errors. The real cause is not yet known, but reverting this optimisation avoids it, so is being done for stability. --- src/Store.h | 6 ++---- src/store.cc | 18 ++++++++++++++++++ src/tests/stub_store.cc | 6 ++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Store.h b/src/Store.h index 5442bc9820..47fe985d0d 100644 --- a/src/Store.h +++ b/src/Store.h @@ -50,8 +50,6 @@ enum { SwapFilenMax = 0xFFFFFF }; // keep in sync with StoreEntry::swap_filen */ class StoreEntry : public hash_link { -public: - MEMPROXY_CLASS(StoreEntry); public: static DeferredRead::DeferrableRead DeferReader; @@ -186,6 +184,8 @@ public: return false; }; + void *operator new(size_t byteCount); + void operator delete(void *address); void setReleaseFlag(); #if USE_SQUID_ESI @@ -242,8 +242,6 @@ private: bool hasOneOfEtags(const String &reqETags, const bool allowWeakMatch) const; }; -MEMPROXY_CLASS_INLINE(StoreEntry); - std::ostream &operator <<(std::ostream &os, const StoreEntry &e); /// \ingroup StoreAPI diff --git a/src/store.cc b/src/store.cc index 6f525336c9..8bc452f8e8 100644 --- a/src/store.cc +++ b/src/store.cc @@ -144,6 +144,24 @@ Store::unlink (StoreEntry &anEntry) fatal("Store::unlink on invalid Store\n"); } +void * +StoreEntry::operator new (size_t bytecount) +{ + assert (bytecount == sizeof (StoreEntry)); + + if (!pool) { + pool = memPoolCreate ("StoreEntry", bytecount); + } + + return pool->alloc(); +} + +void +StoreEntry::operator delete (void *address) +{ + pool->freeOne(address); +} + void StoreEntry::makePublic() { diff --git a/src/tests/stub_store.cc b/src/tests/stub_store.cc index 10acd51b3b..3eb734f3bd 100644 --- a/src/tests/stub_store.cc +++ b/src/tests/stub_store.cc @@ -81,6 +81,12 @@ size_t StoreEntry::inUseCount() STUB_RETVAL(0) void StoreEntry::getPublicByRequestMethod(StoreClient * aClient, HttpRequest * request, const HttpRequestMethod& method) STUB void StoreEntry::getPublicByRequest(StoreClient * aClient, HttpRequest * request) STUB void StoreEntry::getPublic(StoreClient * aClient, const char *uri, const HttpRequestMethod& method) STUB +void *StoreEntry::operator new(size_t byteCount) +{ + STUB + return new StoreEntry(); +} +void StoreEntry::operator delete(void *address) STUB void StoreEntry::setReleaseFlag() STUB //#if USE_SQUID_ESI //ESIElement::Pointer StoreEntry::cachedESITree STUB_RETVAL(NULL) -- 2.47.2