From d259d71c559b5617869dbd2ce60d04c936637c31 Mon Sep 17 00:00:00 2001 From: Ali Mahdavi Date: Mon, 10 Jun 2024 14:11:06 +0300 Subject: [PATCH 1/3] fix for master finding issue --- ClusterOperator/Operator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClusterOperator/Operator.js b/ClusterOperator/Operator.js index b0d016f..3114721 100644 --- a/ClusterOperator/Operator.js +++ b/ClusterOperator/Operator.js @@ -707,7 +707,7 @@ class Operator { // ask second candidate for confirmation if (this.masterCandidates.length > 1) MasterIP = await fluxAPI.getMaster(this.masterCandidates[1], config.containerApiPort); log.info(`asking second candidate for confirmation: ${MasterIP}`); - if (MasterIP === this.myIP) { + if (MasterIP === this.myIP || !this.masterCandidates.includes(MasterIP)) { this.IamMaster = true; this.masterNode = this.myIP; this.status = 'OK'; From 12aa788eee9f5722b2e969f9e8c0f51fe7d10030 Mon Sep 17 00:00:00 2001 From: Ali Mahdavi Date: Mon, 10 Jun 2024 14:13:54 +0300 Subject: [PATCH 2/3] fix for master find --- ClusterOperator/Operator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ClusterOperator/Operator.js b/ClusterOperator/Operator.js index 3114721..e835eeb 100644 --- a/ClusterOperator/Operator.js +++ b/ClusterOperator/Operator.js @@ -639,13 +639,13 @@ class Operator { this.initMasterConnection(); } } - /* if (this.masterNode && !checkMasterIp) { + if (this.masterNode && !checkMasterIp) { log.info('master removed from the list, should find a new master', 'yellow'); this.masterNode = null; this.IamMaster = false; await this.findMaster(); this.initMasterConnection(); - } */ + } if (this.IamMaster && this.serverSocket.engine.clientsCount < 1 && this.status !== 'INIT') { log.info('No incomming connections, should find a new master', 'yellow'); await this.findMaster(); From b24cc057385616371a9c82284a302863d15f3dc5 Mon Sep 17 00:00:00 2001 From: Ali Mahdavi Date: Mon, 10 Jun 2024 14:18:13 +0300 Subject: [PATCH 3/3] remove logs --- ClusterOperator/Operator.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ClusterOperator/Operator.js b/ClusterOperator/Operator.js index e835eeb..926ed55 100644 --- a/ClusterOperator/Operator.js +++ b/ClusterOperator/Operator.js @@ -761,7 +761,6 @@ class Operator { * [getMaster] */ static getMaster() { - log.debug(`master node:${this.masterNode}`); if (this.masterNode === null) { if (this.masterCandidates.length) { return this.masterCandidates[0];