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

horizon: Modify tx submission system to work with RO database #4418

Merged
merged 16 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
#4418: changed integration tests to spin up one horizon web node with…
… r/o db connection and one horizon ingest node with r/w db conn
  • Loading branch information
sreuland committed Jun 10, 2022
commit 55f4b0a29618a731ac3c0bdef93305dca663ce9f
2 changes: 1 addition & 1 deletion services/horizon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ file. This project adheres to [Semantic Versioning](https://semver.org/).
* 'whitelist by account id' ([4221](https://github.com/stellar/go/issues/4221))
* 'whitelist by canonical asset id' ([4222](https://github.com/stellar/go/issues/4222))

The filters and their configuration are optional features and must be enabled with horizon command line parameters `admin-port=4200` and `enable-ingestion-filtering=true`
The filters and their configuration are optional features and must be enabled with horizon command line parameters `admin-port=4200` and `exp-enable-ingestion-filtering=true`

Once set, filter configurations and their rules are initially empty and the filters are disabled by default. To enable filters, update the configuration settings, refer to the Admin API Docs which are published on the Admin Port at https://localhost:<admin_port>/, follow details and examples for endpoints:
* `/ingestion/filters/account`
Expand Down
7 changes: 2 additions & 5 deletions services/horizon/internal/integration/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func TestReingestDB(t *testing.T) {
itest, reachedLedger := initializeDBIntegrationTest(t)
tt := assert.New(t)

horizonConfig := itest.GetHorizonConfig()
horizonConfig := itest.GetHorizonIngestConfig()
t.Run("validate parallel range", func(t *testing.T) {
horizoncmd.RootCmd.SetArgs(command(horizonConfig,
"db",
Expand Down Expand Up @@ -537,11 +537,8 @@ func TestFillGaps(t *testing.T) {

// Create a fresh Horizon database
newDB := dbtest.Postgres(t)
// TODO: Unfortunately Horizon's ingestion System leaves open sessions behind,leading to
// a "database is being accessed by other users" error when trying to drop it
// defer newDB.Close()
freshHorizonPostgresURL := newDB.DSN
horizonConfig := itest.GetHorizonConfig()
horizonConfig := itest.GetHorizonIngestConfig()
horizonConfig.DatabaseURL = freshHorizonPostgresURL
// Initialize the DB schema
dbConn, err := db.Open("postgres", freshHorizonPostgresURL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestFilteringAccountWhiteList(t *testing.T) {
tt := assert.New(t)
const adminPort uint16 = 6000
itest := integration.NewTest(t, integration.Config{
HorizonParameters: map[string]string{
HorizonIngestParameters: map[string]string{
"admin-port": strconv.Itoa(int(adminPort)),
"exp-enable-ingestion-filtering": "true",
},
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestFilteringAssetWhiteList(t *testing.T) {
tt := assert.New(t)
const adminPort uint16 = 6000
itest := integration.NewTest(t, integration.Config{
HorizonParameters: map[string]string{
HorizonIngestParameters: map[string]string{
"admin-port": strconv.Itoa(int(adminPort)),
"exp-enable-ingestion-filtering": "true",
},
Expand Down
26 changes: 13 additions & 13 deletions services/horizon/internal/integration/parameters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ func NewParameterTest(t *testing.T, params map[string]string) *integration.Test

func NewParameterTestWithEnv(t *testing.T, params, envvars map[string]string) *integration.Test {
config := integration.Config{
ProtocolVersion: 17,
SkipHorizonStart: true,
HorizonParameters: params,
HorizonEnvironment: envvars,
ProtocolVersion: 17,
SkipHorizonStart: true,
HorizonIngestParameters: params,
HorizonEnvironment: envvars,
}
return integration.NewTest(t, config)
}
Expand Down Expand Up @@ -153,15 +153,15 @@ func TestMaxAssetsForPathRequests(t *testing.T) {
err := test.StartHorizon()
assert.NoError(t, err)
test.WaitForHorizon()
assert.Equal(t, test.Horizon().Config().MaxAssetsPerPathRequest, 15)
assert.Equal(t, test.HorizonIngest().Config().MaxAssetsPerPathRequest, 15)
test.Shutdown()
})
t.Run("set to 2", func(t *testing.T) {
test := NewParameterTest(t, map[string]string{"max-assets-per-path-request": "2"})
err := test.StartHorizon()
assert.NoError(t, err)
test.WaitForHorizon()
assert.Equal(t, test.Horizon().Config().MaxAssetsPerPathRequest, 2)
assert.Equal(t, test.HorizonIngest().Config().MaxAssetsPerPathRequest, 2)
test.Shutdown()
})
}
Expand All @@ -172,8 +172,8 @@ func TestMaxPathFindingRequests(t *testing.T) {
err := test.StartHorizon()
assert.NoError(t, err)
test.WaitForHorizon()
assert.Equal(t, test.Horizon().Config().MaxPathFindingRequests, uint(0))
_, ok := test.Horizon().Paths().(simplepath.InMemoryFinder)
assert.Equal(t, test.HorizonIngest().Config().MaxPathFindingRequests, uint(0))
_, ok := test.HorizonIngest().Paths().(simplepath.InMemoryFinder)
assert.True(t, ok)
test.Shutdown()
})
Expand All @@ -182,8 +182,8 @@ func TestMaxPathFindingRequests(t *testing.T) {
err := test.StartHorizon()
assert.NoError(t, err)
test.WaitForHorizon()
assert.Equal(t, test.Horizon().Config().MaxPathFindingRequests, uint(5))
finder, ok := test.Horizon().Paths().(*paths.RateLimitedFinder)
assert.Equal(t, test.HorizonIngest().Config().MaxPathFindingRequests, uint(5))
finder, ok := test.HorizonIngest().Paths().(*paths.RateLimitedFinder)
assert.True(t, ok)
assert.Equal(t, finder.Limit(), 5)
test.Shutdown()
Expand All @@ -196,8 +196,8 @@ func TestDisablePathFinding(t *testing.T) {
err := test.StartHorizon()
assert.NoError(t, err)
test.WaitForHorizon()
assert.Equal(t, test.Horizon().Config().MaxPathFindingRequests, uint(0))
_, ok := test.Horizon().Paths().(simplepath.InMemoryFinder)
assert.Equal(t, test.HorizonIngest().Config().MaxPathFindingRequests, uint(0))
_, ok := test.HorizonIngest().Paths().(simplepath.InMemoryFinder)
assert.True(t, ok)
test.Shutdown()
})
Expand All @@ -206,7 +206,7 @@ func TestDisablePathFinding(t *testing.T) {
err := test.StartHorizon()
assert.NoError(t, err)
test.WaitForHorizon()
assert.Nil(t, test.Horizon().Paths())
assert.Nil(t, test.HorizonIngest().Paths())
test.Shutdown()
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func TestStateVerifier(t *testing.T) {
}

// Trigger state rebuild to check if ingesting from history archive works
session := itest.Horizon().HistoryQ().Clone()
session := itest.HorizonIngest().HistoryQ().Clone()
q := &history.Q{session}
err = q.Begin()
assert.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func TestTradeAggregations(t *testing.T) {
itest := integration.NewTest(t, integration.Config{})
ctx := context.Background()
historyQ := itest.Horizon().HistoryQ()
historyQ := itest.HorizonIngest().HistoryQ()

// Insert some trades
now := strtime.Now().RoundDown(60_000)
Expand Down
Loading