Skip to content

Commit

Permalink
feat: rework data node mode options and make the default archive
Browse files Browse the repository at this point in the history
  • Loading branch information
wwestgarth committed Sep 27, 2023
1 parent 1fb26aa commit 2b1260b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
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

0 comments on commit 2b1260b

Please sign in to comment.