Skip to content

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:

Terminal window
absctl backup --host 127.0.0.1 --port 3000 --namespace test --directory test-backup-dir

Inspect the backup file:

Terminal window
cat test-backup-dir/test_00000.asb
Backup file content
Version 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 T

Corrupt the backup file

Create corruption in the backup file:

Terminal window
sed -i '' -e 's/S/2/g' ./test-backup-dir/test_00000.asb

Verify the corruption:

Terminal window
cat test-backup-dir/test_00000.asb
Corrupted backup file content
Version 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 T

Validate the backup directory

Run absctl restore in validate mode:

Terminal window
absctl restore --validate -d test-backup-dir
Validate mode output
validation 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
Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?