r51047 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51046‎ | r51047 | r51048 >
Date:06:10, 27 May 2009
Author:tstarling
Status:deferred
Tags:
Comment:
Implemented save/restore logic for sql_big_selects, per CR comments on r50168.
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMssql.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseOracle.php (modified) (history)
  • /trunk/phase3/includes/db/DatabasePostgres.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseSqlite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseOracle.php
@@ -721,4 +721,7 @@
722722 return "SearchOracle";
723723 }
724724
 725+ /** No-op */
 726+ public function setBigSelects( $value = true ) {}
 727+
725728 } // end DatabaseOracle class
Index: trunk/phase3/includes/db/DatabasePostgres.php
@@ -1438,4 +1438,7 @@
14391439 return "SearchPostgres";
14401440 }
14411441
 1442+ /** No-op */
 1443+ public function setBigSelects( $value = true ) {}
 1444+
14421445 } // end DatabasePostgres class
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -1792,5 +1792,8 @@
17931793 // TODO
17941794 // see SpecialAncientpages
17951795 }
 1796+
 1797+ /** No-op */
 1798+ public function setBigSelects( $value = true ) {}
17961799 }
1797 -?>
\ No newline at end of file
 1800+?>
Index: trunk/phase3/includes/db/Database.php
@@ -39,6 +39,7 @@
4040 protected $mErrorCount = 0;
4141 protected $mLBInfo = array();
4242 protected $mFakeSlaveLag = null, $mFakeMaster = false;
 43+ protected $mDefaultBigSelects = null;
4344
4445 #------------------------------------------------------------------------------
4546 # Accessors
@@ -2393,6 +2394,29 @@
23942395 public function getSearchEngine() {
23952396 return "SearchMySQL";
23962397 }
 2398+
 2399+ /**
 2400+ * Allow or deny "big selects" for this session only. This is done by setting
 2401+ * the sql_big_selects session variable.
 2402+ *
 2403+ * This is a MySQL-specific feature.
 2404+ *
 2405+ * @param mixed $value true for allow, false for deny, or "default" to restore the initial value
 2406+ */
 2407+ public function setBigSelects( $value = true ) {
 2408+ if ( $value === 'default' ) {
 2409+ if ( $this->mDefaultBigSelects === null ) {
 2410+ # Function hasn't been called before so it must already be set to the default
 2411+ return;
 2412+ } else {
 2413+ $value = $this->mDefaultBigSelects;
 2414+ }
 2415+ } elseif ( $this->mDefaultBigSelects === null ) {
 2416+ $this->mDefaultBigSelects = (bool)$this->selectField( false, '@@sql_big_selects' );
 2417+ }
 2418+ $encValue = $value ? '1' : '0';
 2419+ $this->query( "SET sql_big_selects=$encValue", __METHOD__ );
 2420+ }
23972421 }
23982422
23992423 /**
Index: trunk/phase3/includes/db/DatabaseMssql.php
@@ -1015,6 +1015,8 @@
10161016 return "SearchEngineDummy";
10171017 }
10181018
 1019+ /** No-op */
 1020+ public function setBigSelects( $value = true ) {}
10191021 }
10201022
10211023 /**
Index: trunk/phase3/includes/db/DatabaseSqlite.php
@@ -497,6 +497,9 @@
498498 return $s;
499499 }
500500
 501+ /** No-op */
 502+ public function setBigSelects( $value = true ) {}
 503+
501504 } // end DatabaseSqlite class
502505
503506 /**
Index: trunk/phase3/includes/LogEventsList.php
@@ -745,14 +745,10 @@
746746 }
747747
748748 public function doQuery() {
749 - // Work around MySQL optimizer bug
750 - if ( in_array( get_class( $this->mDb ), array( 'Database', 'DatabaseMysql' ) ) ) {
751 - $this->mDb->query( 'SET SQL_BIG_SELECTS=1' );
752 - parent::doQuery();
753 - $this->mDb->query( 'SET SQL_BIG_SELECTS=0' );
754 - } else {
755 - parent::doQuery();
756 - }
 749+ // Workaround MySQL optimizer bug
 750+ $this->mDb->setBigSelects();
 751+ parent::doQuery();
 752+ $this->mDb->setBigSelects( 'default' );
757753 }
758754 }
759755

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r50168(bug 18657) Workaround for MySQL optimiser bug. Replaces Domas's live patch.tstarling09:31, 4 May 2009

Status & tagging log