]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Revert r14303: Migrate StoreEntry to using MEMPROXY_CLASS
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 19 Feb 2016 15:06:42 +0000 (04:06 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 19 Feb 2016 15:06:42 +0000 (04:06 +1300)
This change has been identified as the 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.

This resolves bugs 4370 and maybe also 4354 and 4355

src/Store.h
src/store.cc
src/tests/stub_store.cc

index b20848ea2c8ad2b2c31b026dee90900483315764..4f1aff44bf2f1e6933c4cac9e62c75ad67141b80 100644 (file)
@@ -40,7 +40,6 @@ extern StoreIoStats store_io_stats;
 
 class StoreEntry : public hash_link, public Packable
 {
-    MEMPROXY_CLASS(StoreEntry);
 
 public:
     static DeferredRead::DeferrableRead DeferReader;
@@ -174,6 +173,8 @@ public:
         return false;
     };
 
+    void *operator new(size_t byteCount);
+    void operator delete(void *address);
     void setReleaseFlag();
 #if USE_SQUID_ESI
 
index 834516c443a6d28d959a21083b2fe48546de6f84..aff4dfe81236581b0ff15e1751dbf04f9ca4f5b0 100644 (file)
@@ -119,6 +119,26 @@ Store::Stats(StoreEntry * output)
     Root().stat(*output);
 }
 
+// XXX: new/delete operators need to be replaced with MEMPROXY_CLASS
+// definitions but doing so exposes bug 4370, and maybe 4354 and 4355
+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 7daa3c51f2420cd2c7e79b883b4241fd25d0b5f4..ee4c891b214951a9cef5137fa7abb7043167e235 100644 (file)
@@ -76,6 +76,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)