From 112f0f5538d4e6fb662a1005562efebf2adef9ef Mon Sep 17 00:00:00 2001 From: Garand Tyson Date: Thu, 5 Jan 2023 14:15:14 -0800 Subject: [PATCH] Enable BucketListDB by default in captive core --- .../testdata/expected-offline-core.cfg | 2 ++ ingest/ledgerbackend/toml.go | 18 ++++++++++++++++++ services/horizon/CHANGELOG.md | 6 ++++++ 3 files changed, 26 insertions(+) diff --git a/ingest/ledgerbackend/testdata/expected-offline-core.cfg b/ingest/ledgerbackend/testdata/expected-offline-core.cfg index d6a80a628d..53838f6165 100644 --- a/ingest/ledgerbackend/testdata/expected-offline-core.cfg +++ b/ingest/ledgerbackend/testdata/expected-offline-core.cfg @@ -1,5 +1,7 @@ # Generated file, do not edit DATABASE = "sqlite3://stellar.db" +EXPERIMENTAL_BUCKETLIST_DB = true +EXPERIMENTAL_BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT = 12 FAILURE_SAFETY = 0 HTTP_PORT = 0 LOG_FILE_PATH = "" diff --git a/ingest/ledgerbackend/toml.go b/ingest/ledgerbackend/toml.go index 3f34660af3..9a2845ecac 100644 --- a/ingest/ledgerbackend/toml.go +++ b/ingest/ledgerbackend/toml.go @@ -83,6 +83,9 @@ type captiveCoreTomlValues struct { Validators []Validator `toml:"VALIDATORS,omitempty"` HistoryEntries map[string]History `toml:"-"` QuorumSetEntries map[string]QuorumSet `toml:"-"` + UseBucketListDB bool `toml:"EXPERIMENTAL_BUCKETLIST_DB,omitempty"` + BucketListDBPageSizeExp *uint `toml:"EXPERIMENTAL_BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT,omitempty"` + BucketListDBCutoff *uint `toml:"EXPERIMENTAL_BUCKETLIST_DB_INDEX_CUTOFF,omitempty"` } // QuorumSetIsConfigured returns true if there is a quorum set defined in the configuration. @@ -415,6 +418,15 @@ func (c *CaptiveCoreToml) setDefaults(params CaptiveCoreTomlParams) { c.Database = "sqlite3://stellar.db" } + if def := c.tree.Has("EXPERIMENTAL_BUCKETLIST_DB"); !def && params.UseDB { + c.UseBucketListDB = true + } + + if c.UseBucketListDB && !c.tree.Has("EXPERIMENTAL_BUCKETLIST_DB_INDEX_PAGE_SIZE_EXPONENT") { + n := uint(12) + c.BucketListDBPageSizeExp = &n // Set default page size to 4KB + } + if !c.tree.Has("NETWORK_PASSPHRASE") { c.NetworkPassphrase = params.NetworkPassphrase } @@ -482,6 +494,12 @@ func (c *CaptiveCoreToml) validate(params CaptiveCoreTomlParams) error { ) } + if def := c.tree.Has("EXPERIMENTAL_BUCKETLIST_DB"); def && !params.UseDB { + return fmt.Errorf( + "BucketListDB enabled in captive core config file, requires Horizon flag --captive-core-use-db", + ) + } + homeDomainSet := map[string]HomeDomain{} for _, hd := range c.HomeDomains { if _, ok := homeDomainSet[hd.HomeDomain]; ok { diff --git a/services/horizon/CHANGELOG.md b/services/horizon/CHANGELOG.md index 5ca9a2f6a9..fd183d8472 100644 --- a/services/horizon/CHANGELOG.md +++ b/services/horizon/CHANGELOG.md @@ -6,6 +6,12 @@ file. This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased +## 2.23.2 + +### Changes + +- Add support for BucketListDB params in captive core cfg/.toml file and enable BucketListDB by default when `--captive-core-use-db` set. + ## 2.23.1 ### Changes