Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rework data node mode options and make the default archive #9583

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [8679](https://github.com/vegaprotocol/vega/issues/8679) - Snapshot configuration `load-from-block-height` no longer accept `-1` as value. To reload from the latest snapshot, it should be valued `0`.
- [8679](https://github.com/vegaprotocol/vega/issues/8679) - Snapshot configuration `snapshot-keep-recent` only accept values from `1` (included) to `10` (included) .
- [8944](https://github.com/vegaprotocol/vega/issues/8944) - Asset ID field on the `ExportLedgerEntriesRequest gRPC API` for exporting ledger entries has changed type to make it optional.
- [9562](https://github.com/vegaprotocol/vega/issues/9562) - `--lite` and `--archive` options to data node have been replaced with `--mode=[archive|lite|standard]` with default mode as archive.

### 🗑️ Deprecation

Expand Down
14 changes: 4 additions & 10 deletions cmd/data-node/commands/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ import (
type InitCmd struct {
config.VegaHomeFlag

Force bool `description:"Erase exiting vega configuration at the specified path" long:"force" short:"f"`
Archive bool `description:"Disable database retention policies. Keeps data and network history indefinitely" long:"archive" short:"a"`
Lite bool `description:"Set all database retention policies to one day only" long:"lite" short:"l"`
Force bool `description:"Erase exiting vega configuration at the specified path" long:"force" short:"f"`
Mode string `choice:"archive" choice:"lite" choice:"standard" default:"archive" description:"Set which mode to initialise the data node with, will affect retention policies" long:"mode" short:"m"`
}

var initCmd InitCmd
Expand Down Expand Up @@ -73,19 +72,14 @@ func (opts *InitCmd) Execute(args []string) error {

cfg := config.NewDefaultConfig()

if opts.Archive && opts.Lite {
return fmt.Errorf("specify either archive mode, lite mode - not both")
}

if opts.Archive {
if opts.Mode == "archive" {
cfg.NetworkHistory.Store.HistoryRetentionBlockSpan = math.MaxInt64
cfg.SQLStore.RetentionPeriod = sqlstore.RetentionPeriodArchive
}

if opts.Lite {
if opts.Mode == "lite" {
cfg.SQLStore.RetentionPeriod = sqlstore.RetentionPeriodLite
}

cfg.ChainID = chainID

if err := cfgLoader.Save(&cfg); err != nil {
Expand Down