Commit graph

109 commits

Author SHA1 Message Date
addshore
a6169910ea Remove use of deprecated LoadBalancer pickRandom
Change-Id: If28b6dfe7d70827d1c7f7b3604cea2409b6ec483
2013-10-04 20:38:45 +02:00
Aaron Schulz
dd181032e9 Added a getLazyConnectionRef() function to load balancer
* This is useful for injecting dependencies without adding pointless traffic
  in some cases

Change-Id: I755ed008c387a3e4555934c84a5dc013ee8c2392
2013-08-20 13:25:16 -07:00
jenkins-bot
ebbea3c974 Merge "Never prefix table names with $wgSharedDB when used in foreign DB" 2013-08-09 00:19:48 +00:00
Aaron Schulz
1fbb0404f5 Allow for IDatabase to be used as type hints for DatabaseBase|DBConnRef
* Use this in LogEntry to avoid needless type errors

Change-Id: I8644b35b0d9cd171243dd28de52e94ef39d361a7
2013-07-18 03:43:20 +00:00
Aaron Schulz
d921b2fd7e database: added DBConnRef wrapper to manage calling reuseConnection()
Change-Id: Ifc9db62d1ac34d0c6a072d6f2d05bdcf73af14bb
2013-07-15 15:10:45 -07:00
Liangent
af154bea2b Never prefix table names with $wgSharedDB when used in foreign DB
Now database classes have an extra "foreign" property when used in
foreign databases, where $wgSharedDB and $wgSharedTables are not
considered.

Bug: 48819
Change-Id: I45db6860d0a4b4480e0b93aa7e750f096424e40f
2013-05-27 04:52:20 +00:00
Aaron Schulz
dc252e0aaf Reset the error string in LoadBalancer::getConnection() to avoid it crufting up.
Change-Id: I89e9fb46367970a0877986cd72d397eef51a0a06
2013-05-23 00:26:46 -07:00
Timo Tijhof
176c5354bb docs: Consistently use "since" phrasing in @deprecated
Most have it already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/deprecated.html

Ran a find/replace on "@deprecated \d" to fix the odd ones.

Change-Id: I5217aaf75264a0036b5426cd8536116b4bb8f535
2013-05-15 00:56:57 +00:00
umherirrender
892ee7a4af Fixed spacing in db/debug/diff/externalstore/objectcache folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I32a43c547630ce31b6b25cc1bc9eedc50e67b2d7
2013-04-20 22:28:52 +02:00
umherirrender
978bb31c5e Add missing wfProfileOut before throwing an exception
Change-Id: I1d830da0597f19efd0b2ae48642389975e736e23
2013-04-08 18:37:24 +00:00
Aaron Schulz
7fd8d513c4 Fixed fatal when using fake load balancers.
The error was:
Catchable fatal error: Argument 1 passed to DatabaseMysql::masterPosWait()
must implement interface DBMasterPos, boolean given, called in
/var/www/DevWiki/core/includes/db/LoadBalancer.php on line 419

Change-Id: I230585930c1424b0868f9aa290167c66bc6848bd
2013-04-04 10:29:13 -07:00
Catrope
319ace8125 Fix wfWaitForSlaves() for foreign DBs
We thought we'd fixed it previously, but the LB now connects to the
foreign slaves and tries to select $wgDBname. Fixing this by having
doWait() open connections that don't select any DB name, by passing
the empty string as the DB name. This is an undocumented feature
in the DatabaseMysql constructor, apparently.

Change-Id: Icc5594143a3eaa31170a7fc8c93d429c1a7dd575
2013-03-20 17:43:44 -07:00
Platonides
2763191221 (Bug 42461) Remove call to "new Database()"
* Refactored LoadBalancer::reportConnectionError()
 * Removed PHP4-style reference from DatabaseError constructors
 * Allowed to not pass a database to the DBError family of exceptions.

Change-Id: If9570b45ea7285de2b8b2391e704bc01f76be48a
2013-03-18 13:49:44 +11:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
Reedy
c3e4057e06 Kill off numerous unused variables
Change-Id: I7039f1328f37ee669b694f73ee282602186bffd1
2013-03-08 02:36:24 +00:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
Aaron Schulz
9ace77f03c Moved wfPickRandom to ArrayUtils.
Change-Id: I45e21e722245901ab2988be4892cdb393169c62c
2013-03-05 15:07:09 -08:00
Alexandre Emsenhuber
4421f598ea Correct documentation for wfPickRandom()'s return types
Also make LoadBalancer::pickRandom()'s one consistent.

Change-Id: Ib80827ef20b32fecb799f327545b1232272076d2
2013-03-01 08:22:46 +01:00
Reedy
99512fd3d6 Move LoadBalancer::pickRandom() to wfPickRandom()
Code is copypaste reused in other extensions

Change-Id: I4c677ddc01ee264f3b72bb17135972adc96144ae
2013-02-28 12:52:35 -08:00
Reedy
e028051140 Add a handful of missing @return
Change-Id: I21b218e6694600a2d2df4dd0a6b2b5cd2e10f1f9
2013-02-16 17:51:13 +01:00
umherirrender
f97a3a4027 fix some spacing
Change-Id: I670a7baf3ba1e70d18346bb00938d518ba2063bd
2013-02-04 19:59:14 +00:00
umherirrender
2e8da558ba fix some spacing
Change-Id: Id7eda67a43f9040117edd79fdbeb678f1c3a6da2
2013-01-26 22:11:09 +01:00
Platonides
fb0966908b Miscellaneous profiling fixes
Change-Id: I8d8ce0bc0383e4feb4ed38fd96b2dd516dcb742e
2013-01-06 22:35:11 +01:00
Reedy
d0a242abb4 Tidy up some unbalanced returns in methods
Leave a TODO

Change-Id: Ic49ac8630650b341aafb3c17abd22f3a07805d27
2012-12-09 02:59:04 +00:00
Platonides
4250770aee Make clear that reportConnectionError() stops the code flow.
Use it as if 'returning' a value for getConnection().
It doesn't make sense to sometimes add a return false and
sometimes not. But it was confusing that it looked like
wfProfileOut( __METHOD__ ); could be called twice.

Change-Id: I09638a134fcc925410389660f85239e8aa16483e
2012-11-26 22:41:52 +01:00
Aaron Schulz
33eb67af1d [Database] Fixed case where trx idle callbacks might be lost.
* (bug 41656) LoadBalancer always commits if there are callbacks pending.
  This works by checking a new DatabaseBase::writesOrCallbacksPending() function.
* Made transaction idle callbacks run in autocommit mode. Generally callers already
  want autocommit mode or do quick begin()/commit() calls anyway. The docs already
  make stat that callbacks should close any connections they start, but this makes
  it harder for people to forget about implicit transactions. Since the callbacks
  often may happen in commitMasterChanges(), if transactions are left open, they
  might not get committed by anything afterwards.
* Added sanity exceptions and warnings if callbacks get lost for some reason.
* Renamed trxIdleCallbacks -> mTrxIdleCallbacks for consistency.

Change-Id: I00e1e0fcdd7deeee1fbac6d0f295160479cb8962
2012-11-16 02:45:17 +00:00
daniel
34e6fe188a Fix flush-like commit in DeferredUpdates.
In the presence of DBO_TRX, commit() may be used like a "flush".
Added a flag to trigger this mode to commit() and changed DeferredUpdates
to used the flush mode.

Change-Id: I529117618194a2669535f3c5c0fed07588597299
2012-10-09 15:34:47 +02:00
daniel
985368cb9a Silenice trx warnings from LoadBalancer.
This is a follow-up to Idbe4a903.

LoadBalancer::commitMasterChanges used to cause a warning if an implicite
transaction was in progress. This is now supressed.

Note that warnign when an automatic transaction is committed explicitely,
it does make sense to issue a warning. But that should not be done for summary
commits when closing a connection, etc.

Change-Id: Id68c3607f6b9d930c00422baa6658b0651f2e42e
2012-10-09 12:30:54 +02:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Aaron Schulz
de0e9f09c5 Fixed mismatched profile calls in LoadBalancer.
Change-Id: I1ac81347b8af9b30dc03df94a76483a4ae4a6503
2012-09-29 11:52:48 -07:00
Aaron
522820ccaa Don't send COMMIT if not in a transaction.
Change-Id: Ifffbf703b15cd875feda1514d3c0d488b8665b66
2012-09-21 15:27:10 -07:00
Alexandre Emsenhuber
7525820cb7 Remove some debug output when opening a new database connection
Simplified the messages to avoid duplicates.

Change-Id: Ibcccc98bc18bdd0e0b876d9ad97f281c643eeabf
2012-09-18 14:01:02 +00:00
Alexandre Emsenhuber
78a56a67ba Added missing GPLv2 headers in includes/db.
Change-Id: Ib8fe301c6db77603e411113cea5a39c25c664961
2012-04-26 10:47:10 +02:00
Alexandre Emsenhuber
d97561461c Pass __METHOD__ to DatabaseBase::begin(), DatabaseBase::commit() and DatabaseBase::rollback() 2012-02-25 13:23:43 +00:00
Antoine Musso
73247df204 Remove backslash from @return types
Ping r111103
2012-02-13 16:35:59 +00:00
Sam Reed
c052fc3b7b Documentation followups from lastnight 2012-02-10 15:37:33 +00:00
Sam Reed
e1d83d5721 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 18:01:54 +00:00
Alexandre Emsenhuber
d109eae77f Pass some more __METHOD__ to DatabaseBase::begin() and DatabaseBase::commit() 2012-01-18 12:10:16 +00:00
Jeroen De Dauw
49cdca93be add missing deprecation notices and added deprecation version to existing ones 2011-12-13 05:19:05 +00:00
Sam Reed
5bfce03820 More documentation of parameters following up r104591 2011-12-05 16:50:58 +00:00
Sam Reed
39356de1a4 Moar documentations 2011-11-29 21:04:20 +00:00
Sam Reed
27665d27ae Update some deprecated code
Documentation

Fix "/*" comments to "/**"

Flesh out some missing returns, change some return types
2011-10-14 21:18:38 +00:00
Sam Reed
4d8c6dee24 Moar documentations 2011-09-16 17:58:50 +00:00
Sam Reed
e960fc9b39 Merge r90266 to trunk
Fixes fixme on r75341, r75343
2011-09-07 23:21:41 +00:00
Tim Starling
23f8346ce7 Further updates for r90643/r95647 in core and extensions. Fixed all callers of Database::getLag(), made them call a new function LoadBalancer::safeGetLag() instead, which doesn't cause fatal errors for non-replicated installations. The core updates are tested but the extension updates aren't. 2011-08-29 05:04:55 +00:00
Tim Starling
a3bf5ecb4a * Fix for r90643: in the case where there is only one server, implying no replication, make LoadBalancer::getLagTimes(), LoadMonitor_MySQL::getLagTimes() and LoadBalancer::getMaxLag() quickly report zero lag without attempting to do a SHOW SLAVE STATUS query.
* Updated the documentation to make it clear that REPLICATION CLIENT is required in a replicated setup. 
* Reverted r90773.
2011-08-29 04:42:26 +00:00
Sam Reed
8712062c94 Fix documentation (clearing w/c) 2011-08-24 12:47:42 +00:00
Sam Reed
7a06cb7d58 Add in \n from/to r95055 to LoadBalancer.php
Differentiate error messages from r95050 per Hashar
2011-08-21 15:24:44 +00:00
Sam Reed
5a2afad3b0 Upstream wikia changes 2011-08-19 23:19:26 +00:00
Chad Horohoe
498213cc9f Merge live hack - Extra debugging on connection failures 2011-08-01 23:28:06 +00:00