Commit a21d8d03 authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5: restore ZODB using the --with-verify option of "repozo --recover"

"repozo --verify" is not working as this code expects it to: it simply
prints errors in stdout, and doesn't return an error code in case of
error. Thus, running it had absolutely no effect, except wasting IO
and CPU time.

This commit introduces the use of "repozo --recover --with-verify",
which runs the verify and the recover in a same step, and has the
advantage to raise (it doesn't exit with 0) in case of error. Also, as
it does the verification and the recovery at the same time, it uses
half the IO for the read. On a production server using SSDs, with a
ZODB of 1Tb, runner-import-restore now takes 14h instead of 26h, iow a
performance increase of 46%.
parent b9a6392d
...@@ -78,7 +78,7 @@ md5sum = 07012cab8738836bb315f61bcc09c0c3 ...@@ -78,7 +78,7 @@ md5sum = 07012cab8738836bb315f61bcc09c0c3
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
md5sum = d86d6808b745ee66be3a914487b25744 md5sum = a9d42d8b2aee3c329913d46e0e3cd108
[template-zodb-base] [template-zodb-base]
filename = instance-zodb-base.cfg.in filename = instance-zodb-base.cfg.in
......
...@@ -154,13 +154,7 @@ input = inline: #!/bin/sh ...@@ -154,13 +154,7 @@ input = inline: #!/bin/sh
fi fi
echo "Removing $zodb_path..." echo "Removing $zodb_path..."
echo "Restoring $storage_name into $zodb_path..." echo "Restoring $storage_name into $zodb_path..."
$repozo --verify --repository="$zodb_backup_directory/$storage_name" $repozo --recover --with-verify --output="$zodb_directory/$zodb_path" --repository="$zodb_backup_directory/$storage_name"
CURRENT_EXIT_CODE=$?
if [ ! "$CURRENT_EXIT_CODE"="0" ]; then
echo "$storage_name Backup verification failed. Backup data is inconsistent."
exit "$CURRENT_EXIT_CODE"
fi
$repozo --recover --output="$zodb_directory/$zodb_path" --repository="$zodb_backup_directory/$storage_name"
CURRENT_EXIT_CODE=$? CURRENT_EXIT_CODE=$?
if [ ! "$CURRENT_EXIT_CODE"="0" ]; then if [ ! "$CURRENT_EXIT_CODE"="0" ]; then
EXIT_CODE="$CURRENT_EXIT_CODE" EXIT_CODE="$CURRENT_EXIT_CODE"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment