mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
sync data first before stopping
This commit is contained in:
parent
118d0e01a8
commit
a129bda7d9
|
@ -317,6 +317,16 @@ func (l *DiskLocation) VolumesLen() int {
|
||||||
return len(l.volumes)
|
return len(l.volumes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *DiskLocation) SetStopping() {
|
||||||
|
l.volumesLock.Lock()
|
||||||
|
for _, v := range l.volumes {
|
||||||
|
v.SetStopping()
|
||||||
|
}
|
||||||
|
l.volumesLock.Unlock()
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (l *DiskLocation) Close() {
|
func (l *DiskLocation) Close() {
|
||||||
l.volumesLock.Lock()
|
l.volumesLock.Lock()
|
||||||
for _, v := range l.volumes {
|
for _, v := range l.volumes {
|
||||||
|
|
|
@ -327,6 +327,9 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||||
|
|
||||||
func (s *Store) SetStopping() {
|
func (s *Store) SetStopping() {
|
||||||
s.isStopping = true
|
s.isStopping = true
|
||||||
|
for _, location := range s.Locations {
|
||||||
|
location.SetStopping()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Store) Close() {
|
func (s *Store) Close() {
|
||||||
|
|
|
@ -175,6 +175,21 @@ func (v *Volume) DiskType() types.DiskType {
|
||||||
return v.location.DiskType
|
return v.location.DiskType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *Volume) SetStopping() {
|
||||||
|
v.dataFileAccessLock.Lock()
|
||||||
|
defer v.dataFileAccessLock.Unlock()
|
||||||
|
if v.nm != nil {
|
||||||
|
if err := v.nm.Sync(); err != nil {
|
||||||
|
glog.Warningf("Volume SetStopping fail to sync volume idx %d", v.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if v.DataBackend != nil {
|
||||||
|
if err := v.DataBackend.Sync(); err != nil {
|
||||||
|
glog.Warningf("Volume SetStopping fail to sync volume %d", v.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Close cleanly shuts down this volume
|
// Close cleanly shuts down this volume
|
||||||
func (v *Volume) Close() {
|
func (v *Volume) Close() {
|
||||||
v.dataFileAccessLock.Lock()
|
v.dataFileAccessLock.Lock()
|
||||||
|
|
Loading…
Reference in a new issue