BadgerDB v0.9 and v0.8.1 hotfix release

Today we are releasing v0.9.0 and v0.8.1 (hotfix release) for Badger.

If you have been following Badger development, you may know that we introduced transactions in Badger post the v0.8 release. This was a backward incompatible change, which meant that databases created using the previous version would not work with the later versions. Before today, there was no way to backup and restore the databases across different versions. We are addressing that shortcoming with these releases. Please read on for the details.

Using the backup tools

v0.9.0

Badger v0.9.0 provides two public API methods DB.Backup() and DB.Load() which can be used to do online backups and restores. A CLI tool badger is also included which can do offline backup/restore. Make sure you have $GOPATH/bin in your PATH to use this tool.

The command below will create a version-agnostic backup of the database, to a file badger.bak in the current working directory

badger backup --dir <path/to/badgerdb>

To restore badger.bak in the current working directory to a new database:

badger restore --dir <path/to/badgerdb>

See badger --help for more details.

v0.8.1

If you have a Badger database that was created using v0.8 (or below), you can
use the badger_backup tool provided in v0.8.1, and then restore it using the badger restore command above to upgrade your database to the latest version.

badger_backup --dir <path/to/badgerdb> --backup-file badger.bak

Upcoming changes in v1.0

In v1.0.0 we will be upgrading the manifest version of the Badger database. This is a backward incompatible change, and will require a full database upgrade. So please make sure are familiar with the APIs and tools above, and take backups of your database before upgrading versions.

2 Likes