You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +03:00
feat(backup): update to mcs_backup_manager to v3.14 adding integer checks on inputs (#3465)
This commit is contained in:
@ -13,7 +13,7 @@
|
|||||||
#
|
#
|
||||||
########################################################################
|
########################################################################
|
||||||
# Documentation: bash mcs_backup_manager.sh help
|
# Documentation: bash mcs_backup_manager.sh help
|
||||||
# Version: 3.13
|
# Version: 3.14
|
||||||
#
|
#
|
||||||
# Backup Example
|
# Backup Example
|
||||||
# LocalStorage: sudo ./mcs_backup_manager.sh backup
|
# LocalStorage: sudo ./mcs_backup_manager.sh backup
|
||||||
@ -26,7 +26,7 @@
|
|||||||
# S3: sudo ./mcs_backup_manager.sh restore -bb s3://my-cs-backups -l <date>
|
# S3: sudo ./mcs_backup_manager.sh restore -bb s3://my-cs-backups -l <date>
|
||||||
#
|
#
|
||||||
########################################################################
|
########################################################################
|
||||||
mcs_bk_manager_version="3.13"
|
mcs_bk_manager_version="3.14"
|
||||||
start=$(date +%s)
|
start=$(date +%s)
|
||||||
action=$1
|
action=$1
|
||||||
|
|
||||||
@ -350,6 +350,9 @@ parse_backup_variables() {
|
|||||||
|
|
||||||
# Adjustment for indirect mode
|
# Adjustment for indirect mode
|
||||||
if [ $mode == "indirect" ]; then skip_locks=true; skip_save_brm=true; fi;
|
if [ $mode == "indirect" ]; then skip_locks=true; skip_save_brm=true; fi;
|
||||||
|
|
||||||
|
# check retention_days isnt empty string and is an integer
|
||||||
|
confirm_integer_else_fail "$retention_days" "Retention"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_backup_help_text() {
|
print_backup_help_text() {
|
||||||
@ -664,8 +667,8 @@ validation_prechecks_for_backup() {
|
|||||||
if [ "$mode" != "direct" ] && [ "$mode" != "indirect" ] ; then printf "\n[!!!] Invalid field --mode: $mode\n"; exit 1; fi
|
if [ "$mode" != "direct" ] && [ "$mode" != "indirect" ] ; then printf "\n[!!!] Invalid field --mode: $mode\n"; exit 1; fi
|
||||||
|
|
||||||
# Poll Variable Checks
|
# Poll Variable Checks
|
||||||
confirm_numerical_or_decimal_else_fail "$poll_interval" "poll_interval"
|
confirm_integer_else_fail "$poll_interval" "poll_interval"
|
||||||
confirm_numerical_or_decimal_else_fail "$poll_max_wait" "poll_max_wait"
|
confirm_integer_else_fail "$poll_max_wait" "poll_max_wait"
|
||||||
max_poll_attempts=$((poll_max_wait * 60 / poll_interval))
|
max_poll_attempts=$((poll_max_wait * 60 / poll_interval))
|
||||||
if [ "$max_poll_attempts" -lt 1 ]; then max_poll_attempts=1; fi;
|
if [ "$max_poll_attempts" -lt 1 ]; then max_poll_attempts=1; fi;
|
||||||
|
|
||||||
@ -3124,6 +3127,8 @@ parse_dbrms_variables() {
|
|||||||
exit 1;
|
exit 1;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
confirm_integer_else_fail "$retention_days" "Retention"
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_dbrm_restore_variables() {
|
parse_dbrm_restore_variables() {
|
||||||
@ -3178,6 +3183,20 @@ parse_dbrm_restore_variables() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
confirm_integer_else_fail() {
|
||||||
|
local input="$1"
|
||||||
|
local variable_name="$2"
|
||||||
|
|
||||||
|
# Regular expression to match integer values
|
||||||
|
if [[ $input =~ ^[0-9]+$ ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
printf "[!] $variable_name = '$input' is not an integer.\n\n"
|
||||||
|
alert "[!] $variable_name = '$input' is not an integer.\n\n"
|
||||||
|
exit 2;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
confirm_numerical_or_decimal_else_fail() {
|
confirm_numerical_or_decimal_else_fail() {
|
||||||
local input="$1"
|
local input="$1"
|
||||||
local variable_name="$2"
|
local variable_name="$2"
|
||||||
@ -3213,7 +3232,6 @@ validation_prechecks_for_dbrm_backup() {
|
|||||||
|
|
||||||
# Check numbers
|
# Check numbers
|
||||||
confirm_numerical_or_decimal_else_fail "$backup_interval_minutes" "Interval"
|
confirm_numerical_or_decimal_else_fail "$backup_interval_minutes" "Interval"
|
||||||
confirm_numerical_or_decimal_else_fail "$retention_days" "Retention"
|
|
||||||
|
|
||||||
# Check backup location exists
|
# Check backup location exists
|
||||||
if [ ! -d $backup_location ]; then
|
if [ ! -d $backup_location ]; then
|
||||||
|
Reference in New Issue
Block a user