Commit graph

19 commits

Author SHA1 Message Date
Aaron Schulz
b64a178a21 Fixes to masterPosWait() for master switchovers
* Clean up return value types and docs.
* Handle master switch-over better w.r.t the job queue due
  to binlog name changes (the host portion). Previously the method
  would fail and trigger read-only mode when waiting on former
  master positions. Assume the the switch-over was done properly
  and thus return immediately.

Bug: T126436
Change-Id: Ib8c05a5c72d03a5c98e41b23c5653fc194b6d130
2016-03-08 03:37:44 -08:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Aaron Schulz
9c0b55d926 Make getLagFromPtHeartbeat() always use the LB cluster master entry
Before, it just used the immediate master entry, which could be another
slave. In that case, it may not even exists at all.

Bug: T119648
Change-Id: Iea970b81ad2c9855aafcccf0bb0662fc0b3a8d4d
2015-12-09 22:00:19 -08:00
Aaron Schulz
da4a378e74 Improve LoadBalancer::doWait() performance via APC
* This avoids bothering with MASTER_POS_WAIT() if an equal/higher
  position was already successfully waited on by another process.
* Add DBMasterPos toString() and hasReached() methods, which
  MySQLMasterPos already implemented and used.
* Moved more wfDebug() statements to the 'replication' log.

Change-Id: I423b5fe2da8d97889a6d204a635e351342de7649
2015-11-10 05:07:39 +00:00
Aaron Schulz
b11abb540f Fix DatabaseMysqlBase.php IDEA errors
* Declare base mysqlRealEscapeString()
* Fix MySQLField::tableName() return value

Change-Id: I1277166e741e69cb1c045b3baa6ed8de664e9255
2015-10-03 18:28:17 -07:00
Vivek Ghaisas
9f5b6f5aeb Fix whitespace issues around parentheses
Fix issues found by MediaWiki.WhiteSpace.SpaceyParenthesis sniff.

Bug: T102617
Change-Id: Iec7f71e64081659fba373ec20d9d2006306a98f4
2015-06-16 22:14:02 +03:00
Timo Tijhof
ff6513f28b Remove '@section LICENSE'
This was used in 2 special classes, the logger classes and spread
to a few other random classes.

Afaik this has no meaning. Is for something we don't use, and
goes against the meaning of '@section' in Doxygen, which we do
use.

In Doxygen output, all LICENSE references became links to
ProfilerXhprof (the one Doxygen encoutered first).

Bug: T72328
Change-Id: Icc7c443245c70bc0f549bee7d105eef5691c864d
2014-11-26 02:20:55 +00:00
Siebrand Mazeland
1742e9448c Pass phpcs-strict on some test files (6/11)
Change-Id: I5f4bc0df8183cf338ff45cacfc7279c2cd38ee04
2014-04-24 18:26:19 +00:00
Kevin Israel
bc06a9b8b7 Abstract out mysql_field_type() call from DatabaseBase
DatabaseMysqlBase::fieldType() is used in the maintenance script
convertLinks.php for upgrading from MediaWiki 1.2 or earlier. This
script was failing when the mysqli extension was enabled.

Follows-up b1cc3511fd, b2d64432ee, and 00299ecb95.

Change-Id: I5d888f4dd344ecba15506023d35f6d2d6e24cfd8
2013-12-15 18:40:50 +00:00
umherirrender
5dbfd5bf80 Fixed spacing
- Removed trailing spaces in comments
- Removed multiple empty lines
- Removed space after object operator

Change-Id: I9fd3256ab490c7cd2034de3fd94e6be6e6d6d8f2
2013-11-21 18:52:25 +00:00
umherirrender
f153998317 Fixed spacing
- Removed double spaces
- Added space after if/switch/foreach
- Removed space on elseif
- Added space around parentheses
- Added newline at end of file
- Removed space before semicolon at end of line

Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
2013-11-19 19:03:54 +01:00
Alexandre Emsenhuber
a222905098 Use the native set_charset() method if available instead of SET NAMES
According to the PHP manual, it is the recommended way to set the charset.

- mysql extension has it for MySQL >= 5.0.7
- mysqli extension has it for MySQL >= 5.0.6
or if using mysqlnd.

Change-Id: I8cd2f97fcad4b045c6f99ff894254847b13c6878
2013-11-16 07:57:52 +00:00
jenkins-bot
164f334e53 Merge "Cleaned up DatabaseBase constructor to use an array" 2013-11-07 19:36:22 +00:00
AlephNull
e9d53667f4 MySQL method to find out view + fix fatal in tests
We were missing a method to list out views defined in a database. This
patch adds in MysqlBase::isView() and MysqlBse::listViews().

Since listViews() cache its result in DatabaseBase::$allViews, we also
introduce a final DatabaseBase::clearViewsCache() to let us clear the
per process cache.

Finally, fixed fatal error when duplicating VIEWs in MySQL.

bug: 43571
Change-Id: I8650baa4b721fe69ea3e1d557dd76745c0c7754e
2013-11-07 09:43:59 +00:00
Aaron Schulz
58a0e0c06d Cleaned up DatabaseBase constructor to use an array
Change-Id: I094185585dc844ca4d2d8b629107b2ab8f9bef39
2013-11-06 12:17:15 -08:00
addshore
de7af7ac2c Fix scope on all /phpunit test methods
Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
2013-10-24 10:31:32 +02:00
addshore
26e52f0c49 Add @covers for main Database test types
Change-Id: I010ff5ce7afd85c7f9d528a98f2448547874b8b3
2013-10-18 12:36:09 +02:00
Chad Horohoe
7d1cd6c376 Remove silly test cases that are likely to fail
Nobody should be giving objects or arrays to addIdentifierQuotes() anyway

Change-Id: Ibebf5d32196ac5b80cd477aedfef982fd2c9a0e6
2013-10-09 18:14:42 -07:00
Bryan Davis
cfde3c1958 Escape backticks when quoting MySQL identifiers
Previously mysql_real_escape_string() was improperly used which escapes
for inclusion in a plain string rather than an identifier.

Also adds basic test support for the DatabaseMysqlBase class.

Co-Authored by: Antoine Musso <hashar@free.fr>
Bug: 55427
Change-Id: Ic045e195c89d8d5d0f0edbda0cd1df781de7025c
2013-10-09 15:43:45 -06:00