mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 10:06:14 +00:00
fix: warnMesg failed on warnLogDir
Signed-off-by: awzhgw <guowl18702995996@gmail.com>
This commit is contained in:
parent
2520f73b2b
commit
f3eead28cb
@ -161,7 +161,9 @@ func (d *Disk) updateSpaceInfo() (err error) {
|
||||
d.incReadErrCnt()
|
||||
}
|
||||
if d.Status==proto.Unavailable{
|
||||
exporter.NewAlarm(fmt.Sprintf("disk path %v error on %v", d.Path, LocalIP))
|
||||
mesg:=fmt.Sprintf("disk path %v error on %v", d.Path, LocalIP)
|
||||
log.LogErrorf(mesg)
|
||||
exporter.Warning(mesg)
|
||||
d.ForceExitRaftStore()
|
||||
} else if d.Available <= 0 {
|
||||
d.Status = proto.ReadOnly
|
||||
@ -290,7 +292,7 @@ func (d *Disk) RestorePartition(visitor PartitionVisitor) {
|
||||
mesg := fmt.Sprintf("action[RestorePartition] new partition(%v) err(%v) ",
|
||||
partitionID, err.Error())
|
||||
log.LogError(mesg)
|
||||
exporter.NewAlarm(mesg)
|
||||
exporter.Warning(mesg)
|
||||
return
|
||||
}
|
||||
if visitor != nil {
|
||||
|
||||
@ -435,7 +435,7 @@ func (dp *DataPartition) checkIsDiskError(err error) {
|
||||
}
|
||||
if IsDiskErr(err.Error()) {
|
||||
mesg := fmt.Sprintf("disk path %v error on %v", dp.Path, LocalIP)
|
||||
exporter.NewAlarm(mesg)
|
||||
exporter.Warning(mesg)
|
||||
log.LogErrorf(mesg)
|
||||
dp.stopRaft()
|
||||
dp.disk.incReadErrCnt()
|
||||
|
||||
@ -35,10 +35,9 @@ func (dp *DataPartition) Apply(command []byte, index uint64) (resp interface{},
|
||||
msg := &RaftCmdItem{}
|
||||
defer func(index uint64) {
|
||||
if err != nil {
|
||||
key := fmt.Sprintf("%s_datapartition_apply_err", dp.clusterID)
|
||||
prefix := fmt.Sprintf("Datapartition(%v)_Extent(%v)", dp.partitionID, extentID)
|
||||
prefix := fmt.Sprintf("RandomWrite Datapartition(%v)_Extent(%v) apply error (%v)", dp.partitionID, extentID,err)
|
||||
err = errors.Trace(err, prefix)
|
||||
exporter.NewAlarm(key)
|
||||
exporter.Warning(err.Error())
|
||||
resp = proto.OpExistErr
|
||||
dp.stopRaftC <- extentID
|
||||
} else {
|
||||
@ -119,9 +118,8 @@ func (dp *DataPartition) HandleFatalEvent(err *raft.FatalError) {
|
||||
|
||||
// HandleLeaderChange notifies the application when the raft leader has changed.
|
||||
func (dp *DataPartition) HandleLeaderChange(leader uint64) {
|
||||
//exporter.Alarm(ModuleName, fmt.Sprintf("LeaderChange: partition=%d, "+
|
||||
// "newLeader=%d", dp.config.PartitionID, leader))
|
||||
exporter.NewAlarm(ModuleName)
|
||||
exporter.Warning(fmt.Sprintf("LeaderChange: partition=%d, "+
|
||||
"newLeader=%d", dp.config.PartitionID, leader))
|
||||
|
||||
if dp.config.NodeID == leader {
|
||||
dp.isRaftLeader = true
|
||||
|
||||
@ -279,14 +279,14 @@ func (mp *metaPartition) ApplySnapshot(peers []raftproto.Peer, iter raftproto.Sn
|
||||
// HandleFatalEvent handles the fatal errors.
|
||||
func (mp *metaPartition) HandleFatalEvent(err *raft.FatalError) {
|
||||
// Panic while fatal event happen.
|
||||
exporter.NewAlarm(exporterKey)
|
||||
exporter.Warning(fmt.Sprintf("action[HandleFatalEvent] err[%v].", err))
|
||||
log.LogFatalf("action[HandleFatalEvent] err[%v].", err)
|
||||
panic(err.Err)
|
||||
}
|
||||
|
||||
// HandleLeaderChange handles the leader changes.
|
||||
func (mp *metaPartition) HandleLeaderChange(leader uint64) {
|
||||
exporter.NewAlarm(exporterKey)
|
||||
exporter.Warning(exporterKey)
|
||||
if mp.config.NodeId != leader {
|
||||
mp.storeChan <- &storeMsg{
|
||||
command: stopStoreTick,
|
||||
|
||||
@ -53,7 +53,7 @@ func (mp *metaPartition) startSchedule(curIndex uint64) {
|
||||
err = errors.NewErrorf("[startSchedule]: dump partition id=%d: %v",
|
||||
mp.config.PartitionId, err.Error())
|
||||
log.LogErrorf(err.Error())
|
||||
exporter.NewAlarm(exporterKey)
|
||||
exporter.Warning(err.Error())
|
||||
}
|
||||
|
||||
if _, ok := mp.IsLeader(); ok {
|
||||
|
||||
@ -186,7 +186,7 @@ func (client *ExtentClient) Write(inode uint64, offset int, data []byte, direct
|
||||
if err != nil {
|
||||
err = errors.Trace(err, prefix)
|
||||
log.LogError(errors.Stack(err))
|
||||
exporter.NewAlarm(gDataWrapper.WarningMsg())
|
||||
exporter.Warning(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -40,13 +40,13 @@ type Alarm struct {
|
||||
Counter
|
||||
}
|
||||
|
||||
func NewAlarm(detail string) (a *Alarm) {
|
||||
func Warning(detail string) (a *Alarm) {
|
||||
if !enabled {
|
||||
ump.Alarm(fmt.Sprintf("%v_%v_warning", clustername, modulename), detail)
|
||||
return
|
||||
}
|
||||
a = AlarmPool.Get().(*Alarm)
|
||||
a.name = metricsName(fmt.Sprintf("%s_alarm", detail))
|
||||
a.name = metricsName(fmt.Sprintf("%s_%s_alarm", clustername,modulename))
|
||||
a.Add(1)
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user