This document describes index snapshots, what they are and how they can be created and restored.
Table of Contents
Index snapshots are images of the DPS index database. These images can be used to easily transfer DPS index snapshots as a single file or to archive them in a more space-efficient manner. They can also be used in testing, so that tests have actual blocks, accounts, transactions and other information to operate on.
At a low level, snapshots are created using the badger backup functionality. Technical documentation can be found here.
Index snapshots are created using create-index-snapshot
CLI tool, which is documented here.
By default, the snapshot is not encoded and output contains raw (binary) data.
$ create-index-snapshot -i <index_dir> > output.bin
When an index snapshot is created, it can be compressed with a specific compression algorithm (zstd or gzip). When restoring the index, the snapshot needs to be decompressed using the same algorithm or the snapshot restore will fail.
Restoring snapshots is done using the restore-index-snapshot
CLI tool, which is documented here.
To successfully restore the snapshot, you must specify the compression and encoding options that were used to create it.
Example of restoring a gzip compressed snapshot:
$ restore-index-snapshot -i /var/dps/index -c gzip < dps-index-snapshot.gz