]> git.ipfire.org Git - thirdparty/squid.git/commit - src/Transients.cc
Tightened StoreEntry locking. Fixed entry touching and synchronization code:
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 27 Jun 2013 21:26:57 +0000 (15:26 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 27 Jun 2013 21:26:57 +0000 (15:26 -0600)
commit1bfe9adea57c6187029a014f0fa5c77ac39d74aa
tree4ea600f94de56278c63e2e0b4b8e1e82ab4faca2
parentf54986adf0906890917175e2558ec1d37e176199
Tightened StoreEntry locking. Fixed entry touching and synchronization code:

Tightened StoreEntry locking code to use accessors instead of manipulating the
locking counter directly. Helps with locking bugs detection. Do not consider
STORE_PENDING and SWAPOUT_WRITING entries locked by default because it is
confusing and might even leave zero lock_count but locked() entries in the
global table. Entry users should lock them instead.

StoreController::get() is now the only place where we touch() a store entry.
We used to touch entries every time they were locked, which possibly did not
touch some entries often enough (e.g. during Vary mismatches and such where
the get() entry is discarded) and definitely touched some entries too often
(every time the entry was locked multiple times during the same master
transaction). This addresses a design bug marked RBC 20050104.

Fixed interpretation of IN_MEMORY status. The status means that the store
entry was, at some point, fully loaded into memory. And since we prohibit
trimming of IN_MEMORY entries, it should still be fully loaded. Collapsing
changes started to use IN_MEMORY for partially loaded entries, which helps
detecting entries associated with the [shared] memory cache, but goes against
old Squid code assumptions, triggering assertions.

Handle synchronization of entries the worker is writing. Normally, the writing
worker will not receive synchronization notifications (it will send them) but
a stale notification is possible and should not lead to asserts.  The worker
writing an entry will see a false mem_obj->smpCollapsed.

Do not re-anchor entries that were already anchored, fully loaded (ioDone),
and are now disassociated from the [shared] memory cache.

For shared caching to work reliably, StoreEntry::setReleaseFlag() should mark
cache entries for future release. We should not wait for release() time.
Waiting creates stuck entries because Squid sometimes changes the key from
public to private and collapsed forwarding broadcasts are incapable of
tracking such key changes (but they are capable of detecting entries abandoned
by their writers via the deletion mark in the transients table).

Polished debugging.
31 files changed:
src/MemStore.cc
src/MemStore.h
src/Server.cc
src/Store.h
src/StoreEntryStream.h
src/StoreSwapLogData.h
src/SwapDir.h
src/Transients.cc
src/Transients.h
src/acl/Asn.cc
src/client_side_reply.cc
src/client_side_request.cc
src/errorpage.cc
src/forward.cc
src/fs/rock/RockSwapDir.cc
src/fs/rock/RockSwapDir.h
src/fs/ufs/UFSSwapDir.cc
src/ftp.cc
src/gopher.cc
src/mgr/Forwarder.cc
src/neighbors.cc
src/peer_select.cc
src/ssl/ServerBump.cc
src/stat.cc
src/store.cc
src/store_client.cc
src/store_dir.cc
src/store_rebuild.cc
src/store_swapout.cc
src/urn.cc
src/whois.cc