Skip to content

Commit

Permalink
fix: when disk error,the disk status not change
Browse files Browse the repository at this point in the history
Signed-off-by: awzhgw <guowl18702995996@gmail.com>
  • Loading branch information
awzhgw committed Jul 1, 2019
1 parent 7b314c5 commit 2b05623
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions datanode/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,7 @@ func (d *Disk) updateSpaceInfo() (err error) {
if err = syscall.Statfs(d.Path, &statsInfo); err != nil {
d.incReadErrCnt()
}
currErrs := d.ReadErrCnt + d.WriteErrCnt
if currErrs >= uint64(d.MaxErrCnt) {
d.Status = proto.Unavailable
if d.Status==proto.Unavailable{
exporter.NewAlarm(fmt.Sprintf("disk path %v error on %v", d.Path, LocalIP))
d.ForceExitRaftStore()
} else if d.Available <= 0 {
Expand Down
3 changes: 3 additions & 0 deletions datanode/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ func (dp *DataPartition) statusUpdate() {
if dp.extentStore.GetExtentCount() >= storage.MaxExtentCount {
status = proto.ReadOnly
}
if dp.Status()==proto.Unavailable{
status= proto.Unavailable
}

dp.partitionStatus = int(math.Min(float64(status), float64(dp.disk.Status)))
}
Expand Down

0 comments on commit 2b05623

Please sign in to comment.