An INSERT SELECT in MySQL/MariaDB is unsafe for replication if a column
is getting values from auto-increment, statement-based replication is in
use, and the default innodb_autoinc_lock_mode is set.
I9173f655 added checks to force non-native insertSelect for the
statement-based replication and innodb_autoinc_lock_mode != 2 case, but
determining whether a column is getting values from auto-increment is
too hard to do automatically there.
Instead, let's add a flag to let the caller hint that the query isn't
getting any auto-increment values. And use it in MysqlUpdater when
appropriate.
Bug: T160993
Change-Id: If70450a64aa3bcbf763c62838bb21306d124ae3d
It would be easy for a call to nonNativeInsertSelect() to generate an
INSERT that's too big for the database to actually process. Add batching
to try to avoid that.
Bug: T160993
Change-Id: I1de994208d95926f0d75c0d7cab7b5fe1dd565c3
* Make sure all unique keys specified have all their values
provided to avoid large bogus DELETEs. Do not ignore them
in such cases either, as that would cause inconsistencies
between the native and non-native case. Use an exception.
* Make ChangeTags caller clearer that the list of indexes
is not a list of fields for a single index. Also, avoid
mentioning indexes for values not defined in the new
records, as this causes errors or inconsistencies with
the native vs non-native case.
* This also fixes the "Undefined index: ts_log_id" error
when running unit tests on postgres.
Change-Id: I30263df22066bd6d4836202b1bcad5d1aa1e7383
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable
For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore
Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
Only missing cases where 'USE INDEX' and 'IGNORE INDEX'.
The test doesn't do much since the underlying methods are no-ops
by default, but at least it ensures there are no PHP errors from
these branches.
We can later re-use some of these test cases in tests specific
to one backend.
Change-Id: Id004a2ae41efaa7a367f964013e25d98ecc591ff
* Add case for `$tables[0] == ' '`.
* Add case for `$tables == ''`.
* Add case for 'DISTINCT' option.
* Add case for 'FOR UPDATE' option.
* Add case for 'LOCK IN SHARE MODE' option.
* Add case for 'EXPLAIN' option.
Change-Id: I4a5f4754bc30d31ec35a085f39321fd358b6aa49
Many of the main methods here have, over the years, been split up
into several protected/private methods.
Change-Id: I1b8489b1c61c0294288442a0a0cd28c9fa77f82e
* 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
Renamed from tests/phpunit/includes/db/DatabaseSQLTest.php (Browse further)