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

services/horizon: Error when setting BUCKET_DIR_PATH through --captive-core-config-path #3707

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUCKET_DIR_PATH="test-buckets"

3 changes: 1 addition & 2 deletions ingest/ledgerbackend/testdata/appendix-with-fields.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FAILURE_SAFETY=2
UNSAFE_QUORUM=false
PUBLIC_HTTP_PORT=true
RUN_STANDALONE=false
BUCKET_DIR_PATH="test-buckets"
HTTP_PORT = 6789
PEER_PORT = 12345
LOG_FILE_PATH = ""
Expand Down Expand Up @@ -64,4 +63,4 @@ VALIDATORS=[
"GAXSWUO4RBELRQT5WMDLIKTRIKC722GGXX2GIGEYQZDQDLOTINQ4DX6F J_from_above",
"GAWOEMG7DQDWHCFDTPJEBYWRKUUZTX2M2HLMNABM42G7C7IAPU54GL6X K_from_above",
"GDZAJNUUDJFKTZX3YWZSOAS4S4NGCJ5RQAY7JPYBG5CUFL3JZ5C3ECOH L_from_above"
]
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Generated file, do not edit
BUCKET_DIR_PATH = "test-buckets"
FAILURE_SAFETY = 0
HTTP_PORT = 0
LOG_FILE_PATH = ""
Expand Down
7 changes: 6 additions & 1 deletion ingest/ledgerbackend/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ func NewCaptiveCoreTomlFromFile(configPath string, params CaptiveCoreTomlParams)
if err = captiveCoreToml.unmarshal(data, params.Strict); err != nil {
return nil, errors.Wrap(err, "could not unmarshal captive core toml")
}
// disallow setting BUCKET_DIR_PATH through a file since it can cause multiple
// running captive-core instances to clash
if params.Strict && captiveCoreToml.BucketDirPath != "" {
return nil, errors.New("could not unmarshal captive core toml: setting BUCKET_DIR_PATH is disallowed, it can cause clashes between instances")
}

if err = captiveCoreToml.validate(params); err != nil {
return nil, errors.Wrap(err, "invalid captive core toml")
Expand Down Expand Up @@ -390,7 +395,7 @@ func (c *CaptiveCoreToml) CatchupToml() (*CaptiveCoreToml, error) {
// Add a fictional quorum -- necessary to convince core to start up;
// but not used at all for our purposes. Pubkey here is just random.
offline.QuorumSetEntries = map[string]QuorumSet{
"QUORUM_SET": QuorumSet{
"QUORUM_SET": {
ThresholdPercent: 100,
Validators: []string{"GCZBOIAY4HLKAJVNJORXZOZRAY2BJDBZHKPBHZCRAIUR5IHC2UHBGCQR"},
},
Expand Down
5 changes: 5 additions & 0 deletions ingest/ledgerbackend/toml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ func TestCaptiveCoreTomlValidation(t *testing.T) {
logPath: nil,
expectedError: "could not unmarshal captive core toml: these fields are not supported by captive core: [\"CATCHUP_RECENT\"]",
},
{
name: "unexpected BUCKET_DIR_PATH",
appendPath: filepath.Join("testdata", "appendix-with-bucket-dir-path.cfg"),
expectedError: "could not unmarshal captive core toml: setting BUCKET_DIR_PATH is disallowed, it can cause clashes between instances",
},
} {
t.Run(testCase.name, func(t *testing.T) {
params := CaptiveCoreTomlParams{
Expand Down
1 change: 1 addition & 0 deletions services/horizon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ file. This project adheres to [Semantic Versioning](http://semver.org/).
* Handle replica conflict errors gracefully ([3674](https://github.com/stellar/go/pull/3674)).
* Fix data race in request parameters handling ([3690](https://github.com/stellar/go/pull/3690)).
* Fix bug where the configuration for `CAPTIVE_CORE_LOG_PATH`, `CAPTIVE_CORE_PEER_PORT`, and `CAPTIVE_CORE_HTTP_PORT` were ignored if they were configured via environment variables instead of command line arguments. ([3702](https://github.com/stellar/go/pull/3702)).
* Error when setting `BUCKET_DIR_PATH` through `--captive-core-config-path` ([3707](https://github.com/stellar/go/pull/3707)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Error when setting `BUCKET_DIR_PATH` through `--captive-core-config-path` ([3707](https://github.com/stellar/go/pull/3707)).
* Fix error when setting `BUCKET_DIR_PATH` through `--captive-core-config-path` ([3707](https://github.com/stellar/go/pull/3707)).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error is a verb here


## v2.4.1

Expand Down