Commit graph

51 commits

Author SHA1 Message Date
Brian Wolff
fb1c2b7d26 Follow up r86363 - Missing a dollar sign.
Fixes the: Notice: Use of undefined constant i - assumed 'i' in /var/www/w/phase3/includes/db/LoadBalancer.php on line 745
2011-05-02 07:42:14 +00:00
Alexandre Emsenhuber
e7660a8654 * Changed wfMsgNoDBForContent() call to wfMessage(); also switched to user's language, I don't see any reason to not display this in user's language
* Marked wfMsgNoDBForContent() as deprecated and added wfDeprecated() call; the call in LoadBalancer was the only one in core and extensions
* Also added call to wfDeprecated() in wfMsgWeirdKey(); no call in core or extensions
2011-04-19 06:21:06 +00:00
Sam Reed
cdf75379c9 Apply LoadBalancer related fixes
Patches by Yuvi Panda

From (bug 28583) Remove all /* private */ declarations in MediaWiki core
2011-04-18 23:12:58 +00:00
Sam Reed
01891953bc More function/member variable documentation 2011-03-09 17:09:10 +00:00
Sam Reed
e30476fd0c Followup r83558, r83555
Set default of false to $open parameter
2011-03-09 16:37:39 +00:00
Roan Kattouw
c4bcbc22c9 Merge r83555 from 1.17wmf1: fix wait for slaves code from r83529 2011-03-09 00:24:21 +00:00
Roan Kattouw
ff6fec1e6f Make updateCollation.php a bit less murderous for WMF databases:
* Don't run a COUNT(*) query on what's potentially the entire categorylinks table on enwiki (hundreds of millions of rows). Put it in a miser mode check
* Wait for DB replication to catch up before processing the next batch. Implemented LoadBalancer::waitAll() for this purpose, which should behave more nicely than wfWaitForSlaves()
2011-03-08 16:47:26 +00:00
Platonides
49074e8a56 Yet more additions of wfProfileOut() 2011-02-10 16:39:53 +00:00
Alexandre Emsenhuber
c2379cd884 Fix for r80864: the $dbname variable was not there only to make pretty debug output, but also to let the connection choose the correct database. This was breaking connections to other databases since they were always using wiki's database. 2011-01-24 18:45:59 +00:00
Chad Horohoe
b3e99eec5b Followup to r79848 (and really, make it useful...)
Turn DatabaseBase::classFromType() into newFromType() factory function for constructing a new object based on a given type and (optional) params. Documented it fairly clearly.

I think it looks nicer :)
2011-01-24 16:31:36 +00:00
Sam Reed
bb29dc588d (bug 26895) in /include/db/LoadBalancer.php function "closeConnecton" should be called "closeConnection"
Seemingly no callers in extensions OR phase3 (weird...), searching for "closeConnecton" or the correctly spelt "closeConnection"

The back-compat typo thing probably wants removing.. Seems to have been as such since it was added in r32578...
2011-01-24 01:00:29 +00:00
Chad Horohoe
97b62e3034 Add DatabaseBase::classFromType() to reduce the 'Database' . $type duplication 2011-01-07 22:32:52 +00:00
Alexandre Emsenhuber
54b82541b4 Fix for r79231: $dbname was missing 2010-12-30 07:24:41 +00:00
Sam Reed
8180764a47 Extract sucks
Wrap long line
2010-12-30 02:48:27 +00:00
Roan Kattouw
e9f29660a8 Fix bug in load balancer: filter out non-replicating slaves (or slaves otherwise not reporting their lag) even if no max lag is specified 2010-11-27 22:39:56 +00:00
Roan Kattouw
ebd644480f Fix typo in LoadBalancer.php 2010-11-27 22:36:05 +00:00
Chad Horohoe
ae0df98c32 rm unused and (seemingly) broken factory function 2010-11-23 16:11:28 +00:00
Max Semenik
64089af28a Removed LoadBalancer::getGroupIndex(): deprecated since r32578, no callers 2010-11-23 12:27:02 +00:00
Sam Reed
d189aaee05 (bug 24853) Kill failFunction - Fixed! :D 2010-10-24 21:27:33 +00:00
Sam Reed
16cded8b32 Start of bug 24853, killing off 'functional' parts of failfunction code. Seems when the constructors start getting changed, it starts borking. Using this as a point of reversion/stashing 2010-10-24 20:48:48 +00:00
Antoine Musso
478768939c Follow up r74962, debug messages should be splitted.
This is to avoid log mess with concurrent accesses and to allow logging between the messages.

Makes the message more readeable:
  Connecting to localhost wikidb...
  Connected to localhost wikidb.
  Connection failed to localhost wikidb.
2010-10-19 06:27:25 +00:00
Antoine Musso
f720cbd4a4 Make some wfDebug() messages nicer to look at in debug log file. 2010-10-18 19:56:33 +00:00
Sam Reed
6b3b915353 Big attack on unused variables... 2010-10-14 20:53:04 +00:00
Brion Vibber
2f360ee0f9 Revert r74286, r74287 -- broke parserTests completely; mixed lots of formatting and code cleanup in with functional changes making it impossible to review cleanly. 2010-10-05 15:10:14 +00:00
Mark A. Hershberger
a828027890 (second commit to get all files.)
= BacklinkCache.php =
* BacklinkCache class
** Set a few otherwise unset varables ($wgContLang & $wgMemc in
   BacklinkCache)
= testHelpers.inc =
* TectRecorder class
** TestRecorder::record() accept and use a recorder object
** change TestFileIterator::setParser use a MediaWikiParserTest instead
   of ParserTest
= parserTest.inc =
* ParserTest class
** Make $ParserTest->regex and $ParsaerTest->savedGlobals member
   variables available to stop warnings.
** Force ParserTest::$showProgress and $showFailure to false
** Set ParserTest::$uploadDir on time
** Move ParserTest::chomp() and addArticle() to bootstrap for
   MediaWikiTestSetup.
** Update ParserTest::runTest so that Success and Failure are reported
   via reporter->showsTestResult() or ParserTestSuiteBackend::show*()
   as needed.
** Set $ParserTest->uploadDir with setupUploadDir()
** Change ParserTest->setupGlobals() so that $wgDBprefix doesn't get
   to set to the “parsertest_” bits.
** Sprinkle $this->teardownGlobals() at exit points in
  ParserTest->teardownDatabase()
= bootstrap.php =
* MediaWikiTestSetup class
** Make member variables MediaWikiTestSetup::$suite,
  MediaW* Make member variables MediaWikiTestSetup::$suite,
  MediaWikiTestSetup::$regex, MediaWikiTestSetup::$runDisabled
  available.
* Setup a constructor MediaWikiTestSetup that accepts an optional
  PHPUnit_Framework_TestSuite so they can use PHPUnit.
* Change MediaWikiParserTest so that it is derived from
  MediaWikiTestSetup instead of PHPUnit_Framework_TestSuite
* Make MediaWikiParserTest create a PHPUnit_Framework_TestSuite for
  the parser tests and pass it to the new parent (MediaWikiTestSetup)
  as the PHPUnit testsuite.
* Replace MediaWikiParserTest->run() with MediaWikiParserTest::suite()
  so that the tests can be loaded into a suite and then run with
  PHPUnit's test runner.
= ParserHelpers.php =
* ParserUnitTest class
** Force run() $backend to use ParserTestSuiteBackend instead of
   trying to get the  backend from the suite member.
** Use ParserTest::runTest() instead of
  ParserikiTestSetup::$regex, MediaWikiTestSetup::$runDisabled
  available.
** Setup a constructor MediaWikiTestSetup that accepts an optional
   PHPUnit_Framework_TestSuite so they can use PHPUnit.
** Change MediaWikiParserTest so that it is derived from
   MediaWikiTestSetup instead of PHPUnit_Framework_TestSuite
** Make MediaWikiParserTest create a PHPUnit_Framework_TestSuite for
   the parser tests and pass it to the new parent (MediaWikiTestSetup)
   as the PHPUnit testsuite.
** Replace MediaWikiParserTest->run() with MediaWikiParserTest::suite()
   so that the tests can be loaded into a suite and then run with
   PHPUnit's test runner.
= ParserHelpers.php =
* ParserUnitTest class
** Force run() $backend to use ParserTestSuiteBackend instead of
   trying to get the  backend from the suite member.
** Use ParserTest::runTest() instead of
  ParserTestSuiteBackend::runTest()
* ParserTestSuiteBackend class
** extends PHPUnit_FrameWork_TestSuite instead of ParserTest
** Add member variables  $recorder, $term, and $usePHPUnit
** Add a constructor that determines if PHPUnit is usewd.
** Add a method showTestResult() that can be used to show success or
   failure
** Change showSucess and showFailure() to be static and use identical
   arguments and only use PHPUnit_Framework_Assert::assertEquals
   when PHPUnit is in use.
= SearchEngineTest.php =
** Fix path in require to bootstrap.php
2010-10-05 03:51:49 +00:00
Sam Reed
85af1b0901 Revert r71250 r71251 r71252 r71253
Know what the problem is, roughly, can't fix atm, so not leaving phase3 broken
2010-08-18 14:15:32 +00:00
Sam Reed
9ea1f1d388 Kill some crappy "failFunction" stuff, marked as old in r14625 2010-08-18 13:38:42 +00:00
Sam Reed
380b6725d5 Remove some unused variables
Move variable in languages/classes/LanguageKu.php into commented code (used in comment)
2010-08-13 20:58:16 +00:00
Jeroen De Dauw
bf13f7ff9a Added some docs 2010-08-10 06:17:49 +00:00
Alexandre Emsenhuber
fb36e6ac3e * standardised file headers
* added a basic description
* added @file
2010-08-08 11:55:47 +00:00
Sam Reed
04f68827d0 Removal of unused globals
Removal of one setting of a variable to '', then not using further
2010-07-24 19:11:52 +00:00
Tim Starling
ea93933ee9 * Fixed complete breakage of "lag.php -r" due to spurious line-endings introduced in maintenance-work.
* Fixed breakage due to lag time cache, based on a hack in the WMF working copy.
* Tested locally.
2010-03-18 05:23:46 +00:00
Alexandre Emsenhuber
54fd0a4c1f Fixed some doxygen warnings 2010-03-11 20:59:25 +00:00
Roan Kattouw
af3fd687db Add $maxlag parameter to LoadBalancer::getMaxLag() so it'll actually select the right DB when opening new connections. Looks like an ugly temp fix to me but I have no idea how to do it properly offhand. 2010-01-05 23:39:16 +00:00
Chad Horohoe
b19e37425a Update callers from immediateCommit() to commit(). The former's been deprecated a really long time...Tim did it 45243 revisions ago. 2009-12-14 23:05:35 +00:00
Chad Horohoe
a4e5e935b6 Mass convert NULL -> null. Left strings and comments alone, obviously. 2009-12-11 21:07:27 +00:00
Tim Starling
bd8fffe24d Reverted r58646 as per my comments on bug 20554. 2009-12-01 01:55:04 +00:00
Roan Kattouw
1b89cd274a API: (bug 20554) Expose average slave lag (avglag) as well as maxlag. Patch by Sam Reed. 2009-11-06 14:38:55 +00:00
Tim Starling
8653947b06 * Skip COMMIT query when no write queries have been done.
* Improvement to ChronologyProtector: only record the master position if a write query was done. This should help to avoid the worst of the ChronologyProtector side-effects, such as having action=raw CSS requests block for a time equivalent to the slave lag on every page view, while maintaining the benefits, like preventing a 404 from being displayed after page creation.
2009-02-17 14:06:42 +00:00
Alexandre Emsenhuber
9b9636db03 Revert r41506 and make LoadBalancer::openForeignConnection() call Database::tablePrefix() on successful new connection 2008-10-13 18:38:01 +00:00
Tim Starling
90ed80443e (bug 12586) Use wfHostname() everywhere, remove $wguname and $wgNodeName. Use getenv('COMPUTERNAME') on Windows. 2008-10-06 07:30:38 +00:00
Alexandre Emsenhuber
ac1d1addfd Allow to specify per connection table prefix 2008-10-01 16:39:05 +00:00
Tim Starling
f1a352ccf9 * Revert revert r41234 of ES-related changes. The site_stats complaint should be fixed by the transaction added in r41287.
* Fix broken recursion guard in LoadBalancer::reportConnectionError(), which was causing getConnection() to return false on the second and subsequent errors, instead of throwing an exception. Revert incorrect fix r41229/r41230.
2008-09-28 01:42:55 +00:00
Brion Vibber
c4bbaf94c0 Revert some recent ES-related changes -- they made behavior much worse when we encountered problems with site_stats updates hanging and stacking up extra open ES connections.
r41230
r41229
r41093
r41091
r41092
r41086
r41063
r40696

Also reverted r41231 which no longer applies
2008-09-24 18:09:22 +00:00
Tim Starling
cf6c94e502 More specific error messages 2008-09-21 09:06:22 +00:00
Tim Starling
18e147f399 Logging tweaks 2008-09-21 08:28:21 +00:00
Tim Starling
cd8378a5a6 Revert/rewrite of r40696.
* We used to have parameters to ignore errors, but they're obsolete now that we have exceptions. Implemented ES master failover using exceptions instead. 
* Changing the number of DB connection attempts from 3 to 2 for some random getConnection() calls is almost pointless, adds lots of ugly formal parameters all of the place, and misses the big picture. It should be 2 by default, based on the original rationale. Any reasonable implementation of failover should have zero timeouts per request, by storing state. Changed the default to 2, or 1 if a long timeout is set.
2008-09-21 06:42:46 +00:00
Tim Starling
9b8782aaa8 Don't run hour-long, unlimited row-count DB queries with set_time_limit(0) in response to unauthenticated web requests on the master. Run them on the slave instead. Maybe we can crash the whole cluster instead of just a master or two.
Don't use DB_LAST, ever again.
2008-09-20 15:00:53 +00:00
Aaron Schulz
7b61c1972a ExternalStore tweaks:
* On read, spend less time checking on dead slaves
* Add randomInsert() to ES. This does the cluster picking for us
* Make revision text use randomInsert(). On write, fails-over to other clusters as needed instead of throwing db errors
2008-09-10 12:07:56 +00:00
Tim Starling
d6f0a95465 * Split off DB load monitoring logic into a LoadMonitor class hierarchy, to allow for plugins in this area.
* Use an associative array to initialise LoadBalancer objects
* By default, use Preprocessor_DOM if available, otherwise use Preprocessor_Hash. Preprocessor_Hash has worse performance.
* Fix parserTests.php for replicated databases. Use CREATE TABLE instead of CREATE TEMPORARY TABLE if there is more than one server configured.
* Log exceptions even in command-line mode.
2008-07-07 03:31:00 +00:00