Skip to content

Commit

Permalink
Reduce Retries
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Boomatang authored and grdryn committed Dec 14, 2020
1 parent 2fa27ce commit 7c953b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions image/tools/lib/utils.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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
Expand All @@ -52,4 +53,4 @@ function cp_container_data {

function timestamp_echo {
echo `(date -u '+%Y-%m-%d %H:%M:%S')` '==>' $1
}
}

0 comments on commit 7c953b2

Please sign in to comment.