Commit graph

230 commits

Author SHA1 Message Date
jenkins-bot
799ca9856b Merge "Made ReplicatedBagOStuff wrapping the SQL class the default stash" 2015-06-24 20:09:53 +00:00
Aaron Schulz
4825b4c08e Made ReplicatedBagOStuff wrapping the SQL class the default stash
* To make this work, a slaveOnly flag was added to SqlBagOStuff
  and it no longer prunes expired items on get(), it just treats
  them as missing. The use of garbageCollect() for the writeFactory
  cache and the use of replace() on updates already makes this
  a non-issue.
* This also makes the default $wgMainStash non-bogus.

Bug: T88493
Change-Id: I9d1f31305e08430de29a3cd521cdb10a82dffd10
2015-06-24 19:37:03 +00:00
Aaron Schulz
646fdc978c Added pre-emptive session renewal to avoid "random" submission errors
* The session will be renewed on access if it will expire in 10 minutes
* This avoids a problem both with 532ef78 + PHP <= 5.5 or any PHP >= 5.6

Bug: T102199
Change-Id: I8cad100bc35e86fa95ad144bcad338f3cb5d82a1
2015-06-18 21:51:15 +00:00
umherirrender
d8821f2b0b Fixed spacing
- Removed space after casts
- Removed spaces in array index
- Added spaces around string concat
- Added space after words: switch, foreach
- else if -> elseif
- Removed parentheses around require_once, because it is not a function
- Added newline at end of file
- Removed double spaces
- Added spaces around operations
- Removed repeated newlines

Bug: T102609
Change-Id: Ib860222b24f8ad8e9062cd4dc42ec88dc63fb49e
2015-06-17 20:22:32 +00:00
Kunal Mehta
f6e5079a69 Use mediawiki/at-ease library for suppressing warnings
wfSuppressWarnings() and wfRestoreWarnings() were split out into a
separate library. All usages in core were replaced with the new
functions, and the wf* global functions are marked as deprecated.

Additionally, some uses of @ were replaced due to composer's autoloader
being loaded even earlier.

Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to
mediawiki/vendor.

Bug: T100923
Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
2015-06-11 18:49:29 +00:00
Timo Tijhof
7b20e0ef7a objectcache: Minor code clean up in ObjectCache.php
* Whitespace.
* Simplify logic.
* Apply coding conventions to documentation blocks (empty line
  before annotations, no empty lines between annotation, consistent
  order of annotations).

Change-Id: I3e5268d6a6295643d5725c66ea2a01bccf610ed8
2015-06-10 04:53:41 +01:00
jenkins-bot
af2f7e00c3 Merge "Added ObjectCache::getMainStashInstance() and $wgMainStash" 2015-05-19 07:44:44 +00:00
Aaron Schulz
793d01401c Added ObjectCache::getMainStashInstance() and $wgMainStash
* This provides factory/config more appropriate for stashes
* Cleaned up some neighboring config comments while at it

Bug: T88493
Bug: T97620
Change-Id: Id370ee50be6e493a4700c858df863a183abc05fd
2015-05-18 11:39:14 -07:00
Aaron Schulz
42bf202b19 Added RedisBagOStuff FIXME comments
Change-Id: I6f4f85166584439a38d632356f3ed95e4fd4fd6f
2015-05-15 23:00:16 +00: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
1f48d8e193 Added ObjectCache::getMainWANInstance() helper method
Change-Id: I3d8d93b3bb6f7e06fae7adc694e6d4d851b2d8c2
2015-04-27 14:28:43 -07:00
Aaron Schulz
c7bf955bca Moved WAN cache and relayer to /libs
Change-Id: I9586d22890ce1cda7f74869ff701de73d65eaaef
2015-04-27 12:35:58 -07:00
Aaron Schulz
3a1f8b1111 Added WANObjectCache class
This class handles caching across distance sites where purges
must reach both. It also aims to make purging more reliable in
the face of network glitches and node consistent hash ejection.

bug: T88492
Change-Id: I686811b3075bf22e2f4de45127e8461e54648ead
2015-04-23 21:36:42 +00:00
Aaron Schulz
cbe67ce13b Make RedisBagOStuff support tag name hashing
Bug: T95126
Change-Id: I266dd30c93cfc44395eba5bca64f451ca77c23a4
2015-04-07 07:12:10 +00:00
Bryan Davis
1195e11a8a Move MWLogger classes to MediaWiki\Logger namespace
Move the MWLogger PSR-3 logging related classes into the
MediaWiki\Logger namespace. Create shim classes to ease migration of
existing MWLoggerFactory usage to the namespaced classes.

Bug: T93406
Change-Id: I359cc81fbd2dcf8937742311dcc7d3dee08747b0
2015-04-03 11:32:24 -07:00
Aaron Schulz
b48f51c522 Minor doc fixes
Change-Id: I80678e64cafcfd6e2c779452f466d8a630089568
2015-03-09 23:08:37 -07:00
Aaron Schulz
61df5e785f Made SqlBagOStuff avoid tripping TransactionProfiler
* Set a custom profiler with no expectations to avoid tripping
  the "0 write" expection. This avoids useless log entries.

Change-Id: Iac849a729eb36b1a8affb0dbc8b8c195fab4b03a
2015-02-27 17:45:48 +00:00
jenkins-bot
087e70d6d2 Merge "Start moving objectcache into libs/" 2015-02-25 16:04:49 +00:00
Kunal Mehta
1e3888de00 Start moving objectcache into libs/
The base BagOStuff class and some of the implementations are
not dependent on MediaWiki and can be in the libs folder.

Change-Id: I299f9abb778abc65a70461a2aff3015c02a1f04d
2015-02-25 00:22:50 -08:00
Aaron Schulz
0a873a3c28 Avoid calling rollback() in handleWriteError() if there is no trx
Change-Id: Ic3be89151160ad57acda5d95e3995a77f3835717
2015-02-24 11:34:23 -08:00
jenkins-bot
8256db3493 Merge "Removed cas() from ReplicatedBagOStuff as it is unused" 2015-02-23 19:21:39 +00:00
aude
e653640924 Make HashBagOStuff::lock() compatible with BagOStuff::lock
Fixes php strict standard error.

Bug: T90427
Change-Id: Ica2bddead9b5ad367510e898eeea1257a53b5b19
2015-02-23 12:35:55 +01:00
Aaron Schulz
40bfb9bfa0 Removed cas() from ReplicatedBagOStuff as it is unused
Change-Id: I2ff33ba806856ec4cc140a52590a922e13191bf2
2015-02-22 21:38:30 -08:00
jenkins-bot
e2e2fff1eb Merge "Made BagOStuff::cas properly optional" 2015-02-23 05:32:38 +00:00
Aaron Schulz
250f2b9e5a Made BagOStuff::cas properly optional
* merge() using the locking version by default. The callers that implement cas()
  override merge() to use the cas-based version. Those that do not no longer
  need to define the unused dummy method.
* Removed some redundant doc blocks.

Change-Id: I49f7dd5432efa8d76f4758c273f0859376ddafb7
2015-02-23 05:15:24 +00:00
Aaron Schulz
3817818aca Add a ReplicatedBagOStuff class
Bug: T88634
Change-Id: I1f7cccd6ac376055ff2b84641ff38a85571c65b0
2015-02-23 05:09:08 +00:00
jenkins-bot
014615d926 Merge "Made BagOStuff::debug protected" 2015-02-12 17:17:30 +00:00
Aaron Schulz
fd2c11c24b Made BagOStuff::merge() take any callable
Change-Id: I5ce99b8d343f1629f888a3b7594976a83839e2b7
2015-02-11 12:20:41 -08:00
Aaron Schulz
61697bab1e Made BagOStuff::cas protected, which is just one merge() implementation
Change-Id: I3ef82226231f7e03f7493ae042cad22339f4c869
2015-02-10 10:38:41 -08:00
Aaron Schulz
532ef7851c Avoiding writing sessions for no reason
bug: T88635
Change-Id: I4afaecd8dc29390b1ee2a6a77f9ca0cba333ef92
2015-02-10 18:14:02 +00:00
Aaron Schulz
ac8d6b3538 Removed old SqlBagOStuff alias
Change-Id: I6fdd8791713ce9ed67473065332266c217284974
2015-02-06 02:03:04 -08:00
jenkins-bot
2da34d0a9c Merge "Removed unused and poorly supported time argument to BagOStuff::delete" 2015-02-05 02:28:01 +00:00
Aaron Schulz
659ebf050d Made BagOStuff::debug protected
Change-Id: Ic05961e49e30d2537b411030b2b891adcc29a29e
2015-02-02 03:57:37 +00:00
Kunal Mehta
ed90263776 objectcache: Use Psr\Log\LoggerInterface instead of wfDebug
ObjectCache::newFromParams() will handle a 'loggroup' parameter
specially, getting an instance of \Psr\Log\LoggerInterface to
pass to the BagsOStuff.

BagOStuff implementations can use $this->logger which will be
an implementation of \Psr\Log\LoggerInterface. As this is set in
BagOStuff::__construct(), all subclasses must now call the
parent constructor.

The goal of this is to make the logging in BagOStuff non-MediaWiki
specific, in the hopes of separating it out into a separate library
in the future.

Change-Id: I8a8e278e6f028814499d8457d6d5341d03eabc7a
2015-01-30 22:03:23 +00:00
Aaron Schulz
13d1a86eef Removed unused and poorly supported time argument to BagOStuff::delete
Change-Id: I8f90f480ec8bc70605c85c39f73f29df21d1927d
2015-01-26 17:14:33 -08:00
Aaron Schulz
24c970667e Tweaked BagOStuff::lock() retry times slightly to be faster
Change-Id: Id04e373dcd2ed57951b68432fcd7491f4288b028
2015-01-14 11:54:38 -08:00
Brad Jorsch
1128c8d56f Allow CACHE_NONE as a fallback for ObjectCache::newAccelerator
Test for null specifically rather than falsiness,
because CACHE_NONE is 0.

Bug: T86162
Change-Id: I98b9da42c6a5fd6cdf721cdbd5473a5e959581b8
2015-01-08 12:58:17 +00:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Reedy
4d9143c7f5 Add lots of @throws
Change-Id: I09d0c13070f966fcf23d2638d8fc1328279a5995
2014-12-24 13:49:20 +00:00
jenkins-bot
b0dcb13e9b Merge "Made $timeout in BagOStuff::lock() actually work" 2014-11-20 09:39:41 +00:00
Aaron Schulz
1fa3a4d678 Unbreak lock()/unlock() for MemcachedPhpBagOStuff
Change-Id: I49ce96b65fe6a6e2cba86a990962fe4efc43bbb8
2014-11-20 01:25:38 -08:00
Aaron Schulz
19f3068ce5 Made $timeout in BagOStuff::lock() actually work
* Also added a separate $expiry option for things that take a long time

Change-Id: Ie5f81dea031f3c3f3ca8d61ad4cb322a5b876f61
2014-11-20 00:26:44 -08:00
Kunal Mehta
dd8fef31e7 ObjectCacheSessionHandler::getCache() returns BagOStuff
Change-Id: I7f514857154297c7033dd26af97b6ac83c13f104
2014-11-13 12:53:50 -08:00
Sergio Santoro
807b24eb27 SqlBagOStuff: reuse code of parent class
It'll be easier to change the time threshold (currently 10 years)
in the future.

Change-Id: I24005148d40c47905d5b20cfd506decef2ae447e
2014-10-25 19:26:21 +02:00
Sergio Santoro
4c79d2e7e4 SqlBagOStuff: fix percentage in deleteObjectsExpiringBefore()
Partial deletion percentage progess was computed using
$remainingSeconds. This is incorrect since $remainingSeconds
is going to *decrease* ( instead of increase ) while the
process continues.
The correct implementation uses 'processed seconds' instead.

Change-Id: Ic745f6e8375a85da543de36703fad6d31f62ea90
2014-10-16 20:43:38 +02:00
Sergio Santoro
9ae3d27ef0 SqlBagOStuff: document public method deleteAll()
Change-Id: I23700714453b6243e564642f2bad4a2d1c2469c6
2014-10-15 22:57:53 +02:00
Reedy
f3ae6fa6cc Fix expires typo in comment
Change-Id: I4bb63f610ce0ec246c4aa7aef3d04f096fb3e564
2014-10-08 16:55:52 +01:00
Tim Starling
9f0d40e08f HashBagOStuff: use the value itself as the CAS token
Avoid an unnecessary serialize() call on get() requests, which makes it
faster and also happens to work around a nasty crash bug which is
causing lots of segfaults right now.

CAS semantics should be the same, if the caller handles a CAS token in
an opaque way and does not assume it is a string. I could only find one
caller of cas() in core and WMF deployed extensions, and that is
BagOStuff::mergeViaCas(), which does correctly handle CAS tokens of any
type.

Bug: 71724
Change-Id: I0b0b5f0157c005ec7f76210dfb8576c056314733
2014-10-07 16:29:57 +11:00
Aaron Schulz
330e18c45d Removed MultiWriteBagOStuff::replace
Change-Id: Ifa6373cda099d1b87e90592598267987e9185a25
2014-09-12 11:13:06 -07:00
Aaron Schulz
9d59d4088e Removed deprecated BagOStuff::replace() method
Change-Id: Ife2f8e0f10ad7be76b79d5aee435491ea78d4655
2014-09-12 02:03:32 -07:00