Commit graph

220 commits

Author SHA1 Message Date
Aaron Schulz
cbff84a5b9 Add missing ampersand to getMultiWithSetCallback() callback
Also fixed a php example block comment

Change-Id: Ib6967180ad0d45aec7b7d4b6d383723e2c95fefa
2017-05-25 03:40:26 -07:00
Aaron Schulz
1180a859ba Avoid treating mcrouter set()s as failing due to AllAsyncRoute
Per https://github.com/facebook/mcrouter/wiki/List-of-Route-Handles
a NullRoute response is always given for DELETE and SET. The former
already is already handled by MediaWiki treating NOT_FOUND as success.

Change-Id: I79c26bcd6b8ffe7eea73e0d45badcc4ed63f05e6
2017-05-24 10:50:09 -07:00
Timo Tijhof
8e81621dcf objectcache: Complete code coverage for CachedBagOStuff
Change-Id: I8a228d68701f1ad4d37f60de53d105c32898dc8b
2017-04-07 23:31:41 +00:00
Timo Tijhof
a116bc58b5 objectcache: Fix CachedBagOStuff to use backend makeKey()
Follows-up 25dbd91513.

Change-Id: Ib727c57cb27f05c0462bfdfee89a185ef6603ddd
2017-04-07 23:31:25 +00:00
Timo Tijhof
50a035cd6b Clean up get_class($this) -> static::class in /includes/cache and /includes/libs
* get_class()        -> __CLASS__ (same as self::class)
* get_called_class() -> static::class
* get_class($this)   -> static::class

Change-Id: I22c62851bcc88405f4bdd77258d6e28ec1a14924
2017-03-07 21:06:06 +00:00
Aaron Schulz
d46d8bb58d Add dynomite comments to WANObjectCache
Change-Id: I7ac9961e6acdecf90b766643138bb64b5ea9ec4a
2017-03-04 11:31:11 -08:00
jenkins-bot
aa3319c4c0 Merge "Miscellaneous indentation tweaks" 2017-02-28 18:38:36 +00:00
Bartosz Dziewoński
ecdef925bb Miscellaneous indentation tweaks
I was bored. What? Don't look at me that way.

I mostly targetted mixed tabs and spaces, but others were not spared.
Note that some of the whitespace changes are inside HTML output,
extended regexps or SQL snippets.

Change-Id: Ie206cc946459f6befcfc2d520e35ad3ea3c0f1e0
2017-02-27 19:23:54 +01:00
James D. Forrester
b715f432f4 includes/libs: Replace implicit Bugzilla bug numbers with Phab ones
It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345"
except where it doesn't, so let's just standardise on the real numbers.

Skipping jsminplus.php as those bug numbers aren't Wikimedia's, nor obviously
someone else's.

Change-Id: I9a2210e17852ee56f11282b980ac66d8c7a95671
2017-02-21 18:13:08 +00:00
Aaron Schulz
8c0400c9ba objectcache: Avoid using deprecated ScopedCallback alias
Change-Id: Ica8a066c3f28adc710ee11919c07dd188144beb5
2017-01-31 00:53:31 +00:00
Aaron Schulz
2e5eb693de objectcache: add WANObjectCacheReaper for assuring purges
* This fixes keys based on some sort of change log.
  Updates are wrapped in a mutex and keep track of the
  last known good position.
* Make WANObjectReapUpdate class that cleans up title
  related keys using the recentchanges table. This triggers
  as a deferred updates on RC view.

Change-Id: I7f14b9ca2533032147e62b1a3cc004a23da86579
2017-01-27 02:21:06 +00:00
jenkins-bot
2116f0926b Merge "Reduce WAN object cache logging spam for reject set() calls" 2017-01-10 22:00:13 +00:00
jenkins-bot
8b3265736f Merge "Add an refresh probability comment to worthRefreshPopular()" 2017-01-10 21:42:09 +00:00
Aaron Schulz
8972104ba2 Reduce WAN object cache logging spam for reject set() calls
Change-Id: I276c91b3b3b47d337f9c1d91a8348ca8f3d57194
2017-01-10 13:20:02 -08:00
Aaron Schulz
b0e0f6e3b3 Add an refresh probability comment to worthRefreshPopular()
Change-Id: Ia6717881c7d5c19481c87ade5972c0ff641d6e11
2017-01-07 19:00:00 -08:00
Aaron Schulz
02d6133fd8 Avoid IDEA warning about $keys being both a parameter and loop variable
Change-Id: Id562053a71f135fa863cb88b5f081982c01575cf
2017-01-07 16:10:23 -08:00
Aaron Schulz
343f94f1fe objectcache: Remove broken apcu_set() calls
The method call was misnamed (should be apcu_store) and not needed anyway,
since the other BagOStuff classes fail if no key is present.

Change-Id: I726965e665c2d0c5843d8dd33504810d130b9e98
2016-12-06 15:39:42 +00:00
Hashar
4d487d1942 Revert "objectcache: detect default getWithSetCallback() set options"
Causes HHVM 3.12.7 to segfault and or:
Fatal error: Stack overflow in includes/libs/objectcache/BagOStuff.php on line 754

This reverts commit b47ce21cec.

Bug: T150833
Change-Id: Ia52fdf65f5e386c0eaa1046328680fb5c8a9081a
2016-11-16 10:35:27 +00:00
jenkins-bot
32f3a99575 Merge "objectcache: Remove broken cas() method from WinCacheBagOStuff" 2016-11-16 05:12:26 +00:00
Aaron Schulz
d1b53e32c7 objectcache: Remove broken cas() method from WinCacheBagOStuff
Bug: T120896
Change-Id: I9406a50df8e900b4fc5861c2174ba7a63a0dd765
2016-11-16 05:02:37 +00:00
Aaron Schulz
b47ce21cec objectcache: detect default getWithSetCallback() set options
This works by setting a callback to return the cache set
options. The callback will watch DB reads and create a
merged result from said usage.

This handles callers that are missing getCacheSetOptions().

Change-Id: Ia264f011e45e8cf105480955dad7e2c4c2357b73
2016-11-16 04:53:53 +00:00
Aaron Schulz
43ff2a83b5 objectcache: avoid using process cache in nested callbacks
Because the process cache can be lagged by virtue of blind TTL,
the HOLDOFF_TTL might not be enough to account for it, so avoid
using it when already inside a callback.

Also split of the tests from the MediaWiki test class, so this
does not require DB access anymore.

Change-Id: I743a1233a5efc7f036fad140a9ff8a30b32f8f27
2016-10-20 22:13:29 +00:00
Kunal Mehta
61adc1e146 Use namespaced ScopedCallback
The un-namespaced \ScopedCallback is deprecated.

Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4
2016-10-17 15:46:05 -07:00
Aaron Schulz
fdce245e9f objectcache: use a default "since" timestamp in getWithSetCallback()
* Renamed mDoneWrites to be clearer at what type it is.
* Also cleaned up a few callers of this method

Change-Id: I45856b210c289c2e2f193cc4328a208e20b4e0a8
2016-10-14 23:31:09 +00:00
Aaron Schulz
ec0b9d55c3 Fix WANObjectCache doc typo
Change-Id: I74ef6598d86bdf43ae35f776878cfbb8e9695907
2016-10-13 01:15:12 -07:00
Aaron Schulz
24200e88d2 objectcache: add WANObjectCache::getMultiWithSetCallback()
This does what it says on the tin, e.g. a way to fetch
multiple keys at once. Callbacks are still called in a
serial manner when needed.

Change-Id: I8e24a6de7f46499a53ec41636c5a4f106b9b3d09
2016-10-05 15:50:18 +00:00
Reedy
c214c9a952 Detect/use APCu properly
In PHP 5.5 and above, userland APC caching moved to an extension

Bug: T140587
Change-Id: Ie0871776cd7e67838471a4fe95451cf4164079b7
2016-10-01 23:07:47 +01:00
Kunal Mehta
090d0267da Use wikimedia/wait-condition-loop
Since the WaitConditionLoop class was first introduced in 1.28 (current
master), no back-compat alias is added.

Bug: T146256
Depends-On: Ia84774d83da79fea1e167fe065c69549981f753b
Change-Id: Ibd4f15c87105b8caccbd1f661b74b6efa012b77f
2016-10-01 00:25:43 -07:00
Aaron Schulz
a2dd3480da Cleanup MemcLockManager and move it to /libs
* Remove wf* function and ObjectCache dependencies.
* Use the base class session field.
* Lower physical lock structure TTL and move it to the base
  class as a constant.
* Resolve TODO about acquiring mixed lock types in one pass.
* Only mark servers down for 30 seconds in case of long-running
  scripts.

Change-Id: Icd4be407e599524cc620975d27e85666d2532b95
2016-09-30 06:33:32 -07:00
Aaron Schulz
8729167f13 Move RedisBagOStuff to /libs
Change-Id: Ia49fb044aacb44e53d36c80277783cd806aca439
2016-09-23 20:13:36 -07:00
Kunal Mehta
d2fd3109a3 Avoid Wikimedia\Assert in HashBagOStuff
This is the only usage of wikimedia/assert in the planned objectcache
library, so it doesn't make much sense to have a dependency upon the
entire library just for one usage that is trivially replaced.

Change-Id: I8f967fb2b861852c7fc74f7d42e2cbab1df05bc4
2016-09-20 23:00:54 -07:00
Aaron Schulz
faac856f21 Fix broken wincache merge() implementation
Bug: T145664
Change-Id: I2f841779108df281e24003c586775b71aa176909
2016-09-15 04:50:25 -07:00
jenkins-bot
d9f412635f Merge "Move PECL memcached class to /libs" 2016-09-14 01:45:02 +00:00
Aaron Schulz
a3dacac90f Support masking the WRITE_SYNC latency from ChronologyProtector
* Use OutputPage::output() as the method to mask latency, since it
  takes a good while to run. By the time it runs, cache replication
  should have caught up, so the reap call will likely not block.
* For redirects emitted after changes in POST, instead of masking
  with OutputPage, add a parameter to the redirect and block on
  the positions appearing. This uses the redirection RTT to mask
  the replication latency.

Change-Id: Ib23690c302e8033610fef9a0ef451dafe8a5803e
2016-09-12 23:58:49 +00:00
Aaron Schulz
ad0f205feb Add more version notes to WANObjectCache
Change-Id: Ia1b74b568d2b5137c7096a3b4549ac2cd4c7fa93
2016-09-09 13:41:03 -07:00
Aaron Schulz
843c112884 objectcache: add "staleTTL" option to WANObjectCache::set()
Change-Id: Ib9386a8ad4ab98d07d0a3784e3afffeeca9bbd6e
2016-09-09 01:05:55 -07:00
Aaron Schulz
55b4d2f620 Cleanup and re-indent some WANObjectCache docs
Change-Id: Ibf7092297ce53fd21e478a6f87a16f9b4373ad85
2016-09-09 00:57:57 -07:00
jenkins-bot
945b8ee0d4 Merge "Switch some callers to WaitConditionLoop" 2016-09-09 02:57:13 +00:00
Aaron Schulz
d32b64235f Switch some callers to WaitConditionLoop
Also fixed up backwards documentation

Change-Id: I00c36aa751a79ca86a754e049a6da78cbb417b81
2016-09-08 19:29:18 -07:00
Aaron Schulz
6d1d6c90f1 objectcache: expose "minTime" in WAN cache and call it "minAsOf" instead
Change-Id: Iabb639dddb9458d961dbbaee6a0dfb2323c2739a
2016-09-08 13:42:17 -07:00
Aaron Schulz
8db4c163e8 objectcache: pass in the $oldValue as-of time in getWithSetCallback()
This lets callers use adaptive TTLs on the near-expiration
preemptive refreshes if the new and current values match,
using the as-of time as $mtime.

Change-Id: Ie541c35f890c9f789d1accf9f2a43506daaf31f0
2016-09-08 18:36:25 +00:00
Aaron Schulz
05589cad6b Move PECL memcached class to /libs
Remove IP class dependency, which is simple enough here

Change-Id: I3aed6ae6747d8d2b9e75b492e5d5293ba4ce9edd
2016-09-07 22:55:11 -07:00
Aaron Schulz
b9f4168b56 objectcache: Avoid doxygen misformatting for pcGroup comments
Change-Id: I970bc9ccb04b046c563a357d87f814da652e23d2
2016-09-08 01:22:31 +00:00
Aaron Schulz
5316e7d700 objectcache: add "pcGroup" option to WANObjectCache::getWithSetCallback()
This lets callers have their own process cache but keep it
managed in a central location, making it easier to reset
when DB transaction snapshot are flushed or when unit tests
want to clear caches between runs.

Use this to replace the Revision text process cache.

Change-Id: Ic61ee9140d4ce9836cc4650adb5bb75a291fea18
2016-09-07 16:35:15 -07:00
James D. Forrester
960e4d09ca Documentation: Replace misuse of 'later' when we meant 'latter'
Change-Id: I01bfdb8e0bfaa132533732873f7c840cea7935eb
2016-09-07 13:13:42 -07:00
Aaron Schulz
3348200473 Make adaptiveTTL() less strict about $mtime type
Callers using wfTimestamp( TS_UNIX, ... ) where getting $minTTL
due to the output being a string number.

Change-Id: I6b67a941940f40ef9a543f11d0dbccacafaaa53b
2016-09-07 09:18:37 -07:00
jenkins-bot
c118951f57 Merge "objectcache: add "hotTTR" and "ageNew" options to getWithSetCallback()" 2016-09-07 07:04:59 +00:00
Aaron Schulz
afcc7d772b objectcache: add "hotTTR" and "ageNew" options to getWithSetCallback()
These control worthRefreshPopular(), which will try to make sure that
heavily used keys are kept more consistent than others.

Change-Id: I2d351b50462a96d0fa8ca8fa6d28d51d3a5c94ff
2016-09-07 06:40:43 +00:00
Aaron Schulz
58038b2621 Turn off "reportDupes" in CachedBagOStuff
Change-Id: I79148be842a940c92e555e10b24c32cdf7609539
2016-09-06 13:36:16 -07:00
jenkins-bot
00ac2882bb Merge "Turn off duplicate key gets for ReplicatedBagOStuff" 2016-09-06 18:18:07 +00:00