|
|
|
@ -472,9 +472,12 @@ func (s *Store) Open() (retErr error) {
|
|
|
|
|
}
|
|
|
|
|
s.logger.Printf("created on-disk database at open")
|
|
|
|
|
|
|
|
|
|
// Clean up any files from aborted operations
|
|
|
|
|
// Clean up any files from aborted operations. This tries to catch the case where scratch files
|
|
|
|
|
// were created in the Raft directory, not cleaned up, and then the node was restarted with an
|
|
|
|
|
// explicit SQLite path set.
|
|
|
|
|
for _, pattern := range []string{restoreScratchPattern, bootScatchPattern, backupScatchPattern} {
|
|
|
|
|
files, err := filepath.Glob(filepath.Join(s.dbDir, pattern))
|
|
|
|
|
for _, dir := range []string{s.raftDir, s.dbDir} {
|
|
|
|
|
files, err := filepath.Glob(filepath.Join(dir, pattern))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return fmt.Errorf("failed to locate temporary files for pattern %s: %s", pattern, err.Error())
|
|
|
|
|
}
|
|
|
|
@ -484,6 +487,7 @@ func (s *Store) Open() (retErr error) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Instantiate the Raft system.
|
|
|
|
|
ra, err := raft.NewRaft(config, NewFSM(s), s.raftLog, s.raftStable, s.snapshotStore, s.raftTn)
|
|
|
|
|