| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
* parent::setUp() should be first, and ::tearDown()
should be last
* Move tests that directly extend PHPUnit\Framework\TestCase
to /unit
Change-Id: I1172855c58f4f52a8f624e6d596ec43beb8c93ff
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a string starts with "DELIMITER" but the word is *not* followed by
a space, the code will set $this->delimiter to null, possibly resulting
in all kinds of hard to track errors.
Even more problematic: the preg_match was *not* case-insensitive, but the
condition was. Which means that all non-uppercase "delimiter …" would
result in the same error.
I'm not sure if it's worth keeping the additional string comparison for
performance reasons. Probably not. That comparison is slow as well, and
preg_match is surprisingly fast (when the pattern is properly written,
which it is).
Change-Id: I33944b7a2410f77e67ce7450af0359a88d39f1aa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the DBO_TRX init logic out of Database::__construct() and into
LoadBalancer since the later already handles setting and clearing this
flag based on transaction rounds starting and ending.
Add 'lazyMasterHandle', 'topologyRole', and 'topologicalMaster' parameters
to Database::factory() and inject them via LoadBalancer all at once in order
to avoid worrying about call order. Move some type casting code to
Database::__construct().
Add IDatabase::getTopologyRole()/getTopologicalMaster().
Use constants for getLBInfo()/setLBInfo() for better usage tracking and
typo resistance.
Change-Id: I437ce434326601e6ba36d9aedc55db396dfe4452
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These type hints make it easier to follow the code paths and understand
what code is actually under test here. A few of these tests appear to
be misplaced, as they don't cover any code in the DatabaseMysqlBase
class.
This also makes all @covers tags absolute so more tools can understand
them (e.g. PHPStorm doesn't).
Change-Id: I43c69be994d6094239954ea662801c1e7e8e2e41
|
| |
| |
| |
| |
| |
| |
| | |
This process will be broken up into several parts for reviewability.
Bug: T192167
Change-Id: Ie415fd3308384a5ca2b3de24ba037785f8a3a714
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
assertEquals( false, … ) still succeeds when the actual value is 0, null,
an empty string, even an empty array. All these should be reported as a
failure, I would argue.
Note this patch previously also touched assertSame( false ). I reverted
these. The only benefit would have been consistency within this codebase,
but there is no strict reason to prefer one over the other. assertFalse()
and assertSame( false ) are functionally identical.
Change-Id: Ic5f1c7d504e7249002d3184520012e03313137b4
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In masterPosWait(), only $pos will have the known active domain/server set
since it usually comes from getMasterPos(). However, the reference position,
from getReplicaDB(), does not have the active domains set since querying
gtid_domain_id on the replica would be incorrect and getting a connection
to the master could be expensive.
Remove obsolete hacks for jobs that used to store master positions.
Also, use the regular Database::query() method for stylistic consistency.
Bug: T224422
Change-Id: I41bbb9f337e46451aa17788dbd446db4a213a5a7
|
|
|
|
|
|
|
|
|
| |
This reverts commit 45831e619c5e667ae1201bcdacfb8d4dcce10b41.
Reason for revert: Caused beta not work at all.
Bug: T231162
Change-Id: Icc5c1fa0dc01082a622641ad96c22c939cd56d48
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make LoadBalancer::reallyOpenConnection() handle initializing DBO_TRX
instead of Database::__construct().
Also:
* Avoid having the "catch" block appear like it returns a
half-constructed Database.
* Use the variable name $conn instead of $db to be consistent
throughout the class. Only send Database::__construct() parameters
that it recognizes instead of mixing in setLBInfo() data.
Change-Id: Iffc3d1d0713051a164adb51a4c4ee12e4ac887c3
|
|
|
|
|
|
|
|
| |
This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9.
Reason for revert: Broke postgres tests.
Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.
The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.
You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml
Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
|
|
|
|
| |
Change-Id: I370275bb6c5d456b73f6a5f782e231f16c2b0fbe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
LoadBalancer uses Database::getDomainId() for deciding which keys to use
in the foreign connection handle arrays. This method should reflect any
changes made to the DB selection.
If the query fails, then do not change domain field. This is the sort of
approach that LoadBalancer is expects in openForeignConnection(). Also,
throw an exception when selectDB() fails.
The db/schema/prefix fields of Database no longer exist in favor of just
using the newer currentDomain field.
Also:
* Add IDatabase::selectDomain() method and made selectDB() wrap it.
* Extract the DB name from sqlite files if not explicitly provided.
* Fix inconsistent open() return values from Database subclasses.
* Make a relationSchemaQualifier() method to handle the concern of
omitting schema names in queries. The means that getDomainId() can
still return the right value, rather than confusingly omitt the schema.
* Make RevisionStore::checkDatabaseWikiId() account for the domain schema.
Unlike d2a4d614fce09c, this does not incorrectly assume the storage is
always for the current wiki domain. Also, LBFactorySingle sets the local
domain so it is defined even in install.php.
* Make RevisionStoreDbTestBase actually set the LoadBalancer local domain.
* Make RevisionTest::testLoadFromTitle() account for the domain schema.
Bug: T193565
Change-Id: I6e51cd54c6da78830b38906b8c46789c79498ab5
|
|
|
|
|
|
|
| |
This is a follow-up to Idc3dee3a7fb5ebfaef395754d8859b18f1f8769a
containing some less trivial changes.
Change-Id: Ia7af2c1d000307d43278cde4a246df413d4ef263
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If it is known that master writes will use GTIDs with a certain
domain and server ID, ignore other ones on masterPosWait().
This restores ceb7d61ee except it uses the same server variables
and MySQLMasterPos preserves the active server/domain information
across serialization.
Change-Id: I1a4f143adcbec642966d7d1a55edb0f414a7f0c4
|
|/
|
|
| |
Change-Id: I27a21fa9e97414fae02acbefb28011f0275cba63
|
|
|
|
|
|
|
|
| |
This had a noticeable increase in LoadBalancer::doWait timeouts.
This reverts commit ceb7d61ee7ef3edc6705abd41ec86b3afcd9c491.
Change-Id: I7004d55a05c20f646f70d778d7b6496123e270a4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
| |
Also added LBFactory::setTableAlias() for consistency with this
Change-Id: Ie49003ff8fd5b99f75db9fae8fe0a184444254d4
|
|
|
|
|
|
|
|
|
|
| |
Follows-up b4eb1feed05b5, 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
|
|
|
|
|
|
| |
Improve some flag tests that did not seem to test much
Change-Id: Iecfc877645cc66cb696beb2b314a6d149745a530
|
|
|
|
| |
Change-Id: Ib24856d1ebe017ff07ae497972c764b4a3f3c7df
|
|
|
|
|
|
| |
This was lost when a bunch of other logic was split off in 671368a59e3
Change-Id: I3d3f744f8fce007ecf88cbd2c9f99918b06f0573
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I59b59f79bbf3ce4feff3b3a20c1c31bc16370531
|
|/
|
|
| |
Change-Id: I543deef24f6cbf99094a4f3bee7cabe768fa221a
|
|
|
|
| |
Change-Id: I328142a9fe10bccb2717a0a392e0c50d0c070390
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
| |
This helps to find renamed or misspelled classes earlier.
Phan will check the class names
Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: I8c4de7e9c72c9969088666007b54c6fd23f6cc13
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
Change-Id: Iefaae5043fa77d5d556c31079549dab8f61bd3ef
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 26e52f0c491a4).
Change-Id: I9dc4a558e701d00e95789e7eb8e02926783b65ad
|
|
* Remove MediaWikiTestCase dependency.
* Add missing @covers tags.
* Add missing visibility/static declarations.
Change-Id: I2d81a9265016174e7b4ff810f140f7d031ce9f14
|