Skip to content

Commit f5a9b2c

Browse files
Add MySQL Version 8.4.2 (#37)
* add MySQL 8.4.2 version Signed-off-by: Ashraful Haque Tani <[email protected]>
1 parent b798394 commit f5a9b2c

File tree

5 files changed

+28
-23
lines changed

5 files changed

+28
-23
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ LABEL org.opencontainers.image.source https://github.com/kubedb/mysql-init-docke
1818
RUN apk add --no-cache bash
1919

2020
COPY scripts /tmp/scripts
21+
RUN chmod +x /tmp/scripts/*.sh
2122
COPY init-script /init-script
2223
COPY --from=0 /tini /tmp/scripts/tini
2324

scripts/directory-exist.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
file="/var/lib/mysql/join-in-cluster"
4+
5+
if [ -e "$file" ]; then
6+
echo -n "Not Empty"
7+
else
8+
echo -n "Empty"
9+
fi

scripts/run.sh

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -270,28 +270,23 @@ function wait_for_primary() {
270270
cluster_size=${#members_id[@]}
271271

272272
local is_primary_found=0
273-
for member_id in ${members_id[*]}; do
274-
for i in {60..0}; do
275-
primary_member_id=$(${mysql} -N -e "SHOW STATUS WHERE Variable_name = 'group_replication_primary_member';" | awk '{print $2}')
276-
log "INFO" "Attempt $i: Trying to find primary member........................"
277-
if [[ -n "$primary_member_id" ]]; then
278-
is_primary_found=1
279-
primary_host=$(${mysql} -N -e "SELECT MEMBER_HOST FROM performance_schema.replication_group_members WHERE MEMBER_ID = '${primary_member_id}';" | awk '{print $1}')
280-
# calculate data size of the primary node.
281-
# https://forums.mysql.com/read.php?108,201578,201578
282-
primary_db_size=$(${mysql_header} --host=$primary_host -N -e 'select round(sum( data_length + index_length) / 1024 / 1024) "size in mb" from information_schema.tables;')
283-
log "INFO" "Primary found. Primary host: $primary_host, database size: $primary_db_size"
284-
break
285-
fi
286-
287-
echo -n .
288-
sleep 1
289-
done
290273

291-
if [[ "$is_primary_found" == "1" ]]; then
274+
for i in {20..0}; do
275+
primary_member_id=$(${mysql} -N -e "SELECT MEMBER_ID FROM performance_schema.replication_group_members WHERE MEMBER_STATE = 'ONLINE' and MEMBER_ROLE = 'PRIMARY';" | awk '{print $2}')
276+
log "INFO" "Attempt $i: Trying to find primary member........................"
277+
if [[ -n "$primary_member_id" ]]; then
278+
log "INFO" "Found the primary"
279+
is_primary_found=1
280+
primary_host=$(${mysql} -N -e "SELECT MEMBER_HOST FROM performance_schema.replication_group_members WHERE MEMBER_ID = '${primary_member_id}';" | awk '{print $1}')
281+
# calculate data size of the primary node.
282+
# https://forums.mysql.com/read.php?108,201578,201578
283+
primary_db_size=$(${mysql_header} --host=$primary_host -N -e 'select round(sum( data_length + index_length) / 1024 / 1024) "size in mb" from information_schema.tables;')
284+
log "INFO" "Primary found. Primary host: $primary_host, database size: $primary_db_size"
292285
break
293286
fi
294287

288+
echo -n .
289+
sleep 1
295290
done
296291

297292
if [[ "$is_primary_found" == "1" ]]; then
@@ -542,7 +537,7 @@ while true; do
542537

543538
if [[ $desired_func == "join_in_cluster" ]]; then
544539
check_member_list_updated "${member_hosts[*]}"
545-
wait_for_primary "${member_hosts[*]}"
540+
# wait_for_primary "${member_hosts[*]}"
546541
set_valid_donors
547542
join_into_cluster
548543
fi

scripts/run_innodb.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mkdir -p /etc/mysql/conf.d/
3838
cat >>/etc/mysql/my.cnf <<EOL
3939
!includedir /etc/mysql/conf.d/
4040
[mysqld]
41-
default_authentication_plugin=mysql_native_password
41+
mysql_native_password=ON
4242
#loose-group_replication_ip_whitelist = "${whitelist}"
4343
loose-group_replication_ip_allowlist = "${whitelist}"
4444
EOL

scripts/run_semi_sync.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ function install_clone_plugin() {
7474
log "INFO" "Clone plugin is not installed. Installing the plugin..."
7575
retry 120 ${mysql} -e "INSTALL PLUGIN clone SONAME 'mysql_clone.so';"
7676
reading_first_time=1
77-
retry 120 ${mysql} -e "reset master;"
77+
retry 120 ${mysql} -e "RESET BINARY LOGS AND GTIDS;"
7878
log "INFO" "Clone plugin successfully installed"
7979
else
8080
log "INFO" "Already clone plugin is installed"
@@ -90,8 +90,8 @@ function install_semiSync_plugin() {
9090
out=$(${mysql} -N -e 'SHOW PLUGINS;' | grep semisync)
9191
if [[ -z "$out" ]]; then
9292
log "INFO" "semisync plugin is not installed. Installing the plugin..."
93-
retry 120 ${mysql} -e "INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so';"
94-
retry 120 ${mysql} -e "INSTALL PLUGIN rpl_semi_sync_slave SONAME 'semisync_slave.so';"
93+
retry 120 ${mysql} -e "INSTALL PLUGIN rpl_semi_sync_source SONAME 'semisync_source.so';"
94+
retry 120 ${mysql} -e "INSTALL PLUGIN rpl_semi_sync_replica SONAME 'semisync_replica.so';"
9595
reading_first_time=1
9696
log "INFO" "semi_sync plugin successfully installed"
9797
else

0 commit comments

Comments
 (0)