From 4f7ed23ad4d2e7815d9281f5391cbf999d682b0a Mon Sep 17 00:00:00 2001 From: SK Ali Arman Date: Fri, 2 May 2025 20:34:51 +0600 Subject: [PATCH 1/3] Fix semi sync version upgrade issue for version <8.4.2 to >=8.4.2 Signed-off-by: SK Ali Arman --- Makefile | 2 +- scripts/run_semi_sync.sh | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f477b72..927ceab 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SHELL=/bin/bash -o pipefail REGISTRY ?= ghcr.io/kubedb BIN ?= mysql-init IMAGE := $(REGISTRY)/$(BIN) -TAG ?= $(shell git describe --exact-match --abbrev=0 2>/dev/null || echo "") +TAG ?= $(shell git describe --exact-match --abbrev=0 2>/dev/null || echo "")_$(val) DOCKER_PLATFORMS := linux/amd64 linux/arm64 PLATFORM ?= linux/$(subst x86_64,amd64,$(subst aarch64,arm64,$(shell uname -m))) diff --git a/scripts/run_semi_sync.sh b/scripts/run_semi_sync.sh index e59a9a9..496ae70 100755 --- a/scripts/run_semi_sync.sh +++ b/scripts/run_semi_sync.sh @@ -86,14 +86,29 @@ function install_semiSync_plugin() { local mysql="$mysql_header --host=$1" # At first, ensure that the command executes without any error. Then, run the command again and extract the output. - retry 120 ${mysql} -N -e 'SHOW PLUGINS;' | grep semisync - out=$(${mysql} -N -e 'SHOW PLUGINS;' | grep semisync) + + retry 120 ${mysql} -N -e 'SHOW PLUGINS;' | grep -E 'semisync_master|semisync_master' + out=$(${mysql} -N -e 'SHOW PLUGINS;' | grep -E 'semisync_master|semisync_master') + replicaStop=0 + if [[ -n "$out" ]]; then + log "INFO" "previous version plugin is installed. Uninstalling the plugin..." + retry 120 ${mysql} -e "STOP REPLICA;" + retry 120 ${mysql} -e "UNINSTALL PLUGIN rpl_semi_sync_master;" + retry 120 ${mysql} -e "UNINSTALL PLUGIN rpl_semi_sync_slave;" + replicaStop=1 + fi + retry 120 ${mysql} -N -e 'SHOW PLUGINS;' | grep semisync_source + out=$(${mysql} -N -e 'SHOW PLUGINS;' | grep semisync_source) if [[ -z "$out" ]]; then log "INFO" "semisync plugin is not installed. Installing the plugin..." retry 120 ${mysql} -e "INSTALL PLUGIN rpl_semi_sync_source SONAME 'semisync_source.so';" retry 120 ${mysql} -e "INSTALL PLUGIN rpl_semi_sync_replica SONAME 'semisync_replica.so';" reading_first_time=1 log "INFO" "semi_sync plugin successfully installed" + if [[ "$replicaStop" == 1 ]]; then + retry 120 ${mysql} -e "SET GLOBAL rpl_semi_sync_replica_enabled = 1;" + retry 120 ${mysql} -e "START REPLICA;" + fi else log "INFO" "Already semi_sync plugin is installed" fi From 00c417c480340d0348f62b0c4a038d4dcc4fb776 Mon Sep 17 00:00:00 2001 From: SK Ali Arman Date: Mon, 5 May 2025 14:45:44 +0600 Subject: [PATCH 2/3] refactor Signed-off-by: SK Ali Arman --- Makefile | 2 +- scripts/run_semi_sync.sh | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 927ceab..f477b72 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SHELL=/bin/bash -o pipefail REGISTRY ?= ghcr.io/kubedb BIN ?= mysql-init IMAGE := $(REGISTRY)/$(BIN) -TAG ?= $(shell git describe --exact-match --abbrev=0 2>/dev/null || echo "")_$(val) +TAG ?= $(shell git describe --exact-match --abbrev=0 2>/dev/null || echo "") DOCKER_PLATFORMS := linux/amd64 linux/arm64 PLATFORM ?= linux/$(subst x86_64,amd64,$(subst aarch64,arm64,$(shell uname -m))) diff --git a/scripts/run_semi_sync.sh b/scripts/run_semi_sync.sh index 496ae70..db0d71f 100755 --- a/scripts/run_semi_sync.sh +++ b/scripts/run_semi_sync.sh @@ -106,7 +106,6 @@ function install_semiSync_plugin() { reading_first_time=1 log "INFO" "semi_sync plugin successfully installed" if [[ "$replicaStop" == 1 ]]; then - retry 120 ${mysql} -e "SET GLOBAL rpl_semi_sync_replica_enabled = 1;" retry 120 ${mysql} -e "START REPLICA;" fi else From 30669b0edf4578e65a492724c2b0ff6b8bcc6afe Mon Sep 17 00:00:00 2001 From: SK Ali Arman Date: Thu, 29 May 2025 11:37:32 +0600 Subject: [PATCH 3/3] comments resolve Signed-off-by: SK Ali Arman --- scripts/run_semi_sync.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run_semi_sync.sh b/scripts/run_semi_sync.sh index db0d71f..421d5c1 100755 --- a/scripts/run_semi_sync.sh +++ b/scripts/run_semi_sync.sh @@ -87,8 +87,8 @@ function install_semiSync_plugin() { # At first, ensure that the command executes without any error. Then, run the command again and extract the output. - retry 120 ${mysql} -N -e 'SHOW PLUGINS;' | grep -E 'semisync_master|semisync_master' - out=$(${mysql} -N -e 'SHOW PLUGINS;' | grep -E 'semisync_master|semisync_master') + retry 120 ${mysql} -N -e 'SHOW PLUGINS;' | grep 'semisync_master' + out=$(${mysql} -N -e 'SHOW PLUGINS;' | grep 'semisync_master') replicaStop=0 if [[ -n "$out" ]]; then log "INFO" "previous version plugin is installed. Uninstalling the plugin..."