r56745 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56744‎ | r56745 | r56746 >
Date:00:45, 22 September 2009
Author:brion
Status:resolved (Comments)
Tags:
Comment:
Quick hack to fix file redirect caching bug on file rename...
* renaming process creates redirect at old title
* creation of redirect clears negative file redirect entry from memcached, if already present
* Special:MovePage dumps out some text, which on en.wikipedia included a link to the old title
* said link triggered a check if the old title was a redirect
* no cache entry, so it checks the database slave's redirect table
* OOPS you just read from a lagged slave, and saved the bad info back into cache

Temp workaround: clear the cache again at the end of the move process, after we've output the text.
This is still inherently fragile and the caching should be redone.
Modified paths:
  • /branches/wmf-deployment/includes/specials/SpecialMovepage.php (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/includes/specials/SpecialMovepage.php
@@ -522,6 +522,11 @@
523523 $wgUser->removeWatch( $ot );
524524 $wgUser->removeWatch( $nt );
525525 }
 526+
 527+ # Re-clear the file redirect cache, which may have been polluted by parsing in messages above.
 528+ if( $ot->getNamespace() == NS_FILE ) {
 529+ RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $ot );
 530+ }
526531 }
527532
528533 function showLogFragment( $title, &$out ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r60061Merged r56745 from wmf-deployment, with an adjusted comment. Fixes image redi...tstarling03:22, 15 December 2009

Comments

#Comment by Tim Starling (talk | contribs)   02:16, 2 December 2009

Marking fixme since it needs an equivalent in trunk.

#Comment by Tim Starling (talk | contribs)   08:50, 11 December 2009

I've reproduced bugs pretty much identical to this in the past, even without a second server, just with two connections to the master. A transaction opened on the "slave" connection can give you a consistent snapshot of the data as it was before the write on the "master" connection. It's my opinion that replication is fundamentally incompatible with caching. You can either read your data from the master and use caching, or read your data from the slave uncached.

#Comment by Tim Starling (talk | contribs)   03:24, 15 December 2009

Merged in r60061.

Status & tagging log