r42796 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42795‎ | r42796 | r42797 >
Date:01:12, 30 October 2008
Author:brion
Status:old (Comments)
Tags:
Comment:
* (bug 11533) Fixed insane slowdown when in read-only mode for long periods
of time with CACHE_NONE (default objectcache table configuration).

MediaWikiBagOStuff was refusing to perform any cache updates when in read-only
mode. This made sense originally when read-only mode was an extreme hardcore
"nothing can write to the DB EVAR because we're doing weird things to it",
but today we do allow backend writes of various sorts, and it's mainly meant
to stop user-level activity.

The refusal to perform updates caused the MessageCache to spend a long period
of time retrying the storage of the cache if it had expired out of the table previously... which is kind of bad as every page load would be insanely slow. :D
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/BagOStuff.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/BagOStuff.php
@@ -475,8 +475,19 @@
476476 function _fromunixtime($ts) {
477477 return $this->_getDB()->timestamp($ts);
478478 }
 479+ /***
 480+ * Note -- this should *not* check wfReadOnly().
 481+ * Read-only mode has been repurposed from the original
 482+ * "nothing must write to the database" to "users should not
 483+ * be able to edit or alter anything user-visible".
 484+ *
 485+ * Backend bits like the object cache should continue
 486+ * to work in this mode, otherwise things will blow up
 487+ * like the message cache failing to save its state,
 488+ * causing long delays (bug 11533).
 489+ */
479490 function _readonly(){
480 - return wfReadOnly();
 491+ return false;
481492 }
482493 function _strencode($s) {
483494 return $this->_getDB()->strencode($s);
Index: trunk/phase3/RELEASE-NOTES
@@ -293,6 +293,8 @@
294294 * Allow '0' to be an accesskey.
295295 * (bug 8063) Use language-dependent sorting in client-side sortable tables
296296 * (bug 16160) Suggestions box should be resized from left for RTL wikis
 297+* (bug 11533) Fixed insane slowdown when in read-only mode for long periods
 298+ of time with CACHE_NONE (default objectcache table configuration).
297299
298300 === API changes in 1.14 ===
299301

Follow-up revisions

RevisionCommit summaryAuthorDate
r55079* Converted BagOStuff.php from the style of memcached-client.php to the stand...tstarling03:45, 15 August 2009

Comments

#Comment by Tim Starling (talk | contribs)   09:07, 13 November 2008

As discussed on IRC, in read-only mode, absolutely nothing (from the web) must write to the database. This is because read-only mode is sometimes used in conjunction with MySQL's read_only mode, and in that case, attempts to write to the database cause a complete loss of the ability to read the wiki.

It's fine for command-line scripts to write to the database, because if they fail, it's the user's own fault.

I suggest ignoring query errors on attempted cache writes if read-only mode is enabled.

#Comment by Tim Starling (talk | contribs)   03:46, 15 August 2009

Fixed in r55079.

Status & tagging log