1
0
Fork 0

Better logic

master
Philip O'Toole 9 months ago
parent 585feb473f
commit f18fb66665

@ -6,6 +6,7 @@
- [PR #1548](https://github.com/rqlite/rqlite/pull/1548): Make system-level test failures easier to understand.
- [PR #1555](https://github.com/rqlite/rqlite/pull/1555): Correct build and import of Protobuf files.
- [PR #1556](https://github.com/rqlite/rqlite/pull/1556): Add fast-path backup.
- [PR #1556](https://github.com/rqlite/rqlite/pull/1556): rqlite CLI streams backup to file.
## 8.14.1 (December 31st 2023)
### Implementation changes and bug fixes

@ -1199,19 +1199,6 @@ func (s *Store) Backup(br *proto.BackupRequest, dst io.Writer) (retErr error) {
}
if br.Format == proto.BackupRequest_BACKUP_REQUEST_FORMAT_BINARY {
// 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())
}
// Pause any snapshotting and which will allow us to read the SQLite
// file without it changing underneath us. Any new writes will be
// sent to the WAL.
if err := s.snapshotCAS.Begin(); err != nil {
return err
}
defer s.snapshotCAS.End()
var srcFD *os.File
var err error
if br.Vacuum {
@ -1229,6 +1216,18 @@ func (s *Store) Backup(br *proto.BackupRequest, dst io.Writer) (retErr error) {
return err
}
} 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())
}
// Pause any snapshotting and which will allow us to read the SQLite
// file without it changing underneath us. Any new writes will be
// sent to the WAL.
if err := s.snapshotCAS.Begin(); err != nil {
return err
}
defer s.snapshotCAS.End()
// Fast path -- direct copy.
srcFD, err = os.Open(s.dbPath)
if err != nil {

Loading…
Cancel
Save