Commit graph

405 commits

Author SHA1 Message Date
jenkins-bot
dde86b29c8 Merge "objectcache: replace debugLog() calls with faster debug() calls in MemcachedPeclBagOStuff" 2019-04-29 20:02:56 +00:00
Aaron Schulz
0394cb757a objectcache: micro-optimize determineKeyClassForStats() by using the limit option to explode()
Change-Id: I7d95998487dd18078599b16201c9d0ec0debcb0b
2019-04-26 21:40:53 -07:00
Aaron Schulz
cf45621913 objectcache: replace debugLog() calls with faster debug() calls in MemcachedPeclBagOStuff
Change-Id: Iefe29d43f2bc8efa8288b4625d20bd803f35bbfe
2019-04-26 21:10:05 -07:00
Daimona Eaytoy
7dc4f6c832 Cache: Make APCUBagOStuff::set return a useful value
It took me lots of time to debug a CI failure in
I9b3bc36b552901bc6ca7609ee51e80be2979a9c4. I was deceived by
$cache->set returning true, which according to the docs means that the
store was successful. But instead, this function just returns true, even
in case of failure. Make it return the result of apcu_store, which is
already in the format true = success, false = failure.

Change-Id: I2619845c12460e1acb5af696d2c11a5a4dee1bd3
2019-04-14 19:13:48 +02:00
Kunal Mehta
02b18ba4cd Fix/suppress phan errors related to arrays (#11)
Change-Id: Ie5c05fbc88c51d493bc1462005d2f8dde5f72101
2019-04-07 16:27:02 +00:00
Kunal Mehta
4ef179e335 Fix/suppress misc phan errors (#5)
Add lots of missing return statements, or remove incorrect doc blocks.

Change-Id: I0881e98fbb9d0d4cf79ecc824064d24538055d3f
2019-04-05 15:53:37 -07:00
Reedy
c13fee87d4 Collapse some nested if statements
Change-Id: I9a97325d738d09370d29d35d5254bc0dadc57ff4
2019-04-04 19:02:22 +00:00
Aaron Schulz
3192278eb2 objectcache: remove messy inheritence from APCBagOStuff in APCUBagOStuff
Also make sure they always use PHP serialization to avoid CAS token problems
and bugs in the custom pecl extension serializers.

Change-Id: I43cef97ca4ac0f0cc21b65ba73d1887ed92e157f
2019-03-28 19:38:13 -07:00
jenkins-bot
64af8883de Merge "objectcache: remove some unneeded code from BagOStuff::mergeViaCas" 2019-03-28 17:57:46 +00:00
jenkins-bot
82dd328edc Merge "objectcache: rename SET_DELAY_HIGH_SEC => SET_DELAY_HIGH_MS and lower it" 2019-03-28 17:56:14 +00:00
Aaron Schulz
5fb382d18a objectcache: rename SET_DELAY_HIGH_SEC => SET_DELAY_HIGH_MS and lower it
Change-Id: I92a1e9a713f60288eb02bdea4881d104bdf7d0f5
2019-03-28 04:00:18 -07:00
Aaron Schulz
35af086e57 objectcache: make WANObjectCache prefer ADD over GET/CAS for misses
This avoids an extra cache query and also avoids I/O if another thread
already saved the value in the meantime, bloating the GET response.

Bug: T203786
Change-Id: I05539873f55d3254e2b9ecad0df158db1e6a1a1a
2019-03-28 09:42:55 +00:00
Aaron Schulz
62b8db6ea5 objectcache: remove some unneeded code from BagOStuff::mergeViaCas
Change-Id: Ib92090fe4e1b1eb2c4f9e031f8476b24189392c8
2019-03-27 19:33:07 -07:00
jenkins-bot
a9ffa5a687 Merge "objectcache: fix changeTTL() in RedisBagOStuff for edge cases" 2019-03-28 00:43:22 +00:00
jenkins-bot
94f70057cc Merge "objectcache: improve "version" documentation for WANObjectCache::getWithSetCallback()" 2019-03-28 00:11:46 +00:00
Aaron Schulz
dd3f360de8 objectcache: fix changeTTL() in RedisBagOStuff for edge cases
Change-Id: I2bb4bf843c8de8cefaf4188a8866ae51a28bbf71
2019-03-28 00:05:17 +00:00
Aaron Schulz
e7bf319882 objectcache: improve "version" documentation for WANObjectCache::getWithSetCallback()
Change-Id: Ia48f21945e6da7f2d7892677d559718f824b62c1
2019-03-27 14:39:26 -07:00
Aaron Schulz
962495b17a objectcache: merge getWithToken() into doGet() for simplicity
Change-Id: I581f866521e1086ca350973d9cdeff6656f48fe8
2019-03-27 13:03:25 -07:00
jenkins-bot
963f1c560c Merge "objectcache: remove redundant merge() definitions" 2019-03-27 18:34:47 +00:00
Aaron Schulz
f00df01316 objectcache: remove redundant merge() definitions
Change-Id: Ide24dd395b300f8d747b2be307dbbad08f6b221d
2019-03-27 18:13:40 +00:00
Aaron Schulz
25fd7dbc7b objectcache: defined some missing methods in MultiWriteBagOStuff
Also, reorder some method definitions to match the base class.
This makes it easier to compare the two. In addition, refactor
the doWrite() method to make the calls clearer.

Change-Id: I795b395b9c54645f62962461a28067ae38b291ed
2019-03-27 17:26:43 +00:00
Aaron Schulz
5b218daeef objectcache: define some missing methods in ReplicatedBagOStuff
Also reorder methods to match the base class so it is easier
to compare the classes and see which methods should be defined.

Change-Id: I2b8c2cd63822ce49efd9b4b7e44bde92032b5a98
2019-03-26 19:41:11 -07:00
jenkins-bot
9e9ec488d1 Merge "objectcache: minor refactoring to BagOStuff" 2019-03-26 22:47:55 +00:00
Aaron Schulz
d5afd5f909 objectcache: minor refactoring to BagOStuff
Split up expiry functions and moved add() near other primitive writes.

Change-Id: I97bb91e648b797b1ab5a6934d212689b1e67f7c6
2019-03-26 15:14:42 -07:00
Aaron Schulz
fce8f37378 objectcache: improve comments for ATTR_/QOS_ constants
Change-Id: Iaa5361a09e1dc559fee8eb034c9c05bc999c776e
2019-03-26 12:18:22 -07:00
Aaron Schulz
e626d014ac objectcache: remove BagOStuff::mergeViaLock() and update RESTBagOStuff
All subclasses are now using the CAS variant, which respects $attempts.

Change-Id: Ia7ec6a7f3337cabe95c54c1142c3c5464c1794e7
2019-03-24 00:35:23 -07:00
addshore
8fc39d3c38 Fix WANObjectCache typo in phpdoc
Change-Id: I6b9d68bc4832fe71217d5c0ef66bebdfa9b459ce
2019-03-22 11:25:11 +01:00
jenkins-bot
a34f57387d Merge "objectcache: convert APC and hash BagOStuff to using mergeViaCas()" 2019-03-21 23:55:30 +00:00
jenkins-bot
57cb9aa21c Merge "objectcache: optimize merge()/incr() for WinCacheBagOStuff" 2019-03-21 23:55:20 +00:00
Aaron Schulz
6812712bd6 objectcache: convert APC and hash BagOStuff to using mergeViaCas()
This way, the $attempts parameter to merge() is respected and locks
are not held while possibly slow callbacks might run.

Also renamed confusingly named serialization functions in HashBagOStuff.

Change-Id: Id031d82e0a7c941936f04d2cdf590a6296777cf8
2019-03-20 13:58:10 -07:00
Aaron Schulz
8c92400909 objectcache: optimize merge()/incr() for WinCacheBagOStuff
Do not hold WinCache locks during merge() callbacks, as that
could be seconds of being blocked (and some callers do not
expect indefinite blocking). Make merge() use the CAS method
which only uses wincache_lock() after callback runs in very
tight getWithToken()/set() cycle.

Make incr() use wincache_lock() since it also is very tight
doGet()/set() cycle with negligable work in between.

Change-Id: I0dde6f62c7e3d4a802470c181570ad4353d0e6ea
2019-03-20 20:02:18 +00:00
Aaron Schulz
c2150cdc3c objectcache: make BagOStuff::changeTTL() more atomic
Change-Id: I86493498ef3359046b12d51795cf7875af6c3a6c
2019-03-20 09:46:33 -07:00
Aaron Schulz
560774814d Make BagOStuff::incr abstract to discourage bad implementations
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
2019-03-18 16:09:26 -07:00
jenkins-bot
4d1478c76f Merge "Fix WatchedItemStore last-seen stashing logic" 2019-03-15 21:46:07 +00:00
Aaron Schulz
6612673b20 objectcache: make BagOStuff::add() abstract to discourage non-atomic versions
Change-Id: If3c3fbf21207b0c74cad8a29fa5bbabe0af896e3
2019-03-15 00:38:28 +00:00
Aaron Schulz
fea9ebbd6f objectcache: make the BagOStuff::add() operation more atomic for WinCache
Change-Id: I285ed9a7d0894adfe29b0bdc106b7518f655ba45
2019-03-15 00:38:18 +00:00
Aaron Schulz
1899a82c80 objectcache: make the BagOStuff::add() operation more atomic for APC
Change-Id: Ifb72b1c17439c80e6d431d5fe2ec9ad9437e3ad7
2019-03-15 00:38:11 +00:00
Aaron Schulz
e2b03d5d30 objectcache: add BagOStuff::deleteMulti() method for consistency
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
2019-03-14 23:12:30 +00:00
Aaron Schulz
588a464682 Fix WatchedItemStore last-seen stashing logic
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
2019-03-14 14:52:29 -07:00
Aaron Schulz
547f207fa6 objectcache: make the $flags argument appear more consistently in BagOStuff
Change-Id: I08879ede5e9f0ab227497bb1dab89ea61b65abce
2019-03-12 22:55:18 +00:00
jenkins-bot
501ca07005 Merge "Streamline code involving .= string concatenations" 2019-03-11 12:39:04 +00:00
Thiemo Kreuz
cfda5e7efa Streamline code involving .= string concatenations
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
2019-03-11 12:43:45 +01:00
jenkins-bot
7139a95efb Merge "objectcache: Use constant for $ttl param default in WANObjectCache::set()" 2019-03-09 00:15:00 +00:00
Andrew Green
b9568e64d9 objectcache: Use constant for $ttl param default in WANObjectCache::set()
Change-Id: I3f936088cd63af4d535d7f46fe5619e8bb866999
2019-03-08 23:48:22 +00:00
jenkins-bot
0d5da03a15 Merge "objectcache: add metrics for WAN cache deletes and check key touches/resets" 2019-03-08 21:40:12 +00:00
jenkins-bot
dbe54b46e6 Merge "objectcache: move ERR_* constants to IExpiringStore" 2019-03-08 21:40:04 +00:00
Aaron Schulz
9fe2e8eb7e objectcache: remove BagOStuff::modifySimpleRelayEvent()
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
2019-03-08 13:17:26 -08:00
Aaron Schulz
74be3a0150 objectcache: move ERR_* constants to IExpiringStore
Also removed unused ERR_* constant from WANObjectCache and fixed
comment in the constructor.

Change-Id: I4377fc3f533113a459b648fad084ba097ff51762
2019-03-08 13:12:01 -08:00
jenkins-bot
db1f41172f Merge "objectcache: add $flags argument to BagOStuff::delete()" 2019-03-08 00:51:25 +00:00
jenkins-bot
a8caf02564 Merge "objectcache: fix comment typo for addBusyCallback()" 2019-03-07 23:58:51 +00:00