Commit graph

55 commits

Author SHA1 Message Date
Aaron Schulz
d02b98b8f3 Updated key WANObjectCache::delete() callers to avoid races
* They now issue the delete() write before COMMIT of
  the relevant DB (or immediately if no trx is active)
* This can avoid some stale write race conditions
* Updated the WAN cache delete() docs

Change-Id: Id54887976051120b76528070d5f2ceb357d57897
2015-09-26 18:02:00 +00:00
Aaron Schulz
859cc75432 Assorted WANObjectCache doc tweaks
Change-Id: If207fc64279e344218d3b617eae7e69f88b23b27
2015-09-26 04:53:58 +00:00
Aaron Schulz
1ed292fa9e Improvements to WANObjectCache::getWithSetCallback()
* If lockTSE is set, make sure it applies during during
  the entire duration of a key being tombstoned. This lets
  regenerations happen during that whole time, which lowers
  the chance of seeing stale data if the DBs are lagged.
* If lockTSE is not set, do not apply tempTTL (for tomstoned keys).
  If traffic is high, a stale value would usually be "stashed" and
  used for 5 seconds. If the lag was only 1 second, then this
  is suboptimal.
* Determine tempTTL from lockTSE as they no longer make sense
  being separate. This makes things easier to understand and
  also makes the lockTSE value account for the last regeneration
  time (via stash key TTL). Since LOCK_TSE << HOLDOFF_TTL, this
  helps avoid stale reads without adding stampede risk.

Change-Id: I3b01f0ec67935a238b30e02e42004fd3b2dcfb9d
2015-09-23 15:24:01 +00:00
jenkins-bot
e3d0743904 Merge "objectcache: Fix some doc bullet points in WANObjectCache" 2015-09-23 05:28:18 +00:00
Aaron Schulz
901dcffd80 objectcache: Fix some doc bullet points in WANObjectCache
Change-Id: Id3e65b0768d45087aaf83ed3f432923c82acc713
2015-09-23 05:17:48 +00:00
Aaron Schulz
c1931c2933 objectcache: Add comments about DB isolation to WANObjectCache
Change-Id: Ic3454d0ebfdb05488dd650f77e09264842caea1c
2015-09-23 05:16:35 +00:00
Aaron Schulz
73b27a3d32 Small cleanups to WANObjectCache
* Added a few comments
* Renamed $locked => $lockAcquired for clarity

Change-Id: I45710974971731205d072a1f4b0f9cb37e2cb2a2
2015-09-17 11:00:23 -07:00
Aaron Schulz
2df6d54182 Moved some WANObjectCache number literals to constants
Change-Id: I848440408b54c1dfd4961c15cc83aad9a1a19425
2015-09-16 10:05:54 -07:00
jenkins-bot
5254ff682c Merge "Clarified WANObjectCache::delete() comments" 2015-09-01 00:44:09 +00:00
Aaron Schulz
8e93245603 objectcache: Correct tempTTL comment for getWithSetCallback()
* This applies regardless of lockTSE

Change-Id: I5adb62fbb956407cd978211a0497e8bd9de3c1a5
2015-08-31 20:52:13 +00:00
Aaron Schulz
274f1009c9 Clarified WANObjectCache::delete() comments
Change-Id: I8c1cffa284cf92461045f9163ff1d1e9bf8c2244
2015-08-31 13:26:22 -07:00
jenkins-bot
a7c124f2e9 Merge "Added $ttl sanity check to WANObjectCache::delete()" 2015-08-25 22:12:35 +00:00
Aaron Schulz
c9b1fe1896 Added reentrant lock support to BagOStuff
* Also fixed HashBagOStuff::delete() return value for non-keys

Change-Id: I9a977750c6fc6b8406bc1c9366a6b1b34bf48b6b
2015-08-25 01:17:45 +00:00
Aaron Schulz
da531a8be5 Fixed "undefined class" IDE errror from INF use in @param
Change-Id: I5d044da0946d046f4a8581445ede39d56973a126
2015-08-24 04:15:28 -07:00
Kunal Mehta
221acd4ee4 BagOStuff: Don't try to access a protected variable in a closure
Follows up 78f1fee559.

Change-Id: Id356509cc55a5953351dfd98896cf01055739ee0
2015-08-23 15:31:36 -07:00
jenkins-bot
27155a28ea Merge "BagOStuff: Don't use $this in a closure" 2015-08-21 20:50:29 +00:00
Kunal Mehta
78f1fee559 BagOStuff: Don't use $this in a closure
Change-Id: Ib9fb92a70adc2b4d75c30148e17dff6f7765afe1
2015-08-21 20:41:11 +00:00
Aaron Schulz
7b997f4ae5 Fixed IDE error in mergeViaLock()
Change-Id: I50b5a22bf353272ad6960181db07c2f4ec857f3c
2015-08-21 20:37:02 +00:00
Aaron Schulz
b085d5f9a2 Added $ttl sanity check to WANObjectCache::delete()
Change-Id: I48c80bd6ba5f79c94e87d75816f2e2069200c9aa
2015-08-19 16:37:59 -07:00
Aaron Schulz
d8931781e8 Fixed BagOStuff getScopedLock() docs
Change-Id: I4d6d3211e93ee1c279728ff787acff558a47fbee
2015-08-19 19:28:01 +00:00
jenkins-bot
8a6548ee45 Merge "Added a tombstone comment to WANObjectCache" 2015-08-19 00:46:12 +00:00
jenkins-bot
d1fb1a2d0e Merge "Avoid some possible deadlocks on account creation" 2015-08-18 05:25:59 +00:00
Aaron Schulz
97c7a897c8 Avoid some possible deadlocks on account creation
* This uses a non-blocking $wgMemc lock to reserve the user
  name in question. This should prevent two threads from
  reaching LOCK IN SHARE MODE and getting stuck on INSERT.
  The lock is global to better cover auth plugins.
* This adds a BagOStuff::getScopedLock() convenience method.
  It uses less queries than LockManager by being EX only.
* Avoid extra lock attempt in lock() in non-blocking mode.
* Removed (un)lock() HashBagOStuff overrides that made it
  behave differently than other caches (wrt to re-entrance).

Bug: T106850
Change-Id: Iecf95206d712367f5d202f76ab0eaa9d7bdabf2b
2015-08-17 21:33:50 -07:00
Aaron Schulz
6ff5c6afe3 Made WANObjectCache::get() comments more accurate
Change-Id: I531c2dca6b552a6b3732d2506e7373c7d17b4b4c
2015-08-15 12:33:58 -07:00
Aaron Schulz
72c493a3e4 Added a tombstone comment to WANObjectCache
Change-Id: Ia8c2fc4d4bbb741a6cd7aaa6f3ae433e65743b29
2015-08-13 15:54:44 -07:00
Aaron Schulz
4065e4d1ab Made BagOStuff::merge() avoid retries on I/O errors
Change-Id: Ia2fd61132322ed3fa8909d60d9f7eb42e39cb443
2015-08-07 04:31:15 +00:00
Aaron Schulz
c3dec1193c Added BagOStuff READ_LATEST flag for replicated stores
Bug: T88493
Change-Id: I7ea050a2eabba635f2aadb4e33b6f8fbfb1b01a8
2015-08-04 16:03:37 -07:00
Ori Livneh
7aeb270474 Don't double-serialize values for APC
The last time we had encountered APC errors related to serialization /
unserialization was 2011. PHP's implementation has had many bugfixes since
then, and HHVM's implementation is a complete rewrite. So let's stop working
around alleged bugs.

To prevent errors resulting from HHVM code receiving serialize()d values when
it isn't expecting them, add a key suffix.

Change-Id: I4b2cf1715538aa3d9163787f43eb31984a380d35
2015-07-22 16:20:52 -07:00
Aaron Schulz
7d5f3efa2f objectcache: Add WANObjectCache::resetCheckKey() method
Change-Id: I6f8b97c1f4511534e1ab2656f472adee491f9d9f
2015-07-13 21:25:20 +00:00
Aaron Schulz
84758e6f10 Made WANObjectCache::getCheckKey() automatically init the key
* This still allows If-Modified-Since logic but does not
  need to broadcast initialization values just because a
  key fell out of cache. The value can differ between DCs
  anyway via skew, this just lets them drift more. Actual
  purge events are still broadcasted, which is what matters.
* The User class has now been simplified given this change.
* Added more general comments to getCheckKeyTime().

Change-Id: Ic1f4bbb1947e0d1dd47499c9e9dc86991c30580c
2015-07-02 07:13:22 +00:00
Alex Monk
6a92393760 Set 644 file permissions on some *.php files
Bug: T103754
Change-Id: I2f5bae84463ea849ceae027c17b924779adf8c19
2015-06-27 20:46:05 +00:00
Timo Tijhof
0d98e9f2fb objectcache: Add tests for ReplicatedBagOStuff
Fixed PHP runtime warnings:
> Declaration of ReplicatedBagOStuff::getMulti() should be compatible with BagOStuff.
> Declaration of ReplicatedBagOStuff::decr() should be compatible with BagOStuff.

Change-Id: Icf1a0bf2c30408c4a5bef2de0b69ae2162b234d5
2015-06-24 20:17:18 +01:00
Aaron Schulz
4fe54ae2db Removed partly obsolete and redundant BagOStuff comment
Change-Id: I265912276af8f2bcdba4e49b4cc522df0a39a5db
2015-05-25 20:33:55 -07:00
jenkins-bot
5161541d87 Merge "Converted FileBackendStore to using the WAN cache" 2015-05-18 08:34:10 +00:00
Aaron Schulz
60608c1274 Cleanups to WANObjectCache::getWithSetCallback code
* Do not use lock() for tombstoned keys unless lockTSE was set
* Moved the is_callable() check down a bit further
* Also removed one inaccurate comment

Change-Id: I904e0681faa48b1dc2bc2a3c005a29d2f8347065
2015-05-15 06:07:13 +00:00
Aaron Schulz
a2c4237098 Added WANObjectCache::TTL_UNCACHEABLE for uncacheable content
Change-Id: If7b75654c91cc5762cb49d90f40e1b7ea518ebc8
2015-05-13 20:29:17 -07:00
jenkins-bot
79697edcbf Merge "Allow for dynamic TTLs in getWithSetCallback()" 2015-05-14 03:23:36 +00:00
Aaron Schulz
e941534195 objectcache: Add WANObjectCache::TTL_NONE constant for readability
Change-Id: I07592ebb2794a7a8efc0fd1d718c1b5ca3d9b83f
2015-05-13 13:37:11 +00:00
Aaron Schulz
4db819011a Allow for dynamic TTLs in getWithSetCallback()
* This gives it better parity with BagOStuff::set()
* Also updated some doc comments

Change-Id: Ib94b97715fae901bac1750656e3dc7501919d6d2
2015-05-12 13:04:53 -07:00
Aaron Schulz
9b7d95fc96 More "check key" doc comments
Change-Id: Ide66bc396e811776a58fd6aa7c1af2337ea185bd
2015-05-11 19:15:35 -07:00
Aaron Schulz
69fc8cfb88 Bump ReplicatedBagOStuff @since
Removed from 1.25 with I961d642e056f3c8087e1c2155e884a5ca5fcbe51

Change-Id: I1b84a03e35c9fe7ea58ef1b80514af062e3d635a
2015-05-09 20:03:41 +00:00
Aaron Schulz
77a949dea6 Added more lockTSE comments to getWithSetCallback()
Change-Id: I6ac56784bc231d7dec7869c6d2b901341bde6e9b
2015-05-06 20:38:53 -07:00
Aaron Schulz
63c132e050 Refactored ReplicatedBagOStuff to use generic factory methods
* Moved the class to /libs as is possible now

Change-Id: I6b724cf4b2ea627d485acb1e1882a5a04772d6f6
2015-04-29 20:08:19 -07:00
Aaron Schulz
48cffdff82 Converted FileBackendStore to using the WAN cache
Bug: T93141
Change-Id: I76efb0dc45a697c5fdfc50932e1198a6d663a445
2015-04-30 01:30:38 +00:00
Aaron Schulz
fcd0231305 Made getWithSetCallback doc comment clearer
Change-Id: I68c3929691c886bcfee32499a6058f01f69ea63c
2015-04-29 11:45:42 -07:00
Aaron Schulz
a2ea6116af Fixed some <code> tags for doxygen
Change-Id: I550b8760556e4916ee9b63ee244bbbcb4d926142
2015-04-29 06:01:59 +01:00
Kunal Mehta
8f0ed9c838 Fix @return documentation in WANObjectCache::prefixCacheKeys()
Change-Id: Iff27ad3b034b4702f329437950b69731de29171c
2015-04-28 04:17:28 +00:00
jenkins-bot
fe4b02f1d1 Merge "Cleaned up a few exceptions and IDE errors in BagOStuff" 2015-04-27 20:28:41 +00:00
jenkins-bot
9492e5bd2a Merge "Fixed getLagTimes() locking" 2015-04-27 20:28:07 +00:00
Aaron Schulz
f208215e8b Cleaned up a few exceptions and IDE errors in BagOStuff
Change-Id: I7ae88009f50c259c20572349b5d01480e36f7cb8
2015-04-27 20:20:19 +00:00