Skip to content

Commit 5be7c46

Browse files
authored
sidecar:prevent useless clone data when booting sidecar (#554)
sidecar:prevent useless clone data when booting sideca
1 parent f6ad74a commit 5be7c46

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sidecar/init.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ func runCloneAndInit(cfg *Config) error {
9191
}
9292

9393
if len(serviceURL) != 0 {
94+
// Check has initialized. If so just return.
95+
hasInitialized, _ := checkIfPathExists(path.Join(dataPath, "mysql"))
96+
if hasInitialized {
97+
log.Info("MySQL data directory existing!")
98+
return nil
99+
}
94100
// backup at first
95101
Args := fmt.Sprintf("rm -rf /backup/initbackup;mkdir -p /backup/initbackup;curl --user $BACKUP_USER:$BACKUP_PASSWORD %s/download|xbstream -x -C /backup/initbackup; exit ${PIPESTATUS[0]}",
96102
serviceURL)

0 commit comments

Comments
 (0)