Skip to content

Commit ab1d159

Browse files
sheikh-armanArnobKumarSaha
authored andcommitted
Fix semi sync version upgrade issue for version <8.4.2 to >=8.4.2 (#64)
Signed-off-by: SK Ali Arman <[email protected]>
1 parent 2496ecd commit ab1d159

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

scripts/run_semi_sync.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,28 @@ function install_semiSync_plugin() {
8686
local mysql="$mysql_header --host=$1"
8787

8888
# At first, ensure that the command executes without any error. Then, run the command again and extract the output.
89-
retry 120 ${mysql} -N -e 'SHOW PLUGINS;' | grep semisync
90-
out=$(${mysql} -N -e 'SHOW PLUGINS;' | grep semisync)
89+
90+
retry 120 ${mysql} -N -e 'SHOW PLUGINS;' | grep 'semisync_master'
91+
out=$(${mysql} -N -e 'SHOW PLUGINS;' | grep 'semisync_master')
92+
replicaStop=0
93+
if [[ -n "$out" ]]; then
94+
log "INFO" "previous version plugin is installed. Uninstalling the plugin..."
95+
retry 120 ${mysql} -e "STOP REPLICA;"
96+
retry 120 ${mysql} -e "UNINSTALL PLUGIN rpl_semi_sync_master;"
97+
retry 120 ${mysql} -e "UNINSTALL PLUGIN rpl_semi_sync_slave;"
98+
replicaStop=1
99+
fi
100+
retry 120 ${mysql} -N -e 'SHOW PLUGINS;' | grep semisync_source
101+
out=$(${mysql} -N -e 'SHOW PLUGINS;' | grep semisync_source)
91102
if [[ -z "$out" ]]; then
92103
log "INFO" "semisync plugin is not installed. Installing the plugin..."
93104
retry 120 ${mysql} -e "INSTALL PLUGIN rpl_semi_sync_source SONAME 'semisync_source.so';"
94105
retry 120 ${mysql} -e "INSTALL PLUGIN rpl_semi_sync_replica SONAME 'semisync_replica.so';"
95106
reading_first_time=1
96107
log "INFO" "semi_sync plugin successfully installed"
108+
if [[ "$replicaStop" == 1 ]]; then
109+
retry 120 ${mysql} -e "START REPLICA;"
110+
fi
97111
else
98112
log "INFO" "Already semi_sync plugin is installed"
99113
fi

0 commit comments

Comments
 (0)