-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement delete target backup for Greenplum (#1350)
- Loading branch information
1 parent
07c2734
commit 8ecfcbb
Showing
17 changed files
with
477 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
docker/gp_tests/scripts/configs/delete_target_delta_find_full_test_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"WALG_DELTA_MAX_STEPS": "100", | ||
"WALE_S3_PREFIX": "s3://gpdeletetargetbucket", | ||
"WALG_LOG_LEVEL": "DEVEL" |
3 changes: 3 additions & 0 deletions
3
docker/gp_tests/scripts/configs/delete_target_delta_test_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"WALG_DELTA_MAX_STEPS": "100", | ||
"WALE_S3_PREFIX": "s3://gpdeletetargetbucket", | ||
"WALG_LOG_LEVEL": "DEVEL" |
3 changes: 3 additions & 0 deletions
3
docker/gp_tests/scripts/configs/delete_target_test_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"WALG_DELTA_MAX_STEPS": "1", | ||
"WALE_S3_PREFIX": "s3://gpdeletetargetbucket", | ||
"WALG_LOG_LEVEL": "DEVEL" |
73 changes: 73 additions & 0 deletions
73
docker/gp_tests/scripts/tests/delete_target_delta_find_full_test.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
set -e -x | ||
CONFIG_FILE="/tmp/configs/delete_target_delta_find_full_test_config.json" | ||
|
||
COMMON_CONFIG="/tmp/configs/common_config.json" | ||
TMP_CONFIG="/tmp/configs/tmp_config.json" | ||
cat ${CONFIG_FILE} > ${TMP_CONFIG} | ||
echo "," >> ${TMP_CONFIG} | ||
cat ${COMMON_CONFIG} >> ${TMP_CONFIG} | ||
/tmp/pg_scripts/wrap_config_file.sh ${TMP_CONFIG} | ||
source /tmp/tests/test_functions/util.sh | ||
|
||
bootstrap_gp_cluster | ||
sleep 3 | ||
setup_wal_archiving | ||
enable_pitr_extension | ||
|
||
wal-g --config=${TMP_CONFIG} delete everything FORCE --confirm | ||
|
||
# create full backup and incremental | ||
for i in 1 2 | ||
do | ||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push | ||
done | ||
|
||
# remember the backup-list output | ||
# later in the test we create new backups which should be deleted so lists should be identical | ||
wal-g --config=${TMP_CONFIG} backup-list | ||
lines_before_delete=`wal-g --config=${TMP_CONFIG} backup-list | wc -l` | ||
wal-g --config=${TMP_CONFIG} backup-list | tail -n 2 > /tmp/list_before_delete | ||
|
||
# create one full and two increments | ||
for i in 1 2 3 | ||
do | ||
if [ $i -eq 1 ]; then | ||
modifier='--full' | ||
else | ||
modifier='' | ||
fi | ||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push ${modifier} | ||
done | ||
|
||
# get the name of the second incremental backup | ||
SECOND_INCREMENT=$(wal-g --config=${TMP_CONFIG} backup-list | awk 'NR==5 {print $1}') | ||
|
||
# make two increments from the SECOND_INCREMENT | ||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push | ||
|
||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push | ||
|
||
# delete the SECOND_INCREMENT with FIND_FULL, should leave only the first full backup w/ first increment | ||
wal-g --config=${TMP_CONFIG} delete target FIND_FULL ${SECOND_INCREMENT} --confirm | ||
|
||
wal-g --config=${TMP_CONFIG} backup-list | ||
|
||
lines_after_delete=`wal-g --config=${TMP_CONFIG} backup-list | wc -l` | ||
wal-g --config=${TMP_CONFIG} backup-list | tail -n 2 > /tmp/list_after_delete | ||
|
||
if [ $(($lines_before_delete)) -ne $lines_after_delete ]; | ||
then | ||
echo $(($lines_before_delete)) > /tmp/before_delete | ||
echo $lines_after_delete > /tmp/after_delete | ||
echo "Wrong number of deleted lines" | ||
diff /tmp/before_delete /tmp/after_delete | ||
fi | ||
|
||
diff /tmp/list_before_delete /tmp/list_after_delete | ||
cleanup | ||
rm ${TMP_CONFIG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/bash | ||
set -e -x | ||
CONFIG_FILE="/tmp/configs/delete_target_delta_test_config.json" | ||
|
||
COMMON_CONFIG="/tmp/configs/common_config.json" | ||
TMP_CONFIG="/tmp/configs/tmp_config.json" | ||
cat ${CONFIG_FILE} > ${TMP_CONFIG} | ||
echo "," >> ${TMP_CONFIG} | ||
cat ${COMMON_CONFIG} >> ${TMP_CONFIG} | ||
/tmp/pg_scripts/wrap_config_file.sh ${TMP_CONFIG} | ||
source /tmp/tests/test_functions/util.sh | ||
|
||
bootstrap_gp_cluster | ||
sleep 3 | ||
setup_wal_archiving | ||
enable_pitr_extension | ||
|
||
wal-g --config=${TMP_CONFIG} delete everything FORCE --confirm | ||
|
||
# create full backup and incremental | ||
for i in 1 2 | ||
do | ||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push | ||
done | ||
|
||
# remember the name of the first increment | ||
FIRST_INCREMENT=$(wal-g --config=${TMP_CONFIG} backup-list | awk 'END {print $1}') | ||
|
||
# make the second full backup | ||
wal-g --config=${TMP_CONFIG} backup-push --full | ||
|
||
# make the increment from the second full backup | ||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push | ||
|
||
# remember the backup-list output with two full backups and two increments. | ||
# later in the test we create new backups which should be deleted so lists should be identical | ||
lines_before_delete=`wal-g --config=${TMP_CONFIG} backup-list | wc -l` | ||
wal-g --config=${TMP_CONFIG} backup-list | tail -n 4 > /tmp/list_before_delete | ||
|
||
# now make increment from the FIRST_INCREMENT, which will be deleted later | ||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push --delta-from-name ${FIRST_INCREMENT} | ||
INCREMENT_TO_DELETE=$(wal-g --config=${TMP_CONFIG} backup-list | awk 'END {print $1}') | ||
|
||
# make the increment from the INCREMENT_TO_DELETE | ||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push --delta-from-name ${INCREMENT_TO_DELETE} | ||
|
||
# make one more increment from the INCREMENT_TO_DELETE | ||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push --delta-from-name ${INCREMENT_TO_DELETE} | ||
|
||
# delete the INCREMENT_TO_DELETE, should leave only the first full backup w/ first increment and the second full backup w/ first increment | ||
wal-g --config=${TMP_CONFIG} delete target ${INCREMENT_TO_DELETE} --confirm | ||
|
||
lines_after_delete=`wal-g --config=${TMP_CONFIG} backup-list | wc -l` | ||
wal-g --config=${TMP_CONFIG} backup-list | tail -n 4 > /tmp/list_after_delete | ||
|
||
if [ $(($lines_before_delete)) -ne $lines_after_delete ]; | ||
then | ||
echo $(($lines_before_delete)) > /tmp/before_delete | ||
echo $lines_after_delete > /tmp/after_delete | ||
echo "Wrong number of deleted lines" | ||
diff /tmp/before_delete /tmp/after_delete | ||
fi | ||
|
||
|
||
diff /tmp/list_before_delete /tmp/list_after_delete | ||
cleanup | ||
rm ${TMP_CONFIG} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
set -e -x | ||
CONFIG_FILE="/tmp/configs/delete_target_test_config.json" | ||
|
||
COMMON_CONFIG="/tmp/configs/common_config.json" | ||
TMP_CONFIG="/tmp/configs/tmp_config.json" | ||
cat ${CONFIG_FILE} > ${TMP_CONFIG} | ||
echo "," >> ${TMP_CONFIG} | ||
cat ${COMMON_CONFIG} >> ${TMP_CONFIG} | ||
/tmp/pg_scripts/wrap_config_file.sh ${TMP_CONFIG} | ||
source /tmp/tests/test_functions/util.sh | ||
|
||
bootstrap_gp_cluster | ||
sleep 3 | ||
setup_wal_archiving | ||
enable_pitr_extension | ||
|
||
wal-g --config=${TMP_CONFIG} delete everything FORCE --confirm | ||
|
||
for i in 1 2 3 4 5 | ||
do | ||
insert_data | ||
wal-g --config=${TMP_CONFIG} backup-push | ||
done | ||
|
||
lines_before_delete=`wal-g --config=${TMP_CONFIG} backup-list | wc -l` | ||
wal-g --config=${TMP_CONFIG} backup-list | tail -n 3 > /tmp/list_before_delete | ||
|
||
FULL_BACKUP=$(wal-g --config=${TMP_CONFIG} backup-list | awk 'NR==2{print $1}') | ||
|
||
wal-g --config=${TMP_CONFIG} delete target ${FULL_BACKUP} --confirm | ||
|
||
lines_after_delete=`wal-g --config=${TMP_CONFIG} backup-list | wc -l` | ||
wal-g --config=${TMP_CONFIG} backup-list | tail -n 3 > /tmp/list_after_delete | ||
|
||
if [ $(($lines_before_delete-2)) -ne $lines_after_delete ]; | ||
then | ||
echo $(($lines_before_delete-2)) > /tmp/before_delete | ||
echo $lines_after_delete > /tmp/after_delete | ||
echo "Wrong number of deleted lines" | ||
diff /tmp/before_delete /tmp/after_delete | ||
fi | ||
|
||
|
||
diff /tmp/list_before_delete /tmp/list_after_delete | ||
cleanup | ||
rm ${TMP_CONFIG} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.