Implement a tool in Gitaly to manage badger database
In Gitaly, we are using Badger, a disk-based key-value database. That database stores its files inside a sub-directory of the storage (+gitaly/database
). Recently, it has been used for storing WAL's log entries and metadata. The log entries are cleaned up instantly after they are applied and backed up. We also use protobuf for nearly everything. It makes it fairly inconvenient to debug or access a data inside the database.
The usage of this database will emerge with the introduction of generic key-value database and Raft replication. Pretty soon, we'll need to explore, access, and debug the data stored inside the database. Furthermore, we might have a need to update the data manually in extreme situations; although it's highly recommended to go through high-level tools.
This tool should be capable of detecting proto format; at least able to print them out. We don't aim to create a generic tool for databases outside the scope of Gitaly. Hence, it should make use of Gitaly's protobuf definitions for that task.
Some usage popping up in my mind:
gitaly db list --storage /path/to/storage
gitaly db list --storage /path/to/storage --partition 0
gitaly db get --storage /path/to/storage "p/000002/applied_lsn"