Merge "Add --skip-locks flag to mysql-migrate-db.sh" into stable/train
This commit is contained in:
commit
36beddbaf5
|
@ -162,6 +162,12 @@ Migrate the Data
|
||||||
|
|
||||||
$ mysql-migrate-db.sh --migrate /tmp/migrate-db.rc
|
$ mysql-migrate-db.sh --migrate /tmp/migrate-db.rc
|
||||||
|
|
||||||
|
The ``--skip-locks`` flag can be used along with ``--migrate`` in
|
||||||
|
deployments where table locking operations can't be performed. For example,
|
||||||
|
Percona XtraDB Cluster only has experimental support for explicit table
|
||||||
|
locking operations and attempts to use locking will result in errors when
|
||||||
|
PXC Strict Mode is set to ENFORCING.
|
||||||
|
|
||||||
If your controller host (the one where you have been editing
|
If your controller host (the one where you have been editing
|
||||||
``/etc/placement/placement.conf``) and database host are not the same, and
|
``/etc/placement/placement.conf``) and database host are not the same, and
|
||||||
you have run the migration script on the database host, the final step in
|
you have run the migration script on the database host, the final step in
|
||||||
|
|
|
@ -147,11 +147,12 @@ function migrate_data() {
|
||||||
# Usage: migrate_data NOVA_API PLACEMENT -> 0
|
# Usage: migrate_data NOVA_API PLACEMENT -> 0
|
||||||
local source="$1"
|
local source="$1"
|
||||||
local dest="$2"
|
local dest="$2"
|
||||||
|
local dump_flags="$3"
|
||||||
local tmpdir=$(mktemp -d migrate-db.XXXXXXXX)
|
local tmpdir=$(mktemp -d migrate-db.XXXXXXXX)
|
||||||
local tmpfile="${tmpdir}/from-nova.sql"
|
local tmpfile="${tmpdir}/from-nova.sql"
|
||||||
|
|
||||||
echo "Dumping from $source to $tmpfile"
|
echo "Dumping from $source to $tmpfile"
|
||||||
mysql_command $source mysqldump $MIGRATE_TABLES > $tmpfile || {
|
mysql_command $source mysqldump $dump_flags $MIGRATE_TABLES > $tmpfile || {
|
||||||
echo 'Failed to dump source database:'
|
echo 'Failed to dump source database:'
|
||||||
show_error
|
show_error
|
||||||
return 1
|
return 1
|
||||||
|
@ -223,6 +224,7 @@ function show_help() {
|
||||||
echo " --help: this text"
|
echo " --help: this text"
|
||||||
echo " --migrate: actually do data migration"
|
echo " --migrate: actually do data migration"
|
||||||
echo " --mkconfig: write/update config to \$rcfile"
|
echo " --mkconfig: write/update config to \$rcfile"
|
||||||
|
echo " --skip-locks: don't use table locks for data migration"
|
||||||
echo
|
echo
|
||||||
echo "Pass '-' as \$rcfile if all config values are set in"
|
echo "Pass '-' as \$rcfile if all config values are set in"
|
||||||
echo "the environment."
|
echo "the environment."
|
||||||
|
@ -292,7 +294,11 @@ fi
|
||||||
echo Nova database contains data, placement database does not. Okay to proceed with migration
|
echo Nova database contains data, placement database does not. Okay to proceed with migration
|
||||||
|
|
||||||
if getflag migrate $*; then
|
if getflag migrate $*; then
|
||||||
|
if getflag skip-locks $*; then
|
||||||
|
migrate_data NOVA_API PLACEMENT "--skip-lock-tables --skip-add-locks"
|
||||||
|
else
|
||||||
migrate_data NOVA_API PLACEMENT
|
migrate_data NOVA_API PLACEMENT
|
||||||
|
fi
|
||||||
placement-manage db stamp $INITIAL_PLACEMENT_DB_VERSION
|
placement-manage db stamp $INITIAL_PLACEMENT_DB_VERSION
|
||||||
else
|
else
|
||||||
echo "To actually migrate, run me with --migrate"
|
echo "To actually migrate, run me with --migrate"
|
||||||
|
|
Loading…
Reference in New Issue