From dc2bb56122d3ca4b13f925b8a1bc414bec056638 Mon Sep 17 00:00:00 2001 From: zhifei92 <13641019076@163.com> Date: Thu, 17 Sep 2020 18:26:58 +0800 Subject: [PATCH] fix: #363 --- pkg/sidecar/appconf.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/sidecar/appconf.go b/pkg/sidecar/appconf.go index 7791992ec..b07e2bc6d 100644 --- a/pkg/sidecar/appconf.go +++ b/pkg/sidecar/appconf.go @@ -187,6 +187,13 @@ func initFileQuery(cfg *Config, gtidPurged string) []byte { []string{"CREATE", "SELECT", "DELETE", "UPDATE", "INSERT"}, fmt.Sprintf("%s.%s", toolsDbName, toolsHeartbeatTableName), []string{"REPLICATION CLIENT"}, "*.*")...) + // the slave pod doesn't need to back up sys_operator.status, Xtrabackup might have some bugs that + // cause the table to be unclean. We can do this cleanup before the slave pod starts to avoid accidents. + if !cfg.IsFirstPodInSet() { + queries = append(queries, fmt.Sprintf("DROP TABLE IF EXISTS %s.%s", + constants.OperatorDbName, constants.OperatorStatusTableName)) + } + // create the status table used by the operator to configure or to mask MySQL node ready // CSV engine for this table can't be used because we use REPLACE statement that requires PRIMARY KEY or // UNIQUE KEY index. Also, the table may exists (in case of pod restart) and should not be changed.