Skip to content

Commit

Permalink
Enable BucketListDB by default in captive core
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTyson committed Jan 5, 2023
1 parent b4ba6f8 commit 112f0f5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ingest/ledgerbackend/testdata/expected-offline-core.cfg
Original file line number Diff line number Diff line change
@@ -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 = ""
Expand Down
18 changes: 18 additions & 0 deletions ingest/ledgerbackend/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions services/horizon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 112f0f5

Please sign in to comment.