etcdserver: close storage when stop

This commit is contained in:
Yicheng Qin 2014-12-02 23:20:21 -08:00
parent 23b32a6cbe
commit a7bc03b42b
2 changed files with 6 additions and 0 deletions

View File

@ -111,6 +111,8 @@ type Storage interface {
// remove it in this interface.
// Cut cuts out a new wal file for saving new state and entries.
Cut() error
// Close closes the Storage and performs finalization.
Close() error
}
type Server interface {
@ -396,6 +398,9 @@ func (s *EtcdServer) run() {
defer func() {
s.node.Stop()
s.sendhub.Stop()
if err := s.storage.Close(); err != nil {
log.Panicf("etcdserver: close storage error: %v", err)
}
close(s.done)
}()
for {

View File

@ -1530,6 +1530,7 @@ func (p *storageRecorder) SaveSnap(st raftpb.Snapshot) error {
}
return nil
}
func (p *storageRecorder) Close() error { return nil }
type readyNode struct {
readyc chan raft.Ready