Browse Source

Add --skip-locks flag to mysql-migrate-db.sh

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.

Change-Id: I3df5686d13c1ce0cc38402a1317acb661ad74cec
Story: #2006670
changes/56/687056/2
Corey Bryant 3 years ago
parent
commit
47e31b894e
  1. 6
      doc/source/admin/upgrade-to-stein.rst
  2. 10
      placement_db_tools/mysql-migrate-db.sh

6
doc/source/admin/upgrade-to-stein.rst

@ -162,6 +162,12 @@ Migrate the Data
$ 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
``/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

10
placement_db_tools/mysql-migrate-db.sh

@ -147,11 +147,12 @@ function migrate_data() {
# Usage: migrate_data NOVA_API PLACEMENT -> 0
local source="$1"
local dest="$2"
local dump_flags="$3"
local tmpdir=$(mktemp -d migrate-db.XXXXXXXX)
local tmpfile="${tmpdir}/from-nova.sql"
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:'
show_error
return 1
@ -223,6 +224,7 @@ function show_help() {
echo " --help: this text"
echo " --migrate: actually do data migration"
echo " --mkconfig: write/update config to \$rcfile"
echo " --skip-locks: don't use table locks for data migration"
echo
echo "Pass '-' as \$rcfile if all config values are set in"
echo "the environment."
@ -292,7 +294,11 @@ fi
echo Nova database contains data, placement database does not. Okay to proceed with migration
if getflag migrate $*; then
migrate_data NOVA_API PLACEMENT
if getflag skip-locks $*; then
migrate_data NOVA_API PLACEMENT "--skip-lock-tables --skip-add-locks"
else
migrate_data NOVA_API PLACEMENT
fi
placement-manage db stamp $INITIAL_PLACEMENT_DB_VERSION
else
echo "To actually migrate, run me with --migrate"

Loading…
Cancel
Save