Last modified: 2010-05-15 15:41:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T9474, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 7474 - wfGetCache in ObjectCache.php has incorrect values for type?
wfGetCache in ObjectCache.php has incorrect values for type?
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.7.x
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-10-02 23:45 UTC by Dallan Quass
Modified: 2010-05-15 15:41 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Dallan Quass 2006-10-02 23:45:48 UTC
On lines 63 and 65 of ObjectCache.php, inside the "if ($type ==
CACHE_MEMCACHED).." statement, on lines 63 and 65:

$wgCaches[CACHE_DB] = new MemCachedClientforWiki(...)
$cache =& $wgCaches[CACHE_DB];

it seems like CACHE_DB should be changed to CACHE_MEMCACHED 


Also, would it make sense to add some instructions in docs/memcached to tell
people that they should also set the following if they're using memcached?
$wgMainCacheType = CACHE_MEMCACHED
Comment 1 Dallan Quass 2006-10-03 00:43:09 UTC
Also, I think the $cache =& $wgCaches[CACHE_MEMCACHED] should go outside the IF
statement.  In summary, I think the last lines of the IF statement should be

    $wgCaches[CACHE_MEMCACHED] = new MemCachedClientforWiki(
        array('persistant' => $wgMemCachedPersistent, 'compress_threshold' =>
1500 ) );
    $wgCaches[CACHE_MEMCACHED]->set_servers( $wgMemCachedServers );
    $wgCaches[CACHE_MEMCACHED]->set_debug( $wgMemCachedDebug );
  }
  $cache =& $wgCaches[CACHE_MEMCACHED];
} elseif ($type == CACHE_ACCEL) {
Comment 2 Dallan Quass 2006-10-03 03:01:27 UTC
One additional thing: When the key to store contains a space, the memcached
process returns a CLIENT_ERROR because its keys can't contain spaces.  Does the
MemCachedClientforWiki class in ObjectCache.php need to override the various
get/set functions and convert spaces in keys to underscores before passing them
to memcached?  Would that work?  Or would it need to convert spaces in keys to a
magic string like '__SPACE__'?

Is the main wikipedia site using memcached, or one of the other cache alternatives?
Comment 3 Brion Vibber 2006-10-03 16:10:36 UTC
Keys cannot contain spaces, so that's user error.

Wikipedia uses memcached.
Comment 4 Dallan Quass 2006-10-03 17:46:38 UTC
Thanks for the reply.  It seems like there are instances where the mediawiki
software tries to inject keys with spaces, in particular keys of the form
"wikidb:messages:message text".  When I go to Special:Upload for example it
tries to inject a key for each of the possible license types, and many of them
contain spaces.
Comment 5 Brion Vibber 2006-10-11 22:42:38 UTC
I've reverted r16928 as this causes the objectcache table to be used instead of 
memcached, grinding Wikimedia's servers to a halt.
Comment 6 Dallan Quass 2006-10-12 04:59:36 UTC
I looked at the diff -- looks good.  I think you may also need to add the
following line after the if statement:

if ( !array_key_exists( CACHE_MEMCACHED, $wgCaches ) ){
...
} 
//NEW LINE AFTER IF STATEMENT
$cache =& $wgCaches[CACHE_MEMCACHED];

to handle the case when another request for a memcached cache is made but the
memcached cache has been set up already.  This is similar to what you do for
CACHE_DBA and CACHE_DB.
Comment 7 Aaron Schulz 2008-09-27 22:52:14 UTC
Fixed in r41323

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links