|
|
|
@ -1217,8 +1217,11 @@ func (s *Store) Backup(br *proto.BackupRequest, dst io.Writer) (retErr error) {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Snapshot to ensure the main SQLite file has all the latest data.
|
|
|
|
|
if err := s.Snapshot(0); err != nil && err != raft.ErrNothingNewToSnapshot {
|
|
|
|
|
return fmt.Errorf("pre-backup snapshot failed: %s", err.Error())
|
|
|
|
|
if err := s.Snapshot(0); err != nil {
|
|
|
|
|
if err != raft.ErrNothingNewToSnapshot ||
|
|
|
|
|
!strings.Contains(err.Error(), "wait until the configuration entry at") {
|
|
|
|
|
return fmt.Errorf("pre-backup snapshot failed: %s", err.Error())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Pause any snapshotting and which will allow us to read the SQLite
|
|
|
|
|
// file without it changing underneath us. Any new writes will be
|
|
|
|
|