Description
The current way the snapshots system is configured confuses me, and I propose to make this part clearer.
Current Design
Snapshots are configured with these parameters:
creation_enabled (boolean, set by default)
create_every_ms (number)
dir_path (string, same as default Kura storage path)
When creation is enabled, Iroha tries to read a snapshot on startup to quickly restore the WSV. Then Iroha periodically re-writes the snapshots.
When creation is disabled, Iroha still tries to read a snapshot on startup, but doesn't periodically update it.
There is no way for users to disable snapshots mechanism entirely. For example, one might want to disable even reading an existing snapshot at all. If they need to do so, they have to discover the path to the snapshot file (which is not documented) and remove it so that Iroha will not recover its WSV from the file.
Proposal
I propose to give users clearer control over snapshots by doing the following:
- Instead of
creation_enabled flag, use a parameter called mode and use a enum value for it:
normal (try to read on startup and update periodically, current behaviour with creation_enabled = true)
read (only try to read on startup, current behaviour with creation_enabled = false)
disabled (do nothing at all)
- Instead of having
dir_path defaulted to the same directory as Kura storage path (i.e. ./storage), use a different default value, e.g. ./storage/snapshots. IMO it will give a little better opportunity for users to remove the snapshots by themselves: just remove ./storage/snapshots directory, without research of which files in ./storage belong to storage and which to snapshots.
Description
The current way the snapshots system is configured confuses me, and I propose to make this part clearer.
Current Design
Snapshots are configured with these parameters:
creation_enabled(boolean, set by default)create_every_ms(number)dir_path(string, same as default Kura storage path)When creation is enabled, Iroha tries to read a snapshot on startup to quickly restore the WSV. Then Iroha periodically re-writes the snapshots.
When creation is disabled, Iroha still tries to read a snapshot on startup, but doesn't periodically update it.
There is no way for users to disable snapshots mechanism entirely. For example, one might want to disable even reading an existing snapshot at all. If they need to do so, they have to discover the path to the snapshot file (which is not documented) and remove it so that Iroha will not recover its WSV from the file.
Proposal
I propose to give users clearer control over snapshots by doing the following:
creation_enabledflag, use a parameter calledmodeand use a enum value for it:normal(try to read on startup and update periodically, current behaviour withcreation_enabled = true)read(only try to read on startup, current behaviour withcreation_enabled = false)disabled(do nothing at all)dir_pathdefaulted to the same directory as Kura storage path (i.e../storage), use a different default value, e.g../storage/snapshots. IMO it will give a little better opportunity for users to remove the snapshots by themselves: just remove./storage/snapshotsdirectory, without research of which files in./storagebelong to storage and which to snapshots.