]> git.ipfire.org Git - thirdparty/squid.git/commit - src/StoreHashIndex.h
Allow a ufs cache_dir entry to coexist with a shared memory cache entry
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 16 Oct 2012 00:18:09 +0000 (18:18 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 16 Oct 2012 00:18:09 +0000 (18:18 -0600)
commit54347cbdf50fe061d185e02da76a36fad2a3a48a
treeac9917ec0b0a66605c2af84e84178f025a4a40e8
parent32589ac7fb6fa34b223b76285d8de0410f1c8159
Allow a ufs cache_dir entry to coexist with a shared memory cache entry
instead of being released when it becomes idle.

The original boolean version of the StoreController::dereference() code
(r11730) was written to make sure that idle unlocked local store_table entries
are released if nobody needs them (to avoid creating inconsistencies with
shared caches that could be modified in a different process).

Then, in r11786, we realized that the original code was destroying non-shared
memory cache entries if there were no cache_dirs to vote for keeping them in
store_table. I fixed that by changing the StoreController::dereference() logic
from "remove if nobody needs it" to "remove if somebody objects to keeping
it". That solved the problem at hand, but prohibited an entry to exist in
a non-shared cache_dir and in a shared memory cache at the same time.

We now go back to the original "remove if nobody needs it" design but also
give non-shared memory cache a vote so that it can protect idle but suitable
for memory cache entries from being released if there are no cache_dirs to
vote for them.

This is a second revision of the fix. The first one (r12231) was reverted
because it did not pass tests/testRock unit tests on some platforms. The unit
tests assume that the entry slot is not locked after the entry is stored, but
the first revision of the fix allowed idle entries to remain in store_table
and, hence, their slots were locked and could not be replaced, causing
assertions.  This revision allows the idle entry to be destroyed (and its slot
unlocked) if [non-shared] memory caching is disabled.

It is not clear why only some of the platforms were affected by this. Should
not memory caching be disabled everywhere during testRock (because testRock
does not set memory cache capacity and memory cache entry size limits)?
14 files changed:
src/MemStore.cc
src/MemStore.h
src/Store.h
src/StoreHashIndex.h
src/SwapDir.cc
src/SwapDir.h
src/fs/rock/RockSwapDir.cc
src/fs/rock/RockSwapDir.h
src/fs/ufs/RebuildState.cc
src/fs/ufs/UFSSwapDir.cc
src/fs/ufs/UFSSwapDir.h
src/store_dir.cc
src/tests/stub_MemStore.cc
src/tests/testStore.h