Commit graph

21 commits

Author SHA1 Message Date
Aaron Schulz
9ce9f5c4e4 Revert "rdbms: make getMasterPos() ignore GTIDs outside of gtid_domain_id"
This had a noticeable increase in LoadBalancer::doWait timeouts.

This reverts commit ceb7d61ee7.

Change-Id: I7004d55a05c20f646f70d778d7b6496123e270a4
2018-04-02 14:02:47 -07:00
Aaron Schulz
ceb7d61ee7 rdbms: make getMasterPos() ignore GTIDs outside of gtid_domain_id
* Filter out GTIDs with a domain that is not the one binlog
  events would be written to if the Database handle was given
  write queries. Likewise for the MariaDB server_id component.
* Also improve MySQL GTID support to better match that of MariaDB.
  This covers position retrieval, replication waiting, and ranges
  in GTIDs (which are almost always present).
* Make some MySQLMasterPos variables private by making use of
  accesors instead.
* Store the gtids array keyed by domain ID for convenience.
* Clean up dynamic call to static method.

Change-Id: Ic6ab517bc8f200c968ff892ade69ad1b9394ab21
2018-03-22 23:53:05 +00:00
Aaron Schulz
4ccb228bde rdbms: inject the mysql index name aliases into Database
Also added LBFactory::setTableAlias() for consistency with this

Change-Id: Ie49003ff8fd5b99f75db9fae8fe0a184444254d4
2018-03-12 18:51:53 +00:00
Timo Tijhof
a211db0f73 rdbms: Restore test for Database::setFlag()
Follows-up b4eb1feed0, which inadvertendly replaced the setFlag()
test with the clearFlag() test.

Also move the test to the DatabaseTest.php file given it's only
executing and covering base class.

Change-Id: I2f4ed6c4eeba845eb67013e1ab7d2b2bde863119
2018-03-08 04:32:21 +00:00
Aaron Schulz
b4eb1feed0 Remove FakeDatabaseMysqlBase test class
Improve some flag tests that did not seem to test much

Change-Id: Iecfc877645cc66cb696beb2b314a6d149745a530
2018-03-07 11:45:04 -08:00
addshore
0526f2d671 Introduce IDatabase::buildIntegerCast
Change-Id: Ib24856d1ebe017ff07ae497972c764b4a3f3c7df
2018-03-07 13:00:18 +00:00
Aaron Schulz
3b9e6bec3e rdbms: add missing hint check DatabaseMysqlBase::isInsertSelectSafe
This was lost when a bunch of other logic was split off in 671368a59e

Change-Id: I3d3f744f8fce007ecf88cbd2c9f99918b06f0573
2018-03-01 21:03:54 -08:00
Aaron Schulz
26d87a26fe rdbms: make DBMasterPos implement Serializable
ChronologyProtector uses these classes to briefly store positions
and everytime the fields change then errors can happen when old
values are unserialized and used. Use a simple two-element map
format for serialized positions. The fields are recomputed back
from the data map.

Values from before this change will issue the warning
"Erroneous data format for unserializing". To avoid that, bump
the ChronologyProtector key version. Future field changes will
not require this.

This change should be deployed on all wikis at once.

Bug: T187942
Change-Id: I71bbbc9b9d4c7e02ac02f1d8750b70bda08d4db1
2018-02-23 12:46:28 -08:00
jenkins-bot
cefb552df4 Merge "build: Updating mediawiki/mediawiki-codesniffer to 16.0.0" 2018-02-19 19:07:12 +00:00
Umherirrender
63d96c15fd build: Updating mediawiki/mediawiki-codesniffer to 16.0.0
Change-Id: I59b59f79bbf3ce4feff3b3a20c1c31bc16370531
2018-02-17 13:29:13 +01:00
Aaron Schulz
9b5b407a1b rdbms: make DatabaseMysql::masterPosWait() handle inactive GTIDs
Change-Id: I543deef24f6cbf99094a4f3bee7cabe768fa221a
2018-02-16 19:27:42 +00:00
Aaron Schulz
ab46e904fe rdbms: make MySQLMasterPos handle inactive GTIDs
Change-Id: I328142a9fe10bccb2717a0a392e0c50d0c070390
2018-02-15 22:55:29 +00:00
Aaron Schulz
a114bd9f4d rdbms: avoid "SHOW MASTER/SLAVE STATUS" queries in the GTID case
The binlog file/pos where only being used in __toString() for the GTID
case. Make that method use the GTID set instead and avoid querying the
old-fashioned binlog fields all together in that case. The STATUS
queries involve some global lock contention.

Bug: T180918
Change-Id: I18123a702e4f554b87bf5f90017b248062e73049
2018-02-08 09:26:48 -08:00
Aaron Schulz
6237fd11b6 rdbms: make affectedRows() work more consistently
* Update replace()/upsert() to combine the affected row
  count for the non-native case
* Also make replace() atomic in the non-native case,
  similar to how upsert() already works

Change-Id: I6c9bcba54eca6bcf4a93a9b230aaedf7f36aa877
2018-01-30 20:02:07 -08:00
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
Seb35
0ff2b7a776 Remove support for PHP extension 'mysql' (not mysqli!)
This PHP extension was deprecated in PHP 5.5 and removed in PHP 7.0.
The newer MySQL driver 'mysqli' is the default driver since MediaWiki
1.22 and 'mysql' was deprecated in MediaWiki 1.30.

Bug: T120333
Change-Id: Icff7a63ab47ae1483de87ba6486945974699362b
2018-01-17 10:48:47 -08:00
Kunal Mehta
75160bdd3b Use MediaWikiCoversValidator for tests that don't use MediaWikiTestCase
Change-Id: I8c4de7e9c72c9969088666007b54c6fd23f6cc13
2018-01-01 08:28:02 +00:00
Aaron Schulz
e0805d32e4 Disallow setting DBO_IGNORE in Database for sanity
In the off chance something called this, it would break all
sorts of code that expects that either query result functions
either succeed or throw an error.

Callers are not expected to have to check if the result of
a query is meaningful or false due to an error.

Change-Id: I0b4fe1403f55a399ffd40817ed12f857087d6f83
2017-11-29 21:31:03 +00:00
Umherirrender
86463f3df6 build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
Change-Id: Iefaae5043fa77d5d556c31079549dab8f61bd3ef
2017-09-10 21:11:37 +02:00
Timo Tijhof
ddb7575e4e rdbms: Refactor DatabaseTest
* Move DatabaseTest and DatabaseSQLTest to libs,
  and remove MediaWikiTestCase dependency.

* Refactor DatabaseTest to be a test of the Database abstract class,
  not of whatever current DB backend is configured by LocalSettings.

  - Remove most switches/conditionals and other tests for specific
    database backends. Move those to individual test classes for
    those backends instead.
  - Some tests appear to have been integration tests for the PHP driver
    and/or the db backend itself. Moved to a new DatabaseIntegrationTest.
  - Now that only the abstract Database is invoked, the test runs a bit
    faster (no real connections/queries).

* Add missing @covers tags, and remove or fix broken ones
  (follows-up 26e52f0c49).

Change-Id: I9dc4a558e701d00e95789e7eb8e02926783b65ad
2017-07-20 18:23:37 -07:00
Timo Tijhof
b857284f71 rdbms: Move DatabaseMysqlBaseTest to libs tests
* Remove MediaWikiTestCase dependency.
* Add missing @covers tags.
* Add missing visibility/static declarations.

Change-Id: I2d81a9265016174e7b4ff810f140f7d031ce9f14
2017-07-20 17:15:25 -07:00
Renamed from tests/phpunit/includes/db/DatabaseMysqlBaseTest.php (Browse further)