fix: 节点重启策略中的bug(检查status是否为UP部分的代码)

修改cluster建立时机到init函数。
引用clusterOfInner变量。
This commit is contained in:
jiangbuyun 2021-11-07 13:43:31 +08:00
parent fcc13802d8
commit 60208825b1
2 changed files with 9 additions and 4 deletions

View File

@ -139,6 +139,7 @@ object RepChainMgr {
breakable {
//持续6min检查自己是否UP每次检查的超时时间为120s检查3次
for(i <-1 to 3){
Thread.sleep(10000)
if(isUpOfClusterForChecked(cluster)){
r = true
break
@ -153,7 +154,7 @@ object RepChainMgr {
var r = false
try{
System.err.println(s"shutdown start time=${System.currentTimeMillis()}")
var r = shutdown(systemName)
shutdown(systemName)
System.err.println(s"shutdown end time=${System.currentTimeMillis()}")
Thread.sleep(5000)
System.err.println(s"terminateOfSystem finished,systemName=${systemName}")

View File

@ -209,7 +209,9 @@ class ClusterSystem(sysTag: String, initType: Int, sysStart: Boolean) {
initConsensusNodeOfConfig
if (sysStart) {
sysActor = ActorSystem(SystemConf.SYSTEM_NAME, sysConf)
clusterAddr = Cluster(sysActor).selfAddress
clusterOfInner = Cluster(sysActor)
clusterAddr = clusterOfInner.selfAddress
//clusterAddr = Cluster(sysActor).selfAddress
}
RepLogger.trace(RepLogger.System_Logger, sysTag + "~" + "System" + " ~ " + s"System(${sysTag}) init successfully" + " ~ ")
@ -246,7 +248,8 @@ class ClusterSystem(sysTag: String, initType: Int, sysStart: Boolean) {
}
def shutdown = {
Cluster(sysActor).down(clusterAddr)
//Cluster(sysActor).down(clusterAddr)
this.clusterOfInner.down(clusterAddr)
System.err.println(s"shutdown ~~ address=${clusterAddr.toString},systemname=${this.sysTag}")
}
@ -286,7 +289,8 @@ class ClusterSystem(sysTag: String, initType: Int, sysStart: Boolean) {
if (!hasDiskSpace) {
RepLogger.sendAlertToDB(new AlertInfo("STORAGE",1,s"Node Name=${this.sysTag},Insufficient disk space."))
Cluster(sysActor).down(clusterAddr)
//Cluster(sysActor).down(clusterAddr)
this.clusterOfInner.down(clusterAddr)
throw new Exception("not enough disk space")
}