Skip to content

Commit

Permalink
Propogate HA URLs through ingestion interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Nov 8, 2022
1 parent 3a49500 commit e9ff932
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion services/horizon/cmd/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func runDBReingestRange(ledgerRanges []history.LedgerRange, reingestForce bool,

ingestConfig := ingest.Config{
NetworkPassphrase: config.NetworkPassphrase,
HistoryArchiveURL: config.HistoryArchiveURLs[0],
HistoryArchiveURLs: config.HistoryArchiveURLs,
CheckpointFrequency: config.CheckpointFrequency,
ReingestEnabled: true,
MaxReingestRetries: int(retries),
Expand Down
6 changes: 3 additions & 3 deletions services/horizon/cmd/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ var ingestVerifyRangeCmd = &cobra.Command{
ingestConfig := ingest.Config{
NetworkPassphrase: config.NetworkPassphrase,
HistorySession: horizonSession,
HistoryArchiveURL: config.HistoryArchiveURLs[0],
HistoryArchiveURLs: config.HistoryArchiveURLs,
EnableCaptiveCore: config.EnableCaptiveCoreIngestion,
CaptiveCoreBinaryPath: config.CaptiveCoreBinaryPath,
CaptiveCoreConfigUseDB: config.CaptiveCoreConfigUseDB,
Expand Down Expand Up @@ -202,7 +202,7 @@ var ingestStressTestCmd = &cobra.Command{
ingestConfig := ingest.Config{
NetworkPassphrase: config.NetworkPassphrase,
HistorySession: horizonSession,
HistoryArchiveURL: config.HistoryArchiveURLs[0],
HistoryArchiveURLs: config.HistoryArchiveURLs,
EnableCaptiveCore: config.EnableCaptiveCoreIngestion,
RoundingSlippageFilter: config.RoundingSlippageFilter,
}
Expand Down Expand Up @@ -293,7 +293,7 @@ var ingestInitGenesisStateCmd = &cobra.Command{
ingestConfig := ingest.Config{
NetworkPassphrase: config.NetworkPassphrase,
HistorySession: horizonSession,
HistoryArchiveURL: config.HistoryArchiveURLs[0],
HistoryArchiveURLs: config.HistoryArchiveURLs,
EnableCaptiveCore: config.EnableCaptiveCoreIngestion,
CheckpointFrequency: config.CheckpointFrequency,
RoundingSlippageFilter: config.RoundingSlippageFilter,
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/ingest/db_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (s *DBTestSuite) SetupTest() {
sIface, err := NewSystem(Config{
CoreSession: s.tt.CoreSession(),
HistorySession: s.tt.HorizonSession(),
HistoryArchiveURL: "http://ignore.test",
HistoryArchiveURLs: []string{"http://ignore.test"},
DisableStateVerification: false,
CheckpointFrequency: 64,
})
Expand Down
10 changes: 5 additions & 5 deletions services/horizon/internal/ingest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ type Config struct {
RemoteCaptiveCoreURL string
NetworkPassphrase string

HistorySession db.SessionInterface
HistoryArchiveURL string
HistorySession db.SessionInterface
HistoryArchiveURLs []string

DisableStateVerification bool
EnableReapLookupTables bool
Expand Down Expand Up @@ -213,8 +213,8 @@ type system struct {
func NewSystem(config Config) (System, error) {
ctx, cancel := context.WithCancel(context.Background())

archive, err := historyarchive.Connect(
config.HistoryArchiveURL,
archive, err := historyarchive.NewArchivePool(
config.HistoryArchiveURLs,
historyarchive.ConnectOptions{
Context: ctx,
NetworkPassphrase: config.NetworkPassphrase,
Expand Down Expand Up @@ -244,7 +244,7 @@ func NewSystem(config Config) (System, error) {
UseDB: config.CaptiveCoreConfigUseDB,
Toml: config.CaptiveCoreToml,
NetworkPassphrase: config.NetworkPassphrase,
HistoryArchiveURLs: []string{config.HistoryArchiveURL},
HistoryArchiveURLs: config.HistoryArchiveURLs,
CheckpointFrequency: config.CheckpointFrequency,
LedgerHashStore: ledgerbackend.NewHorizonDBLedgerHashStore(config.HistorySession),
Log: logger,
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/ingest/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestNewSystem(t *testing.T) {
CoreSession: &db.Session{DB: &sqlx.DB{}},
HistorySession: &db.Session{DB: &sqlx.DB{}},
DisableStateVerification: true,
HistoryArchiveURL: "https://history.stellar.org/prd/core-live/core_live_001",
HistoryArchiveURLs: []string{"https://history.stellar.org/prd/core-live/core_live_001"},
CheckpointFrequency: 64,
}

Expand Down
7 changes: 2 additions & 5 deletions services/horizon/internal/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,8 @@ func initIngester(app *App) {
HistorySession: mustNewDBSession(
db.IngestSubservice, app.config.DatabaseURL, ingest.MaxDBConnections, ingest.MaxDBConnections, app.prometheusRegistry,
),
NetworkPassphrase: app.config.NetworkPassphrase,
// TODO:
// Use the first archive for now. We don't have a mechanism to
// use multiple archives at the same time currently.
HistoryArchiveURL: app.config.HistoryArchiveURLs[0],
NetworkPassphrase: app.config.NetworkPassphrase,
HistoryArchiveURLs: app.config.HistoryArchiveURLs,
CheckpointFrequency: app.config.CheckpointFrequency,
StellarCoreURL: app.config.StellarCoreURL,
StellarCoreCursor: app.config.CursorName,
Expand Down

0 comments on commit e9ff932

Please sign in to comment.