Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PITR Replication Strategy Support & Fix Same Memeber_ID #43

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions init-script/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

rm -rf /var/lib/mysql/lost+found
rm -rf /run-scripts/*
rm /var/lib/mysql/auto.cnf
cp /tmp/scripts/* /scripts
32 changes: 32 additions & 0 deletions scripts/copy-data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

ROOT_DIR="$ROOT_DIR"
TOTAL_DIR_TO_COPY="$TOTAL_DIR_TO_COPY"
DATA_DIR="$DATA_DIR"

if [ -z "$ROOT_DIR" ] || [ -z "$TOTAL_DIR_TO_COPY" ]; then
echo "ROOT_DIR and TOTAL_DIR_TO_COPY must be set."
exit 1
fi
Size1=$(du -s "$ROOT_DIR" | cut -f1)
echo "DATA DIRECTORY SIZE: ", $Size1
for (( i = 1; i <= $TOTAL_DIR_TO_COPY; i++ ));do
if [[ -d "$ROOT_DIR$i" ]];then
Size2=$(du -s "$ROOT_DIR$i" | cut -f1)
echo $Size1, " ", $Size2
if [[ "$Size1" == "$Size2" ]];then
continue
fi
fi
# not deleting any data
# because the sole purpose of this script is to copy the data
# rm -rf "$ROOT_DIR$i"/*
rm "$ROOT_DIR/mysql.sock"
cp -rvL "$ROOT_DIR/"* "$ROOT_DIR$i"/
if [[ $? -ne 0 ]]; then
echo "Error occurred while copying to $ROOT_DIR$i"
exit 1
fi
done

exit 0
Empty file modified scripts/directory-exist.sh
100644 → 100755
Empty file.
15 changes: 15 additions & 0 deletions scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
# PRIMARY_TYPE = defines single/multi primary

env | sort | grep "POD\|HOST\|NAME"
RECOVERY_DONE_FILE="/tmp/recovery.done"
if [[ "$PITR_RESTORE" == "true" ]]; then
while true; do
sleep 2
echo "Point In Time Recovery In Progress. Waiting for $RECOVERY_DONE_FILE file"
if [[ -e "$RECOVERY_DONE_FILE" ]]; then
echo "$RECOVERY_DONE_FILE found."
break
fi
done
fi

if [[ -e "$RECOVERY_DONE_FILE" ]]; then
rm $RECOVERY_DONE_FILE
fi

args=$@
script_name=${0##*/}
Expand Down
19 changes: 19 additions & 0 deletions scripts/standalone-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

if [[ -z "$TOPOLOGY" ]]; then
RECOVERY_DONE_FILE="/tmp/recovery.done"
if [[ "$PITR_RESTORE" == "true" ]]; then
while true; do
sleep 2
echo "Point In Time Recovery In Progress. Waiting for $RECOVERY_DONE_FILE file"
if [[ -e "$RECOVERY_DONE_FILE" ]]; then
echo "$RECOVERY_DONE_FILE found."
break
fi
done
fi

if [[ -e "$RECOVERY_DONE_FILE" ]]; then
rm $RECOVERY_DONE_FILE
fi
fi
Loading