From 5f18ef3e7b63fe7754c1c9019c2d3398684a6668 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Wed, 31 May 2023 16:04:09 +0300 Subject: [PATCH 1/4] JE-66270 [MySQL Autofailover for Primary-Secondary] Merge common JS-scripts for both implementations: 'promote-new-primary' and 'promote-new-primary-wo-proxy' --- addons/promote-new-primary/scripts/promote-master.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/promote-new-primary/scripts/promote-master.js b/addons/promote-new-primary/scripts/promote-master.js index bf27f2b0..2afc66d0 100644 --- a/addons/promote-new-primary/scripts/promote-master.js +++ b/addons/promote-new-primary/scripts/promote-master.js @@ -68,7 +68,7 @@ function promoteNewPrimary() { resp = this.restoreNodes(); if (resp.result != 0) return resp; - + resp = this.addNode(); if (resp.result != 0) return resp; @@ -80,7 +80,7 @@ function promoteNewPrimary() { if (resp.result != 0) return resp; return this.setIsRunningStatus(false); } - + return { result: 0 } }; @@ -178,11 +178,13 @@ function promoteNewPrimary() { this.setNewMasterNode = function() { if (api.env.control.SetMasterNode) { + this.log("API api.env.control.SetMasterNode"); return api.env.control.SetMasterNode({ envName: envName, nodeId: this.getNewPrimaryNode().id }); } else { + this.log("Eval SetMasterNode"); let resp = jelastic.dev.scripting.Eval("ext", session, "api.env.control.SetMasterNode", { envName: envName, nodeId: this.getNewPrimaryNode().id @@ -515,7 +517,9 @@ function promoteNewPrimary() { if (nodes[i].type == SECONDARY && !alreadySetNewPrimary) { this.setNewPrimaryNode(nodes[i]); alreadySetNewPrimary = true; - } else { + } + + if (nodes[i].type == "primary") { resp = api.env.control.SetNodeDisplayName(envName, session, nodes[i].id, PRIMARY + " - " + FAILED); if (resp.result != 0) return resp; From 0f96aba2850590a18b3aacc25bd16b4ce2f9bffc Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Fri, 2 Jun 2023 16:24:57 +0300 Subject: [PATCH 2/4] Stage addon (#324) * baseUrl * baseUrl * JE-66270 [MySQL Autofailover for Primary-Secondary] Merge common JS-scripts for both implementations: 'promote-new-primary' and 'promote-new-primary-wo-proxy' --------- Co-authored-by: sych74 --- addons/promote-new-primary/addon-with-proxysql.yml | 2 +- addons/promote-new-primary/addon-without-proxysql.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/promote-new-primary/addon-with-proxysql.yml b/addons/promote-new-primary/addon-with-proxysql.yml index cd09d154..5e0032c2 100644 --- a/addons/promote-new-primary/addon-with-proxysql.yml +++ b/addons/promote-new-primary/addon-with-proxysql.yml @@ -8,7 +8,7 @@ description: logo: images/db-failover-red.png -baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/promote-new-primary +baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-addon/addons/promote-new-primary mixins: - https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/v3.0.0/scripts/common.yml diff --git a/addons/promote-new-primary/addon-without-proxysql.yml b/addons/promote-new-primary/addon-without-proxysql.yml index 39efa392..9131aee8 100644 --- a/addons/promote-new-primary/addon-without-proxysql.yml +++ b/addons/promote-new-primary/addon-without-proxysql.yml @@ -8,7 +8,7 @@ description: logo: images/db-failover-red.png -baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/promote-new-primary +baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-addon/addons/promote-new-primary mixins: - https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/v3.0.0/scripts/common.yml From efc6e90b4b8b091d260e881e6587c4ae39c708b5 Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Fri, 2 Jun 2023 16:25:39 +0300 Subject: [PATCH 3/4] baseUrl --- addons/promote-new-primary/addon-with-proxysql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/promote-new-primary/addon-with-proxysql.yml b/addons/promote-new-primary/addon-with-proxysql.yml index 5e0032c2..cd09d154 100644 --- a/addons/promote-new-primary/addon-with-proxysql.yml +++ b/addons/promote-new-primary/addon-with-proxysql.yml @@ -8,7 +8,7 @@ description: logo: images/db-failover-red.png -baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-addon/addons/promote-new-primary +baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/promote-new-primary mixins: - https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/v3.0.0/scripts/common.yml From 33732fea063943de22d1bcfe49d6d0677484089e Mon Sep 17 00:00:00 2001 From: "alexey.lazarenko" Date: Fri, 2 Jun 2023 16:25:56 +0300 Subject: [PATCH 4/4] baseUrl --- addons/promote-new-primary/addon-without-proxysql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/promote-new-primary/addon-without-proxysql.yml b/addons/promote-new-primary/addon-without-proxysql.yml index 9131aee8..39efa392 100644 --- a/addons/promote-new-primary/addon-without-proxysql.yml +++ b/addons/promote-new-primary/addon-without-proxysql.yml @@ -8,7 +8,7 @@ description: logo: images/db-failover-red.png -baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-addon/addons/promote-new-primary +baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/promote-new-primary mixins: - https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/v3.0.0/scripts/common.yml