Validate backup files with absctl restore
When you run absctl restore with --validate, it reads and decodes backup files end-to-end and fails if it encounters invalid or corrupted content.
Validate mode works with --directory, --input-file, and --directory-list to specify backup sources. It ignores data selection and Aerospike connection options because it does not connect to the database.
To validate backups in an Amazon S3 bucket, you must still connect to S3.
Example
The following example illustrates the process to create a backup file and validate it.
Create a test backup
Back up a single record to a directory:
absctl backup --host 127.0.0.1 --port 3000 --namespace test --directory test-backup-dirInspect the backup file:
cat test-backup-dir/test_00000.asbVersion 3.1# namespace test# first-file+ k S 4 key1+ n test+ d 7JEZLUt/jONdXXjTS8ply6qqyWA=+ s demo+ g 1+ t 430086781+ b 3- I foo 123- S bar 3 abc- Z baz TCorrupt the backup file
Create corruption in the backup file:
sed -i '' -e 's/S/2/g' ./test-backup-dir/test_00000.asbVerify the corruption:
cat test-backup-dir/test_00000.asbVersion 3.1# namespace test# first-file+ k 2 4 key1+ n test+ d 7JEZLUt/jONdXXjT28ply6qqyWA=+ s demo+ g 1+ t 430086781+ b 3- I foo 123- 2 bar 3 abc- Z baz TValidate the backup directory
Run absctl restore in validate mode:
absctl restore --validate -d test-backup-dirvalidation failed: failed to perform asb validation: failed to read data: error while reading asb data: 0_test_3.asb line 24 col 4 (total byte 5756): error while reading section: records: invalid character, read t, expected