mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
When the volume server is stopped, the master server immediately sees the deletion of volumes
This commit is contained in:
parent
eb32af25d4
commit
46303c36bf
|
@ -216,6 +216,23 @@ func (vs *VolumeServer) doHeartbeat(masterNode, masterGrpcAddress string, grpcDi
|
||||||
case err = <-doneChan:
|
case err = <-doneChan:
|
||||||
return
|
return
|
||||||
case <-vs.stopChan:
|
case <-vs.stopChan:
|
||||||
|
var volumeMessages []*master_pb.VolumeInformationMessage
|
||||||
|
emptyBeat := &master_pb.Heartbeat{
|
||||||
|
Ip: vs.store.Ip,
|
||||||
|
Port: uint32(vs.store.Port),
|
||||||
|
PublicUrl: vs.store.PublicUrl,
|
||||||
|
MaxVolumeCount: uint32(0),
|
||||||
|
MaxFileKey: uint64(0),
|
||||||
|
DataCenter: vs.store.GetDataCenter(),
|
||||||
|
Rack: vs.store.GetRack(),
|
||||||
|
Volumes: volumeMessages,
|
||||||
|
HasNoVolumes: len(volumeMessages) == 0,
|
||||||
|
}
|
||||||
|
glog.V(1).Infof("volume server %s:%d deletes all volumes", vs.store.Ip, vs.store.Port)
|
||||||
|
if err = stream.Send(emptyBeat); err != nil {
|
||||||
|
glog.V(0).Infof("Volume Server Failed to update to master %s: %v", masterNode, err)
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,6 +194,12 @@ func (s *Store) SetDataCenter(dataCenter string) {
|
||||||
func (s *Store) SetRack(rack string) {
|
func (s *Store) SetRack(rack string) {
|
||||||
s.rack = rack
|
s.rack = rack
|
||||||
}
|
}
|
||||||
|
func (s *Store) GetDataCenter() string {
|
||||||
|
return s.dataCenter
|
||||||
|
}
|
||||||
|
func (s *Store) GetRack() string {
|
||||||
|
return s.rack
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||||
var volumeMessages []*master_pb.VolumeInformationMessage
|
var volumeMessages []*master_pb.VolumeInformationMessage
|
||||||
|
@ -229,7 +235,6 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if v.IsReadOnly() {
|
if v.IsReadOnly() {
|
||||||
collectionVolumeReadOnlyCount[v.Collection] = make(map[string]uint8)
|
|
||||||
collectionVolumeReadOnlyCount[v.Collection]["IsReadOnly"] += 1
|
collectionVolumeReadOnlyCount[v.Collection]["IsReadOnly"] += 1
|
||||||
if v.noWriteOrDelete {
|
if v.noWriteOrDelete {
|
||||||
collectionVolumeReadOnlyCount[v.Collection]["noWriteOrDelete"] += 1
|
collectionVolumeReadOnlyCount[v.Collection]["noWriteOrDelete"] += 1
|
||||||
|
|
Loading…
Reference in a new issue