Since #4438 removed 2-way sync and treats any changed+newer files on disk as an error, we no longer need to determine if files are newer on disk/db or if there is a conflicting mix of both. Any changed+newer file is an error, unless we're doing a cluster reset in which case everything is unconditionally replaced.
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
returnerrors.Wrap(err,"cluster reset failed to back up server TLS dir")
}
}
varnewerOnDisk[]string
forpath,res:=rangeresults{
switch{
caseres.disk:
updateDisk=true
logrus.Warn("Datastore newer than "+path)
caseres.db:
ifc.config.ClusterReset{
logrus.Infof("Cluster reset: replacing file on disk: "+path)
updateDisk=true
continue
}
newerOnDisk=append(newerOnDisk,path)
caseres.conflict:
logrus.Warnf("Datastore / disk conflict: %s newer than in the datastore",path)
}
}
iflen(newerOnDisk)>0{
}elseiflen(newerOnDisk)>0{
logrus.Fatal(strings.Join(newerOnDisk,", ")+" newer than datastore and could cause a cluster outage. Remove the file(s) from disk and restart to be recreated from datastore.")