From 8538ff6e11ff14bd37bbaef55c182d98b6c8b99d Mon Sep 17 00:00:00 2001 From: Doug Shelley Date: Wed, 20 Jul 2016 19:11:58 +0000 Subject: [PATCH] Fix xtrabackup-binlog file GTID parsing The code responsible for pulling the last GTID reference from snapshot backup restored to the replica only handled the case where the GTID reference contained one gtid. There are common replication use cases where the GTID reference in the file is comma separated list of GTID references. Change the code from using the CSV reader to just read the entire file and split it on tabs. This will guarantee that we get the full list of GTID references in the file. Change-Id: Ibbde5a4daa9741e1b997a618288bf6d469356bfe Closes-bug: 1604914 --- releasenotes/notes/fix-gtid-parsing-9f60ad6e9e8f173f.yaml | 5 +++++ trove/guestagent/strategies/replication/mysql_gtid.py | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/fix-gtid-parsing-9f60ad6e9e8f173f.yaml diff --git a/releasenotes/notes/fix-gtid-parsing-9f60ad6e9e8f173f.yaml b/releasenotes/notes/fix-gtid-parsing-9f60ad6e9e8f173f.yaml new file mode 100644 index 0000000000..7c2416a9eb --- /dev/null +++ b/releasenotes/notes/fix-gtid-parsing-9f60ad6e9e8f173f.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - Fixed parsing of GTID references containing a list + of GTIDs from xtrabackup_binlog_info file on + MySql replicas. diff --git a/trove/guestagent/strategies/replication/mysql_gtid.py b/trove/guestagent/strategies/replication/mysql_gtid.py index f25606b907..b60c95a287 100644 --- a/trove/guestagent/strategies/replication/mysql_gtid.py +++ b/trove/guestagent/strategies/replication/mysql_gtid.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. # -import csv - from oslo_log import log as logging from trove.common import cfg @@ -75,8 +73,7 @@ class MysqlGTIDReplication(mysql_base.MysqlReplicationBase): LOG.info(_("Reading last master GTID from %s") % INFO_FILE) try: with open(INFO_FILE, 'rb') as f: - row = csv.reader(f, delimiter='\t', - skipinitialspace=True).next() + row = f.read().split('\t') return row[2] except (IOError, IndexError) as ex: LOG.exception(ex)