Commit graph

162 commits

Author SHA1 Message Date
Matthew Flaschen
737653546a Don't unserialize integer reply from Redis incrBy
It does not work with unserialize because RedisBagOStuff->unserialize
expects either strings of digits, or serialized strings.  A plain integer
is neither.

incr docs were incorrect, so fix and expand by copying from parent class.

Change-Id: Ifc9c7a36f221b251ceea0d9a79ae6c3ce5753dd4
2014-06-27 18:24:35 -04:00
jenkins-bot
ad6289a7e9 Merge "objectcache: Actually unserialize integers as integers in RedisBagOStuff" 2014-06-27 18:47:27 +00:00
Aaron Schulz
211d6062e1 Add some casts for sanity before BagOStuff::add() calls
Change-Id: I6ecb609c88e4fc1ef614e94c551199bd610ca360
2014-06-26 16:25:31 -07:00
Timo Tijhof
eb0a3b7830 objectcache: Actually unserialize integers as integers in RedisBagOStuff
Before:
> SET   (stored)    GET
>  5     5          (string) "5"
>  '5'   5          (string) "5"
>  'x'   s:1:"x";   (string) "x"

After:
> SET   (stored)    GET
>  5     5          (int) 5
>  '5'   s:1:"5";   (string) "5"
>  'x'   s:1:"x";   (string) "x"

Follows-up 2ceda41c57.

Bug: 60563
Change-Id: I2bb09381b2bb733ac5a89175e053cb10eca68b08
2014-06-26 23:06:39 +00:00
Niklas Laxström
cc0a51fd39 Don't die on empty keys in MWMemcached
Bug: 64287
Change-Id: Iedfec96286212577a181b83957cdc4545be206d2
2014-06-05 08:09:47 +00:00
Matthias Mullie
63b22fe634 Cached misses in getMulti should be omitted
SqlBagOStuff::getMulti currently returns an array with false values for missed
cache keys.
Default BagOStuff::getMulti (and other specific implementations like memcached),
however, just omit missed values.

e.g.:

    $cache->getMulti( array( 'goodkey' 'badkey' ) );

should return

    array( 'goodkey' => 'value' );

instead of

    array( 'goodkey' => 'value', 'badkey' => false );

Bug: 65637
Change-Id: Ib2de06a0f76421094707f7ad4218346087f4dc55
2014-05-22 17:19:22 +02:00
Siebrand Mazeland
a36be914c3 Pass phpcs-strict on includes/objectcache/
Change-Id: Ib99f2e34255df0cc846727b134d1788aec48529d
2014-05-11 16:52:18 +00:00
Kunal Mehta
c592011404 Add BagOStuff::setMulti for batch insertions
Includes implementions for Redis, Sql and MemcachedPecl,
other types will fallback to using $this->set repeatedly.

Change-Id: I0924a197b28ee69e883128ccd672343e5c041929
2014-04-25 15:12:22 -07:00
Aaron Schulz
89d85a4be4 Added pool counter support for all thumb.php requests
* This can limit how many workers work on a given file at once,
  regardless of which specific thumbnail parameters are requested.
* Also added a BagOStuff::incrWithInit() method per DRY.
* Tweaked the register_shutdown_function() callback to avoid
  File/MediaTransformOutput references, since they may involve
  TempFSFile objects.

Change-Id: Ic01461cb974ab23b179ac3b60cf6de12e36360f6
2014-04-23 20:57:17 +00:00
umherirrender
23bb3d1cb4 Follow-Ups to "Fixed some @params documentation"
Fix of inline comments of the following patch sets:
Follow-Up: I0056b4a8df243cfc0c5f25378de48f7a35170aca
Follow-Up: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
Follow-Up: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
Follow-Up: I6627ba0e76d3577c40bf2473e0f78a5ad7368634
Follow-Up: Id75b5ecf648ca50f955b3bde3307c82c4366b102
Follow-Up: I4ca5231119f33039d91da3b57a41cd40719a576b

Change-Id: Id9bbe84b2820e9db44af5783411e955f55f643d4
2014-04-23 13:39:49 +02:00
umherirrender
b9cd789fce docs: closure -> Closure; callback -> callable
Changed closure to capital word Closure in doc and type hint,
also changed callback in docs to callable

Change-Id: I52c8e8f13d38a837052101c38b9986be780ca057
2014-04-19 08:43:31 +02:00
umherirrender
fd66273c94 Fixed some @params documentation (includes/[cache|objectcache])
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I86fd10e3f2d4bb80e7432533038d124693acfb3c
2014-04-19 01:19:46 +02:00
Bartosz Dziewoński
59002d8935 Consistently use '@deprecated since <version>'
Variants included 'in <version>', 'as of <version>' and just the
version number.

Some @deprecated annotations do not have the version number at all,
I want to hunt them down separately.

Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
2014-04-15 22:18:19 +02:00
umherirrender
23fab68274 Fix spacing after @param and friends in comments
Searched for:
\@(param|return|throws|since|deprecated|access|todo|var)[ \t]{2,}

Change-Id: Icce22ba9fe0635455691ca58d9872d618151f346
2014-04-05 20:02:29 +00:00
Alexandre Emsenhuber
28fe01dcdc Remove trailing line break check from MemcachedBagOStuff::debugLog()
wfDebugLog() already does the same, so it's unnecessary here.

Change-Id: Ia7bbbd2806fcd638861d010835c33969322d262a
2014-04-05 20:28:06 +02:00
Aaron Schulz
4d7f18f6d5 Made BagOStuff fail fast in cas/lock on certain errors
* This avoids wasting time waiting on down servers

bug: 63058
Change-Id: Ia78a2036ffa7a20102ec9e8bf941cacb7fa63435
2014-04-01 13:26:44 -07:00
Aaron Schulz
587a98aa02 Lowered high lock timeout in mergeViaLock() and lock() in BagOStuff
Change-Id: Ib5cd0a98ce6ec47edb24f8cc9f4df2c941ce1c38
2014-03-25 17:14:33 +00:00
umherirrender
2000672ac3 Fixed spacing
- Added spaces after if/foreach/catch
- Added new line before end of file
- Added or removed spaces before/after parenthesis, comma
- Added spaces around string concat

Change-Id: I0590070f1b3542108e242730e8d9a3ba9831e94f
2014-03-20 20:37:30 +00:00
Ladsgroup
a90f1a2d79 Changing URLs of mediawiki.org in scripts to the SSL-based website
http://www.mediawiki.org --> https://www.mediawiki.org

Part 3

Change-Id: Ica633881b1744fa2854f4b012b79dbf5a7e5e7e2
2014-03-13 22:28:14 +00:00
Aaron Schulz
83dd6d7e3d Deprecated useless BagOStuff::replace method
* Almost nothing actually uses this (one extension)
  as it doesn't really solve race conditions like merge().
* Removed subclassed versions too.

Change-Id: I4d4123afcc0576a90a3cbf1e4e6daff7ebce39c3
2014-03-09 02:53:04 +00:00
Aaron Schulz
4265d8f23f Added simpler handleError() method in RedisConnectionPool
* Callers should not need to give $server since it is stored in RedisConnRef

Change-Id: I902d984d6a7f19dd0d8c71ee374cbed359de378e
2014-02-12 07:29:32 +00:00
Alexandre Emsenhuber
8d701eeeea Remove trailing line breaks from wfDebugLog() messages
This is useless since the message is passed through trim() and a
line break is added afterwards.

Change-Id: I1a26b30a07f7c9c749fce5bb6b2b4b3d79901b7c
2014-02-04 22:16:13 +01:00
tonythomas01
225f1b724c Removed version check for mysql 4.1.0 from SqlBahOStuff::createTables
Presently mysql v5.0.2 or later is supported.

Bug: 59125
Change-Id: I9043a6f792c6479a85411addbe9fd448ed5e02a6
2014-01-28 15:43:32 +05:30
Siebrand Mazeland
eabdda4fba Remove FakeMemCachedClient
Was deprecated in 1.18. Not used in core or Gerrit extensions.

Change-Id: I06bc9c6f01f21386c772fa7fad57b55a7c7b2fe4
2014-01-22 17:17:18 +00:00
Chad Horohoe
736820f8f2 Remove DBABagOStuff
Isn't useful outside of testing as the comments state, but it's
barely even useful for that. People who are testing the cache
code can use CACHE_DB if CACHE_MEMCACHED is too hard.

Change-Id: Ief0aa148376957fdd844c8bb585a133b854a012c
2014-01-16 11:43:59 -08:00
Chad Horohoe
19873e7693 Ehcache more like mehcache
mehcache isn't a caching system, it's a pun.

I'm removing Ehcache support because it's an experiment didn't pan out
and the code's just sitting here abandoned now.

Change-Id: Ief5728b4c61bb5ad8f5a5f0b55415b23ef6727eb
2014-01-16 18:44:09 +00:00
Matthias Mullie
2a4dfa169b Don't use complex datatypes as CAS tokens
For caches where CAS is not natively supported, we have a workaround, where the
CAS token is (based on) the stored value.

To confirm the data can be written to cache, the CAS token is compared against
"whatever is currently in cache", so we pull the cached data and rebuild the
value.

In the case of objects, we have now pulled & rebuilt (unserialized) 2 objects
that are actually the same object (for CAS purpose - it's the correct value to
overwrite), but in terms of ===, they're 2 different values.

This patch should make sure CAS tokens are always a serialized version of the
value we're saving (where no native CAS exists); these serialized versions can
reliably be compared.

Bug: 59941
Change-Id: I2760416c48f2ceb7a0e0c874dd70ec07b4dccdfc
2014-01-14 16:45:32 +01:00
Joel Natividad
bee00fcac9 changed memcached server parsing to allow for local unix domain socket connections
* This works with local memcached (e.g. unix:///var/run/memcached/memcached.sock:0 )
  and noticeably increases memcached mediawiki performance

Change-Id: Ie08c151caa09eb0a4269df88965d71c2367c398b
2013-12-31 11:10:53 -08:00
jenkins-bot
dd981eb7b5 Merge "Fixes to RedisBagOStuff" 2013-12-03 20:48:20 +00:00
Aaron Schulz
2ceda41c57 Fixes to RedisBagOStuff
* Avoid serializing scalars like the memcached client does.
  This means incr/decr can be fast and preserve the TTL.
* Properly call unwatch() in the cas() method.
* Made the expiry set on add() actually atomic.
* Also cleaned up the profiling calls.

bug: 56069
Change-Id: I3e0d1c4888062544c54aef32085f8ce608ff5423
2013-12-03 11:56:24 -08:00
umherirrender
0bc583af2c Move closing parenthesis from multi line if and function to own line
The Line continuation Coding conventions prefers the closing parenthesis
on the same line than the beginning curly braces. This is done for ifs
and functions.
Also move some boolean operator from the end of a line to the beginning
and changed some indentation to make the condition hopefully better
readable.

Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
2013-12-01 21:39:00 +01:00
Aaron Schulz
59e803274b Made SqlBagOStuff fully avoid transactions when possible
Change-Id: I775d872b522f68462496bbfa685665cc8faf9bf1
2013-11-21 16:26:24 -08:00
Matthew Flaschen
face4812c6 Fix Redis increment behavior by using BagOStuff->incr instead
Due to the PHP serialization, the Redis native INCR and INCRBY do not
work.  This instead falls back on the parent class's incr, which uses
lock and unlock, and incrementing on the PHP side.

Bug: 55986
Change-Id: I500199aeb935963ca118fde163bd7ba0cba8f79f
2013-10-22 17:39:00 -04:00
MatmaRex
df8ec1e216 No spaces after (casts)
Also removed some unnecessary ones. I think I've caught them all.

The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.

Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae
2013-09-04 20:05:43 +02:00
umherirrender
24bfde2710 Fix spacing and break some lines
Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
2013-08-24 17:06:25 +02:00
jeroendedauw
9104af80ef Fix return types in documentation
Change-Id: I726e6201a737ab406dd0e46754d2bbbd95e769b4
2013-06-28 23:48:31 +02:00
asher
dcf080c16d support setting Memcached::OPT_SERVER_FAILURE_LIMIT, Memcached::OPT_RETRY_TIMEOUT
Change-Id: Ib1fcae92b65e8fd23baee7af7ed64abd908b600e
2013-06-12 12:49:38 -07:00
csteipp
d02b5bd7f7 Add value to add() call when locking
When BagOStuff::lock() was called, it called $this->add() with only
two parameters, the key and the timeout. But BagOStuff::add() takes
three parameters (key, value, timeout), so all locks got an infinite
timeout.

Change-Id: I82bed11b0b799f2cda13a8a0bd0cd94908b6ce8e
2013-05-10 12:42:16 -07:00
umherirrender
6f79eef473 Fixed spacing around parenthesis in includes
Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
2013-04-28 15:50:07 +00:00
Matthias Mullie
edf169b448 Docs for Redis' ->exec() return value
I had to look up exactly why it'd return an array, figured someone else some day
might too

Change-Id: Iefb3a0f8292baf8846ed6a1b852432eb9daa92c2
2013-04-24 10:00:02 +02:00
Aaron Schulz
9157649022 Fixed return value for RedisBagOStuff::cas().
Change-Id: I3b180baaba8fb12ab2960e358c8b6d1a1eac05dd
2013-04-23 14:31:52 -07:00
umherirrender
892ee7a4af Fixed spacing in db/debug/diff/externalstore/objectcache folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I32a43c547630ce31b6b25cc1bc9eedc50e67b2d7
2013-04-20 22:28:52 +02:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
Tim Starling
9407284253 In SqlBagOStuff::getMulti(), catch connect errors
This case was somehow neglected in Ifba0d276. The other methods work
correctly.

Change-Id: If29f0212f07c13bd72469c580bb096a2a41a96b5
2013-04-03 09:56:42 +11:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Reedy
c3e4057e06 Kill off numerous unused variables
Change-Id: I7039f1328f37ee669b694f73ee282602186bffd1
2013-03-08 02:36:24 +00:00
Matthias Mullie
01c1a11625 Docs for gerrit 47419
Change-Id: I021b7250418e60397127e1778107ee3da77ffb18
2013-03-07 18:54:12 +01:00
jenkins-bot
ba940af288 Merge "Read full memcached response before manipulating data" 2013-03-07 17:34:05 +00:00