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
This commit is contained in:
Doug Shelley 2016-07-20 19:11:58 +00:00
parent d41d773cb3
commit 8538ff6e11
2 changed files with 6 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
fixes:
- Fixed parsing of GTID references containing a list
of GTIDs from xtrabackup_binlog_info file on
MySql replicas.

View File

@ -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)