Skip to content

Commit

Permalink
Fix influxdata#1040: fix panic when snapshot dir doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
dgnorton authored and toddboom committed Oct 21, 2014
1 parent 5e9750f commit ef50442
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions _vendor/raft/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,8 @@ func (s *server) LoadSnapshot() error {
sslist, err := s.SnapshotList()
if err != nil {
return err
} else if len(sslist) == 0 {
return fmt.Errorf("no snapshots to load")
}

// Load most recent snapshot (falling back to older snapshots if needed)
Expand Down
2 changes: 1 addition & 1 deletion coordinator/raft_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func (s *RaftServer) startRaft() error {

err = s.raftServer.LoadSnapshot()
if err != nil {
panic(err)
log.Info(err)
}

s.raftServer.AddEventListener(raft.StateChangeEventType, s.raftEventHandler)
Expand Down

0 comments on commit ef50442

Please sign in to comment.