mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
refactor(meta): add warn log for mp create . #1000182796
Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
parent
e4b0d9a4ea
commit
cc29b3c706
@ -221,7 +221,9 @@ func (m *metadataManager) checkForbidWriteOpOfProtoVer0(pktProtoVersion uint32,
|
||||
// HandleMetadataOperation handles the metadata operations.
|
||||
func (m *metadataManager) HandleMetadataOperation(conn net.Conn, p *Packet, remoteAddr string) (err error) {
|
||||
start := time.Now()
|
||||
if log.EnableInfo() {
|
||||
if p.AdminOp() {
|
||||
log.LogWarnf("HandleMetadataOperation input info op (%s), data %s, remote %s", p.String(), string(p.Data), remoteAddr)
|
||||
} else if log.EnableInfo() {
|
||||
log.LogInfof("HandleMetadataOperation input info op (%s), data %s, remote %s", p.String(), string(p.Data), remoteAddr)
|
||||
}
|
||||
|
||||
@ -234,7 +236,10 @@ func (m *metadataManager) HandleMetadataOperation(conn net.Conn, p *Packet, remo
|
||||
return
|
||||
}
|
||||
|
||||
if log.EnableInfo() {
|
||||
if p.AdminOp() {
|
||||
log.LogInfof("HandleMetadataOperation out (%s), result (%s), remote %s, cost %s", p.String(),
|
||||
p.GetResultMsg(), remoteAddr, time.Since(start).String())
|
||||
} else if log.EnableInfo() {
|
||||
log.LogInfof("HandleMetadataOperation out (%s), result (%s), remote %s, cost %s", p.String(),
|
||||
p.GetResultMsg(), remoteAddr, time.Since(start).String())
|
||||
}
|
||||
@ -756,7 +761,7 @@ func (m *metadataManager) detachPartition(id uint64) (err error) {
|
||||
|
||||
func (m *metadataManager) createPartition(request *proto.CreateMetaPartitionRequest) (err error) {
|
||||
partitionId := fmt.Sprintf("%d", request.PartitionID)
|
||||
log.LogInfof("start create meta Partition, partition %s", partitionId)
|
||||
log.LogWarnf("start create meta Partition, partition %s", partitionId)
|
||||
|
||||
mpc := &MetaPartitionConfig{
|
||||
PartitionId: request.PartitionID,
|
||||
@ -794,6 +799,8 @@ func (m *metadataManager) createPartition(request *proto.CreateMetaPartitionRequ
|
||||
return
|
||||
}
|
||||
|
||||
log.LogWarnf("meta partition start %v success", request.PartitionID)
|
||||
|
||||
func() {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
@ -807,7 +814,7 @@ func (m *metadataManager) createPartition(request *proto.CreateMetaPartitionRequ
|
||||
m.partitions[request.PartitionID] = partition
|
||||
}()
|
||||
|
||||
log.LogInfof("load meta partition %v success", request.PartitionID)
|
||||
log.LogWarnf("load meta partition %v success", request.PartitionID)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@ -268,15 +268,15 @@ func (m *metadataManager) opCreateMetaPartition(conn net.Conn, p *Packet,
|
||||
" struct: %s", err.Error())
|
||||
return
|
||||
}
|
||||
log.LogInfof("[%s] [remoteAddr=%s]accept a from"+
|
||||
" master message: %v", p.String(), remoteAddr, adminTask)
|
||||
log.LogWarnf("[%s] [remoteAddr=%s]accept a from"+
|
||||
" master message: %v, reqId %v", p.String(), remoteAddr, adminTask, p.ReqID)
|
||||
// create a new meta partition.
|
||||
if err = m.createPartition(req); err != nil {
|
||||
err = errors.NewErrorf("[opCreateMetaPartition]->%s; request message: %v",
|
||||
err.Error(), adminTask.Request)
|
||||
return
|
||||
}
|
||||
log.LogInfof("%s [%s] create success req:%v; resp: %v", remoteAddr, p.String(),
|
||||
log.LogWarnf("%s [%s] create success req:%v; resp: %v", remoteAddr, p.String(),
|
||||
req, adminTask)
|
||||
return
|
||||
}
|
||||
|
||||
@ -120,3 +120,10 @@ func NewPacketToFreeInodeOnRaftFollower(partitionID uint64, freeInodes []byte) *
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (p *Packet) AdminOp() bool {
|
||||
return p.Opcode == proto.OpAddMetaPartitionRaftMember ||
|
||||
p.Opcode == proto.OpRemoveMetaPartitionRaftMember ||
|
||||
p.Opcode == proto.OpCreateMetaPartition ||
|
||||
p.Opcode == proto.OpDeleteMetaPartition
|
||||
}
|
||||
|
||||
@ -818,6 +818,9 @@ func (mp *metaPartition) onStart(isCreate bool) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
log.LogWarnf("[onStart] vol(%v) mpId(%d) retryCnt(%v), GetVolumeSimpleInfo succ",
|
||||
mp.config.VolName, mp.config.PartitionId, retryCnt)
|
||||
|
||||
volInfo := mp.vol.GetVolView()
|
||||
mp.vol.volDeleteLockTime = volInfo.DeleteLockTime
|
||||
if mp.manager.metaNode.clusterEnableSnapshot {
|
||||
@ -852,7 +855,7 @@ func (mp *metaPartition) onStart(isCreate bool) (err error) {
|
||||
mp.config.PartitionId, gClusterInfo.EbsAddr, err)
|
||||
// not return err here, blobstore client may be created latter
|
||||
} else {
|
||||
log.LogInfof("action[onStart] mp(%v) blobStoreAddr(%v), create blobstore client success",
|
||||
log.LogWarnf("action[onStart] mp(%v) blobStoreAddr(%v), create blobstore client success",
|
||||
mp.config.PartitionId, gClusterInfo.EbsAddr)
|
||||
}
|
||||
}
|
||||
@ -865,14 +868,14 @@ func (mp *metaPartition) onStart(isCreate bool) (err error) {
|
||||
|
||||
go mp.startCheckerEvict()
|
||||
|
||||
log.LogDebugf("[before raft] get mp[%v] applied(%d),inodeCount(%d),dentryCount(%d)", mp.config.PartitionId, mp.applyID, mp.inodeTree.Len(), mp.dentryTree.Len())
|
||||
log.LogWarnf("[before raft] get mp[%v] applied(%d),inodeCount(%d),dentryCount(%d)", mp.config.PartitionId, mp.applyID, mp.inodeTree.Len(), mp.dentryTree.Len())
|
||||
|
||||
if err = mp.startRaft(); err != nil {
|
||||
err = errors.NewErrorf("[onStart] start raft id=%d: %s",
|
||||
mp.config.PartitionId, err.Error())
|
||||
return
|
||||
}
|
||||
log.LogDebugf("[after raft] get mp[%v] applied(%d),inodeCount(%d),dentryCount(%d)", mp.config.PartitionId, mp.applyID, mp.inodeTree.Len(), mp.dentryTree.Len())
|
||||
log.LogWarnf("[after raft] get mp[%v] applied(%d),inodeCount(%d),dentryCount(%d)", mp.config.PartitionId, mp.applyID, mp.inodeTree.Len(), mp.dentryTree.Len())
|
||||
|
||||
mp.updateSize()
|
||||
|
||||
@ -1252,6 +1255,10 @@ func (mp *metaPartition) doFileStats() {
|
||||
|
||||
func (mp *metaPartition) store(sm *storeMsg) (err error) {
|
||||
log.LogWarnf("metaPartition %d store apply %v", mp.config.PartitionId, sm.applyIndex)
|
||||
defer func() {
|
||||
log.LogWarnf("metaPartition %d store apply %v finish", mp.config.PartitionId, sm.applyIndex)
|
||||
}()
|
||||
|
||||
tmpDir := path.Join(mp.config.RootDir, snapshotDirTmp)
|
||||
if _, err = os.Stat(tmpDir); err == nil {
|
||||
// TODO Unhandled errors
|
||||
|
||||
@ -151,7 +151,7 @@ func (mp *metaPartition) loadMetadata() (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
log.LogInfof("loadMetadata: load complete: partitionID(%v) volume(%v) range(%v,%v) cursor(%v)",
|
||||
log.LogWarnf("loadMetadata: load complete: partitionID(%v) volume(%v) range(%v,%v) cursor(%v)",
|
||||
mp.config.PartitionId, mp.config.VolName, mp.config.Start, mp.config.End, mp.config.Cursor)
|
||||
return
|
||||
}
|
||||
@ -948,7 +948,7 @@ func (mp *metaPartition) persistMetadata() (err error) {
|
||||
if err = os.Rename(filename, path.Join(mp.config.RootDir, metadataFile)); err != nil {
|
||||
return
|
||||
}
|
||||
log.LogInfof("persistMetata: persist complete: partitionID(%v) volume(%v) range(%v,%v) cursor(%v)",
|
||||
log.LogWarnf("persistMetata: persist complete: partitionID(%v) volume(%v) range(%v,%v) cursor(%v)",
|
||||
mp.config.PartitionId, mp.config.VolName, mp.config.Start, mp.config.End, mp.config.Cursor)
|
||||
return
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user