Callers should really use atomic TTL-preserving implementations
so that calling code works correctly. The old default base class
code did not do either.
Change-Id: Icf66db05e48b86c8d481dc08dc9041bd1fa6dbe9
Also:
* Make the BagOStuff tests actually pass for memcached and sql
* Add more unit tests for BagOStuff
* Make SqlBagOStuff::add() more atomic
Change-Id: Ic1eec0990a66b595b57c646498c3bd229442230c
This should be the "last revision seen" timestamp, which is
different than the "first revision not seen" timestamp in the DB.
Also make sure that SpecialWatchlist accounts for the stash values.
Relatedly, better document the callback usage in BagOStuff::merge().
Change-Id: I98b03a5cd40fec5b4a2633d499ff77079d264e3c
This was inspired by Idbbdb31. Originally, I did a regex search for
code that did string concatenations like `$str = $str . …` and replaced
them all with the .= operator. A duplicate patch was uploaded by another
author. I rebeased this patch on top of the other, which leaves all
the manual optimizations I did.
Change-Id: Iaeb73d9c63302c9409bd1051b91e0d2bd77788a7
This was only there as part of EventRelayer use by WAN cache, which
has since been removed. No other usage really makes sense.
Change-Id: I201425bb88739dd8febbfbc3d24a15e6d3d88d9c
This makes it consistent with set() and merge(). Also, one subclass
was already using the field in this manner.
Clean up the code related to WRITE_SYNC in SqlBagOStuff.
Change-Id: I0fb84f4475311889507d3ef98afd4476fb81174f
Avoid the ADD operation spam from all threads trying to access
a tombstoned key by checking the interim value cache timestamp.
This also avoids the GET/CAS spam from threads that manage to
get the mutex. If a single thread repeatedly accesses the same
tombstoned value in rapid succession, there will significantly
less cache operation spam.
Do the same for cache updates to keys in the holdoff state
due to "check keys" or the "touchedCallback" function.
Relatedly, fix getWithSetCallback() to disregard interim values
set prior to or at the same time as the latest delete() call.
This can slightly reduce the chance of the cache being behind
replica DBs for a second. It also avoids unit test failures
were a series of deletes and cache access happen at the same
timestamp (via time injection or regular system time calls).
In addition:
* Add PASS_BY_REF flag with backwards compatibility to avoid
bloating the signature of get()/getMulti() with the new
tombstone information needed for the above changes.
* Avoid confusing pass-by-reference in getInterimValue() and
fix use of incorrect $asOf parameter.
* Move some more logic into setInterimValue().
* Update some comments regarding broadcasted operations that
were not true for the currently assumed mcrouter setup.
* Rename $cValue => $curValue and $versioned => $needsVersion
for better readability.
Bug: T203786
Change-Id: I0eb3f9b697193d39a70dd3c0967311ad7e194f20
Instead, make the "high read lag with lockTSE" case just lower FLD_TTL.
This also avoids constant regenerations by threads getting the mutex.
Added logging for TTL adjustments in set() for the lockTSE case.
Also remove some delete() calls from tests that were not needed.
Change-Id: Id7695f0377235e4a2f6e0efc88e870c8a990c3b0
* Make the SET_DELAY_HIGH_SEC check more sensitive to other types
of delay, such as increased get() latency. Any such slowness is
relevant to the set() stampede concern.
* Also added a statsd timing metric for this delay.
Change-Id: I053a73b40dc7e566cc59fc97aeab1a4e1bee0f28
Follow-up to 70bf85d462 which only affected the case of tombstoned keys.
Improve documentation about getWithSetCallback() options.
Bug: T203786
Change-Id: I683a38f65a79cb98a4ae71cbc5dd88aefe48d022
* Remove 'channels' field references from config/setup
* Remove 'relayer'/'channels' field reference in unit tests
* Remove unused DEFAULT_PURGE_CHANNEL class constant
* Also remove long-since bogus 'pool' field references
Follow-up to 4753b0a4ed
Change-Id: If6670ff4e1dccc8ae253a08b46d205601da10024
The use of that class for WAN cache by third parties is extremely unlikely
and the approach was abandoned at WMF in favor of mcrouter (dynomite was
also considered preferable).
Change-Id: I328eb74f21c23db80acc5178bc3c9cf9f823da13
* Move $value === false checks to isValid()
* Rename $isTombstone variable to avoid confusion with the new value
* Reorganize conditionals around set() calls in doGetWithSetCallback()
* Skip getInterimValue() check when there is no reason to assume anything
might even be there (e.g. the key is not tombstoned)
* Fold the tombstone case for $useMutex into the ternary
Change-Id: I257110097cffe7fe87c6a9896e875f09d5c936d9
This largely follows-up 6b2f13b055.
* Make the comments and use of temporary variables easier to follow.
* Simplified some conditionals by remove redundant checks.
* Bypass the final set() call if $isTombstone is true. It will almost
always be rejected due to the tombstone still being there anyway, so
there is no point in the roundtrips. Also, the most likely case where
it would succeed is due to the callback taking a long time to run, in
which case data from the replication lag uncertainty period that the
tombstone represents would be getting saved to cache with the full
nominal TTL, which is wrong.
Change-Id: Ic28e15b24f39e128bd72ad4d905edb852bc907aa
This is useful when the timestamps to be checked depend on the value or are stored
in the database rather than as check keys.
Change-Id: I81ab08a943ee7d2f96a132d371965501941ed37f
WinCache incr function adds a number to the value of a key, but
in the process loses the Time To Live of the cache entry. This
fixes such bug.
Bug: T211914
Change-Id: I02889e63b95188b8d5123a9788a020ca3aa7d1b1
Adds MD5 hashing to the generation of keys for WinCache. This
fixes the issue of keys (e.g. sub-headings) longer than 150
characters.
Bug: T210794
Change-Id: Ieabf6b014a0660198077a23760a05564bf268535
Also add headings to separate docs for deployment/administration,
from docs for developers using an existing instance of it.
Change-Id: Id43c7700564c2979549afa5379f644027fb6585b