Certain server configurations, including the current MariaDB defaults,
make INSERT SELECT unsafe for replication in MySQL/MariaDB. When the
server configuration is not known to be safe, force the use of the
non-native implementation. Note this only has effect in CLI mode, as
non-CLI mode already forces the non-native implementation since
I2dba6024.
Also, native INSERT SELECT won't be safe with any statement-based
replication method if the order of rows in the SELECT is not
deterministic. Add a warning to the method's documentation pointing this
out.
Change-Id: I9173f6559809bd01830bd0a9f443c7269cc58ce2
Whether the lock() acquisition failing is a huge problem depends
on what the caller is doing. Let the caller do any logging it needs.
Bug: T180793
Change-Id: I3d05138d312d8b973df153bb511e69619d663c9d
Throw DBQueryTimeoutError if a database query error is detected
to be a timeout.
Only DatabaseMysqlBase has been updated here.
This is a subclass of DBQueryError, so existing catch'es will work.
Bug: T175775
Change-Id: I4749dc33ad530d9b22504f02106b1ca49e8eb167
Optimize for the common case where lag does not strictly increase
during trip times instead of being pessimistic.
Change-Id: Ibb0e3faad23862d397e1cc2a9f7e2a8293fa5f2b
The table name generated by Database::tableName() does not work in
MysqlBase's tableExist method, as the syntax of SHOW TABLES does not
function like other foreign db queries. It instead should use FROM
$database rather than the database name in front of the table name.
Bug: T168207
Change-Id: I7806090eaa647959fd34de8bc606eeb952161529
A new method is now available to check whether session scope
locks are supported, which callers typically want when using lock().
Its usage can avoid deadlock prone and expensive row-level locks for
some maintenance tasks.
For Postgres, table locks are tied to the transaction. Trigger
startAtomic() in lockTables() and endAtomic() in unlockTables() to
assure that a transaction is present.
Also remove LOW_PRIORITY feature, which is ignored by mysql.
Change-Id: I499061bcc2763afb1ff4a43319064eed4ba3a8fe
Move Sqlites's indexName to Database to have no remapping by default.
This is because MSSQL and Postgresql both don't need remapping, it's
just MySQL that's the problem.
So move the one from Database into MysqlBase to only do the remappings
there.
Also fix up the comments to make them less vague, not mentioning tables
when the function has no table parameter passed, so hence, no context
as to which table said index is wanted to be used
Bug: T154872
Change-Id: I46c575771e6cb36176bcf6cd1a865b703db0275d
The TitleValue constructor, used by the link cache among other things,
throws an exception for DB keys which do not satisfy a simple sanity test
(starting or ending with _, or containing a space, tab, CR or LF
character). This has broken certain special pages on a number of WMF sites;
see T99736, T146778 and T155091.
The new cleanupInvalidDbKeys.php script allows these bogus entries to be
removed from the DB, making sure these exceptions won't be thrown in the
future. It cleans the title columns of the page, archive, redirect,
logging, category, protected_titles, recentchanges, watchlist, pagelinks,
templatelinks, and categorylinks tables.
The script doesn't support batching; most wikis should have fewer than 500
broken entries in each table. If need be, the script can be run several
times.
To make the LIKE queries work properly I had to fix the broken escaping
behaviour of Database::buildLike() -- previously it had a habit of double-
escaping things. Now an ESCAPE clause is added to change the escape
character from the problematic default backslash, and tests are added to
cover the changes.
Bug: T155091
Change-Id: I908e795e884e35be91852c0eaf056d6acfda31d8
Use HTTPS instead of HTTP where the HTTP link is a redirect to the HTTPS link.
Also update some defect links.
Change-Id: Ic3a5eac910d098ed5c2a21e9f47c9b6ee06b2643
* Make isTransactableQuery() exclude CREATE/ALTER.
Starting transactions for schema changes like this can cause
errors as it is not supported for MySQL and some Postgres
operations. Note that temporary tables are session-level,
so they are not effected by this change.
* Clean up the transaction logic in determineCoreSchema()
so a transaction is not left dangling.
* Fix broken getSchemaPath() call in PostgresInstaller.
* Avoid warnings in DatabasePostgres::closeConnection() if
mConn is already unset.
* Commit master changes in doMaintenance.php before running
deferred updates, just as MediaWiki.php does.
* Change E_WARNING to E_USER_WARNING to avoid notices in the
default /rdbms error handlers.
* Also avoid trying to rollback in MWExceptionHandler if the
LBFactory service is disabled, which just results in an error.
Bug: T147599
Change-Id: I64ccab7f9b74f60309ba0c9a8ce68337c42ffb0f
Comparing a string column to 0 will produce spurious matches, and it is easy
to get a false value in unexpected places. Comparing an int column to '0'
does not seem to cause any problems.
Bug: T147537
Change-Id: I5ad547de509b3417b5937be6bdda9befb8aed8b6
Also make the temp table tracking catch plain "DROP TABLE"
in addition to the stricter "DROP TEMPORARY TABLE" clause.
Bug: T146300
Change-Id: Ia8306ec25e63adcdcf0dcc8f6a700dd01afdc948
Use SHOW TABLES to avoid log spam when the table does not exist.
This should make the CLI jenkins log a bit more readable.
Change-Id: I027a9d0af0e42959e9f03cebb295218068a263d3