rdbms: allow callers to hint that native insertSelect() is safe
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 8 Feb 2018 19:18:24 +0000 (14:18 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 28 Feb 2018 18:58:37 +0000 (13:58 -0500)
commit99b65649c0f9b4ab1156cfc2ee50959d4b8a12c6
tree8f9564c07b729179cd7825a6d981544e890abed9
parentaefb143a8e8c963d6fedb471bbdace284be88196
rdbms: allow callers to hint that native insertSelect() is safe

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
includes/installer/MysqlUpdater.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseMysqlBase.php
includes/libs/rdbms/database/IDatabase.php
tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php