From 7c953b2ef165bf400916febc6685e00df7011f2c Mon Sep 17 00:00:00 2001 From: Jim Fitzpatrick Date: Wed, 25 Nov 2020 14:31:08 +0000 Subject: [PATCH] Reduce Retries The number of retries was too high for what might be happening. When dealing with a large number of files the chance for the a "file changed as we read it" error grow. Rerunning oc cp increases the run time for the backup pushing it closer to the 10 minute alert mark. --- image/tools/lib/utils.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 image/tools/lib/utils.sh diff --git a/image/tools/lib/utils.sh b/image/tools/lib/utils.sh old mode 100644 new mode 100755 index 231fda6..d7a44b7 --- a/image/tools/lib/utils.sh +++ b/image/tools/lib/utils.sh @@ -5,7 +5,8 @@ function cp_pod_data { cp_dest=$2 num_attempted_copy=0 - max_tries=5 + max_tries=3 + copy_output=$(oc cp $pod_data_src $cp_dest) # Check if any files were rewritten to during oc cp, and copy it again if it was. while [[ $copy_output == *"file changed as we read it"* ]] && [ $num_attempted_copy -lt $max_tries ] @@ -30,7 +31,7 @@ function cp_container_data { container_dest="$cp_dest-$container" timestamp_echo "backing up container $container in pod $pod_name" num_attempted_copy=0 - max_tries=5 + max_tries=3 # Disable errors because some of the containers might not have the directory to back up set +eo pipefail @@ -52,4 +53,4 @@ function cp_container_data { function timestamp_echo { echo `(date -u '+%Y-%m-%d %H:%M:%S')` '==>' $1 -} \ No newline at end of file +}