Commit graph

190 commits

Author SHA1 Message Date
Jakub Vrana
45435d05a5 Change typehint callback to callable
Found by PHPStan.

Change-Id: I09f21da69ad9b9357cee85a47717dbe1bca04070
2018-12-01 10:10:41 +01:00
Aaron Schulz
d2c2bf6553 objectcache: avoid using heavily time-drifted microtime() values in WAN cache
Change-Id: Ifcb9e4b4a1d5adfdaaa6ea505e34956516b871de
2018-10-18 11:42:27 -07:00
Timo Tijhof
2d35c4e997 objectcache: Improve WANObjectCache doc for update strategies
Also add headings to separate docs for deployment/administration,
from docs for developers using an existing instance of it.

Change-Id: Id43c7700564c2979549afa5379f644027fb6585b
2018-08-27 03:46:54 +00:00
Fomafix
0a0d5cb7f7 Fix typos
Bug: T201491
Change-Id: I25a27d11faabe2f5fa02950c7a4fb58b13fb3662
2018-08-14 09:52:19 +00:00
jenkins-bot
55ffac2024 Merge "objectcache: add "epoch" parameter to WANObjectCache" 2018-08-08 23:16:40 +00:00
Aaron Schulz
4af7fbd76a objectcache: add "epoch" parameter to WANObjectCache
This can be used to discard all values before a certain point in
time, such as periods of severe network problems or misconfiguration
that resulted in missed purges.

Change-Id: I612db8f91a5960b912e9f35645a3d3872df47460
2018-08-06 16:43:50 -07:00
Aaron Schulz
de51ba46f6 objectcache: switch WANObjectCache process cache to MapCacheLRU
Change-Id: I60d8de99e9590bfef6009f133723bb10d5837c52
2018-07-18 17:57:00 +00:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Aaron Schulz
626c5f6972 objectcache: change "miss" to "renew" in metric name for preemptive refreshes
This will usually let one distinguish asynchronous preemptive cache refreshes
from synchronous value recomputations due to actual cache misses.

Change-Id: I3424a89cc96a12fe283460eeaf722ee0cf299534
2018-06-20 15:23:35 +00:00
Max Semenik
1e680456b4 Get rid of call_user_func(_array)(), part 3
Also cleaned up nearby code in a couple places.

Change-Id: Ibf44ee7c0ceb739d7e79406e4ff39303c316e285
2018-06-10 02:21:24 +00:00
Aaron Schulz
bde2c5aa9e objectcache: clean up language about expiration/invalidation
Change-Id: I593e7bf9bd4f7fbb615d3d164e77273bd4033dde
2018-06-05 23:45:19 +00:00
jenkins-bot
966e34619b Merge "objectcache: add setMockTime() method to BagOStuff/WANObjectCache" 2018-06-01 13:19:24 +00:00
Aaron Schulz
acace9a049 objectcache: add setMockTime() method to BagOStuff/WANObjectCache
Change-Id: I3e5760814fb7dbe628eb0d979d690c3275fc3c15
2018-06-01 03:46:58 +00:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
Aaron Schulz
5c55f5d912 objectcache: improve TTL reduction warning log entries
Add "lag" and "age" parameters for more context

Change-Id: Iea029e78d4c0bbec0e4334de4fbe7780b1bea524
2018-02-22 10:07:40 -08:00
Aaron Schulz
8e89785e25 objectcache: add IExpiringStore::TTL_SECOND constant
Change-Id: Iec59ce72f3dbb0de68c8f6704d86f1522f86827e
2018-02-16 14:23:49 -08:00
Aaron Schulz
32907f4f99 objectcache: improve WANObjectCache reap method comments
Change-Id: Icec0846b0e66229af39bb819d75144734fd111bf
2018-02-15 11:53:45 -08:00
Aaron Schulz
d9f0a5f685 objectcache: remove unused constant and expand on a comment
Change-Id: I3342497d657291d20325a3d87cc634f53d7776c4
2018-02-07 16:15:32 -08:00
Aaron Schulz
7206bd3468 objectcache: use region prefixes for mcrouter-backed WAN cache
This allows for mcrouter to have proper cross-DC and intra-DC timeouts.

Change-Id: If48f740f435d266a2050839f34611c0c8f36b3a7
2018-02-01 10:09:44 -08:00
Aaron Schulz
9a4dc4b755 objectcache: add some WANObjectCache comments to set() and delete()
Change-Id: I527f1244c5c7cece888ace25e7a01653cf2b9542
2018-01-29 17:29:20 -08:00
Umherirrender
23ef520a1c Improve some parameter docs
Change-Id: I31e983d7ac287158101b18ad95779d83537302a2
2018-01-07 11:39:08 +01:00
Aaron Schulz
32c4831cf1 objectcache: fix getMultiWithUnionSetCallback() doc
Change-Id: I5700ff8ccbe2ef3aa6730e20bdc17314bceade42
2017-12-20 14:24:43 -08:00
Aaron Schulz
b62327eee7 objectcache: add another example case to WANObjectCache::getWithSetCallback()
Change-Id: I4beb1441790f5371d9fe55ca05cd17dc9fcdcf80
2017-12-15 12:05:35 -08:00
Lucas Werkmeister
5f5b79eea2 Remove unused 'pool' param from WANObjectCache::newEmpty()
The 'pool' parameter was removed in commit 09a0a5e4f6 (change
I5631eb1b13), retaining it in this helper method just confuses people
who read the code.

Change-Id: I7907a1fc4c613362d74e9045bc7dc41bbd9bf815
2017-12-11 18:30:55 +01:00
Aaron Schulz
78468c0147 objectcache: various cleanups to WANObjectCache
Change-Id: Ibc3c7e59b47b4f9b982176f81dff9f81d99de460
2017-12-01 15:25:40 -08:00
Aaron Schulz
e3b6f7ef4d objectcache: add example use case to WANObjectCache::getMultiCheckKeyTime()
Change-Id: I874070d2f770be7f9e06c381b2413f6e133418b8
2017-12-01 14:29:56 -08:00
Aaron Schulz
b29ee7a960 objectcache: add WANObjectCache::getMultiCheckKeyTime method
Change-Id: I5675fabc5aa70f72659ce02d68caae88be20e06d
2017-12-01 21:45:32 +00:00
jenkins-bot
bd78292e75 Merge "objectcache: Run preemptive WAN cache refreshes post-send" 2017-12-01 19:08:31 +00:00
Aaron Schulz
73b928750c objectcache: Run preemptive WAN cache refreshes post-send
This keeps HTTP request time consistent in case of expensive keys

Change-Id: I0746fde29a6e2f27d1b92f1af599c741d5972f46
2017-12-01 08:15:26 +00:00
Aaron Schulz
976cb7035b objectcache: fix a few documentation mistakes
* Fix useInterimHoldOffCaching() description
* Mention when staleTTL and graceTTL where added

Change-Id: Iea24b77f6816251e9dac814dc57f6a44382a3cea
2017-12-01 06:16:16 +00:00
Aaron Schulz
e90eafdf61 objectcache: Make WANObjectCache interim caching not interfere with ChronologyProtector
Also removed useless line from testLockTSE(). That would have needed
to be using $this->internalCache and those locks are freed immediately.

Bug: T180035
Change-Id: Ida1a923f779aaf8410da76643457d2200da6cb20
2017-11-30 23:54:22 +00:00
Aaron Schulz
ee14393358 objectcache: use INTERIM_KEY_TTL constant in WANObjectCache for readability
Change-Id: I13936397def11a13849fe14491b752dd797f6759
2017-11-28 21:59:28 -08:00
Aaron Schulz
ea22e3d1f6 objectcache: only give current format keys getWithSetCallback() callbacks
Callback code that happens to make use of $oldValue might not be able
to handle missing, new, or changed fields due to key version changes.

Overhaul testGetWithSetCallback_versions() to be cleaner and cover the
case of unversioned => versioned keys.

Change-Id: If108a73078c530c985d30bdadcbfa9ddd53dc2be
2017-11-28 21:26:06 +00:00
Aaron Schulz
2ad9970434 objectcache: add more comments to WANObjectCache
Change-Id: I567f45fa7b33226b0ccf7d80440802eab71ff753
2017-11-28 21:17:48 +00:00
Aaron Schulz
300c655377 Use time forcing methods to avoid WANObjectCacheTest flakeiness
Use of microtime() is now just for baselines, and it is no longer
assumed to be increasing with each call. Such an assumption is
particuliarly bad on Windows.

I've done 100X run rounds with now failures on Windows.

Change-Id: Ica2a47982495bc95b10ca507414972744ea9507e
2017-11-28 06:50:44 +00:00
jenkins-bot
fb7979f479 Merge "objectcache: add "graceTTL" option to WANObjectCache::getWithSetCallback()" 2017-11-28 02:21:50 +00:00
Aaron Schulz
0d7137099a objectcache: add "graceTTL" option to WANObjectCache::getWithSetCallback()
Also made worthRefreshExpiring() fully match the method documentation.

Change-Id: I48a4b1b9d006de100389b47c03c1185a9316abfc
2017-11-27 17:11:13 -08:00
Aaron Schulz
b633233c04 objectcache: make adaptiveTTL() use getCurrentTime() for completeness
Change-Id: I5ba3c39ccaf412b0aaecd64d52ab15b2075bc76c
2017-11-27 09:45:46 -08:00
jenkins-bot
785960660f Merge "objectcache: add "staleTTL" into WANObjectCache::getWithSetCallback()" 2017-11-26 21:55:47 +00:00
Aaron Schulz
fce6862e46 objectcache: add "staleTTL" into WANObjectCache::getWithSetCallback()
This simply involves passing it through to the set() call

Also added some related commons to adaptiveTTL() involving
usage of this option.

Change-Id: Id5833a5d4efb6cad2eb646832e5b0188e86e12fc
2017-11-26 21:49:47 +00:00
Aaron Schulz
4ebcc581e1 objectcache: improve touchCheckKey()/resetCheckKey() comments
Change-Id: I91de1dff605adcf86e957bbf9e503fc4e5eed741
2017-11-23 03:44:57 -08:00
Aaron Schulz
1772c4fe34 objectcache: add some WAN cache preemptive refresh tests
Added some extra sanity checks to WANObjectCache

Change-Id: Iac511b0cc1fc8d57ac98e9d7f2cacbcddc1c6db9
2017-11-22 18:38:53 -08:00
Aaron Schulz
7dbd6bff34 objectcache: add WANObjectCache::STALE_TTL_NONE constant
Also improved the documentation around "staleTTL".

Change-Id: Iae3377cbf58d8aa2c70f75586f183089a8bec92f
2017-11-21 14:09:08 -08:00
jenkins-bot
c8dcf35850 Merge "objectcache: fix some makeKey/makeGlobalKey IDEA warnings" 2017-11-20 20:51:26 +00:00
Aaron Schulz
f23fb835fc objectcache: make sure variant keys are namespaced as keys should be
Change-Id: I02597d6dbc2febace25ef6d1981f69dc704efe8d
2017-11-20 20:32:44 +00:00
Aaron Schulz
93120703f6 objectcache: fix some makeKey/makeGlobalKey IDEA warnings
Change-Id: I5fefda9676a685167326c63c34b2b7df8be2e7cd
2017-11-18 19:57:26 -08:00
Chad Horohoe
444073ddbc Group messages in WANObjectCache by key
Change-Id: I31c570a095735c9157332660e9f1f542e679410f
2017-11-08 20:20:05 +00:00
jenkins-bot
6ff59f4979 Merge "Add statsd metric support to WANObjectCache" 2017-11-01 01:19:08 +00:00
Brad Jorsch
3488f49532 Replace selectFields() methods with getQueryInfo()
Several classes have a "selectFields()" static method to tell callers
which fields to select from the database. With the recent comment table
change and the upcoming actor table change, this pattern has become too
simplistic as a SELECT will need to join several tables to be able to
retrieve all the needed fields.

Thus, we deprecate the selectFields() methods in favor of getQueryInfo()
methods that return tables and join conditions in addition to the
fields.

Change-Id: Idcfd15568489d9f03a7ba4460e96610d33bc4089
2017-10-30 22:57:33 +00:00
Aaron Schulz
4432e898be Add statsd metric support to WANObjectCache
Bug: T178531
Change-Id: I3037281d09cd5195347789f544deae89711f128b
2017-10-25 01:41:31 +00:00