Commit 938b2a18 authored by git's avatar git Committed by helmo

Issue #2857480 by helmo, kfolsom, jsedwick: MySQL Dumps containing Global...

Issue #2857480 by helmo, kfolsom, jsedwick: MySQL Dumps containing Global Transaction ID (GTID) Incompatible with Aegir
parent ff393c9d
......@@ -248,8 +248,19 @@ port=%s
// Set the umask to 077 so that the dump itself is non-readable by the
// webserver.
umask(0077);
// If a database uses Global Transaction IDs (GTIDs), information about this is written to the dump
// file by default. Trying to import such a dump during a clone or migrate will fail. So use the
// '--set-gtid-purged=OFF' option to suppress the restoration of GTIDs. GTIDs were added in MySQL version 5.6
if (drush_get_option('provision_mysqldump_suppress_gtid_restore', FALSE)) {
$gtid_option = '--set-gtid-purged=OFF';
} // if
else {
$gtid_option = '';
} // else
// Mixed copy-paste of drush_shell_exec and provision_shell_exec.
$cmd = sprintf("mysqldump --defaults-file=/dev/fd/3 --single-transaction --quick --no-autocommit %s", escapeshellcmd(drush_get_option('db_name')));
$cmd = sprintf("mysqldump --defaults-file=/dev/fd/3 %s --single-transaction --quick --no-autocommit %s", $gtid_option, escapeshellcmd(drush_get_option('db_name')));
// Fail if db file already exists.
$dump_file = fopen(d()->site_path . '/database.sql', 'x');
......
......@@ -27,6 +27,12 @@
*
* provision_create_local_settings_file
* Create a site 'local.settings.php' file if one isn't found, default TRUE.
*
* provision_mysqldump_suppress_gtid_restore
* Don't restore GTIDs from a database export. Set to TRUE for MySQL versions 5.6 and above to
* avoid having restores error out during operations such as cloning, migrating, and restoring from
* backup. Default is FALSE.
*
*/
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment