Skip to content

Add support for read-only database #1395

@danlaine

Description

@danlaine

Context and scope

Add a new flag --db-read-only. When the flag is used, avalanchego will read from the database it's given, but it won't ever write to it. Instead it will only write to an in-memory database layer atop the one on disk. This will be useful for testing. For example, suppose we want to run a test that relies on same data on disk. During the test, we write to the database. During the next test run, we'll have to redownload/regenerate the original database, since the one on disk has been written to and now has a different state.

This can be accomplished by wrapping the database in a versiondb and never committing the versiondb.

We should error on startup if --db-flag-only and --db-type=memdb is given since it's redundant.

Discussion and alternatives

Open questions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done 🎉

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions