]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Revert r13921: Migrate StoreEntry to using MEMPROXY_CLASS
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 19 Nov 2015 05:00:37 +0000 (21:00 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 19 Nov 2015 05:00:37 +0000 (21:00 -0800)
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
src/store.cc
src/tests/stub_store.cc

index 5442bc98208a74ae81af08beeb97f6f0b0f0335f..47fe985d0d714cf76c77dfb547be829fd6617db3 100644 (file)
@@ -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
index 6f525336c942f5d6bf69b3cdef2ebefab05a9a7f..8bc452f8e880b2fa462781efa7e3b289e07f0916 100644 (file)
@@ -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()
 {
index 10acd51b3bd3f3eff881b537b4b484b867048b00..3eb734f3bdfbf571733092470f699a725dab4f40 100644 (file)
@@ -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)