aboutsummaryrefslogtreecommitdiff
path: root/exp/exp.sh
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-10-08 15:35:44 +0200
committern-peugnet <n.peugnet@free.fr>2021-10-08 15:35:44 +0200
commitb3fee746c053990c88c0e067b1a654acbeb1cd1f (patch)
treede29e4efaaaccab453d321079f06831c41859b50 /exp/exp.sh
parentbe1ad1c114b77b654bd3e79fdb18b5d5cf93ddd1 (diff)
downloaddna-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-xexp/exp.sh40
1 files changed, 31 insertions, 9 deletions
diff --git a/exp/exp.sh b/exp/exp.sh
index f7a603c..8a7af40 100755
--- a/exp/exp.sh
+++ b/exp/exp.sh
@@ -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"