[PATCH] Do not release entries that should be kept in local memory cache.

From: Dmitry Kurochkin <dmitry.kurochkin_at_measurement-factory.com>
Date: Thu, 05 Jul 2012 05:31:44 +0400

Hi all.

Local memory caching does not work in recent Squid trunk. The patch
attempts to fix that.

Since r11969, Squid calls trimMemory() for all entries, including
non-swappable, to release unused MemObjects memory. But it should not
release objects that are or should be stored in local memory cache.
StoreEntry::trimMemory() has a check for IN_MEMORY status for that.
But IN_MEMORY status is set too late in
StoreController::handleIdleEntry(), after trimMemory() marks entry for
release:

  clientReplyContext::removeStoreReference()

    storeUnregister()
      StoreEntry::swapOut()
        StoreEntry::trimMemory()
          StoreEntry::releaseRequest()

    StoreEntry::unlock()
      StoreController::handleIdleEntry() // never get here because entry is
        set IN_MEMORY status // already marked for release

The patch adds StoreEntry::keepInLocalMemory() method to check if an
entry should be stored in local memory cache. If it is true, do not
release entry in trimMemory().

Regards,
  Dmitry

Received on Thu Jul 05 2012 - 01:34:17 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 06 2012 - 12:00:03 MDT