fix(meta): adjust the call order of the RegistConsul func to prevent concurrent modify to clustername.

#22873788

Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
Victor1319 2024-12-09 16:03:01 +08:00 committed by AmazingChi
parent 645076645a
commit f9c00bb5c8
6 changed files with 10 additions and 7 deletions

View File

@ -90,6 +90,8 @@ func doStart(s common.Server, cfg *config.Config) (err error) {
l.register()
l.lastHeartbeat = time.Now()
exporter.RegistConsul(l.clusterID, ModuleName, cfg)
go l.checkRegister()
if err = l.startServer(); err != nil {
return
@ -97,7 +99,6 @@ func doStart(s common.Server, cfg *config.Config) (err error) {
l.httpServiceStart()
exporter.RegistConsul(l.clusterID, ModuleName, cfg)
log.LogInfo("lcnode start successfully")
return

View File

@ -170,8 +170,8 @@ func (m *Server) Start(cfg *config.Config) (err error) {
}
WarnMetrics = newWarningMetrics(m.cluster)
m.cluster.scheduleTask()
m.startHTTPService(ModuleName, cfg)
exporter.RegistConsul(m.clusterName, ModuleName, cfg)
m.startHTTPService(ModuleName, cfg)
metricsService := newMonitorMetrics(m.cluster)
metricsService.start()

View File

@ -166,13 +166,15 @@ func doStart(s common.Server, cfg *config.Config) (err error) {
m.startStat()
exporter.RegistConsul(m.clusterId, cfg.GetString("role"), cfg)
// check local partition compare with master ,if lack,then not start
if err = m.checkLocalPartitionMatchWithMaster(); err != nil {
syslog.Println(err)
exporter.Warning(err.Error())
return
}
exporter.RegistConsul(m.clusterId, cfg.GetString("role"), cfg)
return
}

View File

@ -78,7 +78,7 @@ func (mp *metaPartition) statisticExtendByLoad(extend *Extend, ino *Inode) {
ino.Inode = extend.GetInode()
status := mp.getInodeSimpleInfo(ino)
if status != proto.OpOk {
log.LogErrorf("statisticExtendByLoad get inode[%v] fail [%v].", extend.GetInode(), status)
log.LogDebugf("statisticExtendByLoad get inode[%v] fail [%v].", extend.GetInode(), status)
return
}
if ino.NLink == 0 {

View File

@ -420,14 +420,14 @@ func handleStart(s common.Server, cfg *config.Config) (err error) {
o.limitMutex.Unlock()
}
exporter.RegistConsul(ci.Cluster, cfg.GetString("role"), cfg)
// start rest api
if err = o.startMuxRestAPI(); err != nil {
log.LogInfof("handleStart: start rest api fail: err(%v)", err)
return
}
exporter.RegistConsul(ci.Cluster, cfg.GetString("role"), cfg)
log.LogInfo("object subsystem start success")
return
}

View File

@ -32,7 +32,7 @@ const (
DefaultTransactionTimeout = 1 // minutes
MaxTransactionTimeout = 60 // minutes
DefaultTxConflictRetryNum = 121
MaxTxConflictRetryNum = 100
MaxTxConflictRetryNum = 1000
DefaultTxConflictRetryInterval = 500 // ms
MaxTxConflictRetryInterval = 1000 // ms
MinTxConflictRetryInterval = 10 // ms