volume: compaction can cause readonly volumes

address https://github.com/chrislusf/seaweedfs/issues/1233
This commit is contained in:
Chris Lu
2020-03-17 09:43:57 -07:00
parent 12df236def
commit c3cb6fa1d7
9 changed files with 239 additions and 215 deletions

View File

@@ -257,7 +257,7 @@ func (vl *VolumeLayout) SetVolumeUnavailable(dn *DataNode, vid needle.VolumeId)
}
return false
}
func (vl *VolumeLayout) SetVolumeAvailable(dn *DataNode, vid needle.VolumeId) bool {
func (vl *VolumeLayout) SetVolumeAvailable(dn *DataNode, vid needle.VolumeId, isReadOnly bool) bool {
vl.accessLock.Lock()
defer vl.accessLock.Unlock()
@@ -268,7 +268,7 @@ func (vl *VolumeLayout) SetVolumeAvailable(dn *DataNode, vid needle.VolumeId) bo
vl.vid2location[vid].Set(dn)
if vInfo.ReadOnly {
if vInfo.ReadOnly || isReadOnly {
return false
}