diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-10-08 15:35:44 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-10-08 15:35:44 +0200 |
commit | b3fee746c053990c88c0e067b1a654acbeb1cd1f (patch) | |
tree | de29e4efaaaccab453d321079f06831c41859b50 /exp/exp.sh | |
parent | be1ad1c114b77b654bd3e79fdb18b5d5cf93ddd1 (diff) | |
download | dna-backup-b3fee746c053990c88c0e067b1a654acbeb1cd1f.tar.gz dna-backup-b3fee746c053990c88c0e067b1a654acbeb1cd1f.zip |
exp: repo 4k, better summary format, fix diff sizes
Diffstat (limited to 'exp/exp.sh')
-rwxr-xr-x | exp/exp.sh | 40 |
1 files changed, 31 insertions, 9 deletions
@@ -5,7 +5,8 @@ # - REPO_PATH: the path of the repo the experiment is based on # - MAX_VERSION: the max number for versions for the experiment # - COMMITS: the name of the file that contains the lists of versions -# - BACKUP: the path fo the dna-backup dir +# - DNA_4K: the path fo the dna-backup dir with 4K chunksize +# - DNA_8K: the path fo the dna-backup dir with 8K chunksize # - DIFFS: the path of the git diff dir log() { @@ -22,27 +23,38 @@ last=$(tail --lines=1 $COMMITS | cut -f1) i=0 cat $COMMITS | while read line do + # Get hash hash=$(echo "$line" | cut -f1) + # Check out repo log "check out $hash" $GITC checkout $hash 2> $OUT \ || (log "error checking out"; cat $OUT; exit 1) - log "create diff for this version" + # Create git diff for this version + log "create git diff for this version" + diff=$(printf "%s/%05d.diff.gz" $DIFFS $i) $GITC diff --minimal --binary --unified=0 -l0 $prev \ | gzip \ - > "$DIFFS/$i.diff.gz" + > $diff - log "create backup for this version" - $DNA_BACKUP commit -v 2 $REPO_PATH $BACKUP + # Create 4k dna backup for this version + log "create 4k dna backup for this version" + $DNA_BACKUP commit -v 2 -c 4096 $REPO_PATH $DNA_4K + + # Create 8k dna backup for this version + log "create 8k dna backup for this version" + $DNA_BACKUP commit -v 2 $REPO_PATH $DNA_8K if [[ $(( $i % 4 )) == 0 ]] then - log "restore from diffs" + # Check restore from git diffs + log "restore from git diffs" TEMP=$(mktemp -d) for n in $(seq 0 $i) do - cat "$DIFFS/$n.diff.gz" \ + diff=$(printf "%s/%05d.diff.gz" $DIFFS $n) + cat $diff \ | gzip --decompress \ | git -C $TEMP apply --binary --unidiff-zero --whitespace=nowarn - done @@ -52,9 +64,19 @@ do || log "git patchs restore do not match source" rm -rf $TEMP - log "restore from backup" + # Check restore from 4k dna backup + log "restore from 4k dna backup" + TEMP=$(mktemp -d) + $DNA_BACKUP restore -v 2 -c 4096 $DNA_4K $TEMP + log "check restore from backup" + diff --brief --recursive $REPO_PATH $TEMP \ + || log "dna backup restore do not match source" + rm -rf $TEMP + + # Check restore from 8k dna backup + log "restore from 8k dna backup" TEMP=$(mktemp -d) - $DNA_BACKUP restore -v 2 $BACKUP $TEMP + $DNA_BACKUP restore -v 2 $DNA_8K $TEMP log "check restore from backup" diff --brief --recursive $REPO_PATH $TEMP \ || log "dna backup restore do not match source" |