mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #1841 from yichengq/246
etcdserver: close storage when stop
This commit is contained in:
commit
1d1c2ff834
@ -101,6 +101,8 @@ type Storage interface {
|
|||||||
// remove it in this interface.
|
// remove it in this interface.
|
||||||
// Cut cuts out a new wal file for saving new state and entries.
|
// Cut cuts out a new wal file for saving new state and entries.
|
||||||
Cut() error
|
Cut() error
|
||||||
|
// Close closes the Storage and performs finalization.
|
||||||
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
type Server interface {
|
type Server interface {
|
||||||
@ -386,6 +388,9 @@ func (s *EtcdServer) run() {
|
|||||||
defer func() {
|
defer func() {
|
||||||
s.node.Stop()
|
s.node.Stop()
|
||||||
s.sendhub.Stop()
|
s.sendhub.Stop()
|
||||||
|
if err := s.storage.Close(); err != nil {
|
||||||
|
log.Panicf("etcdserver: close storage error: %v", err)
|
||||||
|
}
|
||||||
close(s.done)
|
close(s.done)
|
||||||
}()
|
}()
|
||||||
for {
|
for {
|
||||||
|
@ -1530,6 +1530,7 @@ func (p *storageRecorder) SaveSnap(st raftpb.Snapshot) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (p *storageRecorder) Close() error { return nil }
|
||||||
|
|
||||||
type readyNode struct {
|
type readyNode struct {
|
||||||
readyc chan raft.Ready
|
readyc chan raft.Ready
|
||||||
|
Loading…
x
Reference in New Issue
Block a user