[DOC] cpat example for xtrabackup-v2 breaks the SST

Bug #1495858 reported by Przemek
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC
Status tracked in 5.6
5.5
Confirmed
Low
Unassigned
5.6
Confirmed
Low
Unassigned

Bug Description

https://www.percona.com/doc/percona-xtradb-cluster/5.5/manual/xtrabackup_sst.html#cpat
https://www.percona.com/doc/percona-xtradb-cluster/5.6/manual/xtrabackup_sst.html#cpat

The example regex presented there leads to .sst directory removal when the SST already started using it. The wsrep_sst_xtrabackup-v2 debug mode output fragment:

+ mkdir -p /opt/data/mysql//.sst
+ jpid=20385
+ ps -p 20106
+ recv_joiner /opt/data/mysql//.sst Joiner-Recv-SST 0
+ local dir=/opt/data/mysql//.sst
+ local msg=Joiner-Recv-SST
+ local tmt=0
+ local ltcmd
+ pushd /opt/data/mysql//.sst
(...)
+ find /opt/data/mysql/ -mindepth 1 -regex '.*galera\.cache$\|.*sst_in_progress$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$\|.*\.xyz$' -prune -o -exec rm -rfv '{}' +
removed directory: `/opt/data/mysql/.sst'

And following error on the joiner node:

WSREP_SST: [INFO] Cleaning the existing datadir and innodb-data/log directories (20150915 07:32:56.599)
removed directory: `/opt/data/mysql/.sst'
removed `/opt/data/mysql/performance_schema/events_waits_history.frm'
(...)
WSREP_SST: [INFO] Waiting for SST streaming to complete! (20150915 07:32:56.661)
^Gxbstream: Can't create/write to file '././backup-my.cnf' (Errcode: 2 - No such file or directory)
xbstream: failed to create file.
2015/09/15 07:33:08 socat[19593] E write(1, 0x13af440, 1815): Broken pipe

in my.cnf:
[sst]
cpat ='.*galera\.cache$\|.*sst_in_progress$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$\|.*\.xyz$'

The regex above is meant to list the files and directories, that should NOT be removed during SST, while the result does not work for .sst:

[root@pxc552 ~]# mkdir /opt/data/mysql/.sst
[root@pxc552 ~]# find /opt/data/mysql/ -mindepth 1 -regex '.*galera\.cache$\|.*sst_in_progress$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$\|.*\.xyz$'
/opt/data/mysql/RPM_UPGRADE_HISTORY
/opt/data/mysql/innobackup.move.log
/opt/data/mysql/innobackup.prepare.log
/opt/data/mysql/pxc552_error.log
/opt/data/mysql/grastate.dat
/opt/data/mysql/galera.cache

An example of fixed regex:
[root@pxc552 ~]# find /opt/data/mysql/ -mindepth 1 -regex '.*galera\.cache$\|.*sst_in_progress$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$\|.*sst$'
/opt/data/mysql/.sst
/opt/data/mysql/RPM_UPGRADE_HISTORY
/opt/data/mysql/innobackup.move.log
/opt/data/mysql/innobackup.prepare.log
/opt/data/mysql/pxc552_error.log
/opt/data/mysql/grastate.dat
/opt/data/mysql/galera.cache

In addition to fix the regex, this sentence needs to be corrected: "This option provides the ability to define the files that need to be deleted before the SST." The true meaning is that it defines the files that need to be excluded from deletion.

Tags: i59339
Revision history for this message
Przemek (pmalkowski) wrote :

One correction, the cpat option is used to actually modify the default exclusion regex. When cpat is not explicitly set, xtrabackup-v2 uses this one:

+ find /opt/data/mysql/ -mindepth 1 -regex '.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$' -prune -o -exec rm -rfv '{}' +

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXC-1154

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.