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/internal: Add flag to enable / disable reaping of lookup tables #5366

Merged
merged 1 commit into from
Jul 1, 2024
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
2 changes: 2 additions & 0 deletions services/horizon/internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ type Config struct {
// If ReapFrequency is set to 2 history is reaped after ingesting every two ledgers.
// etc...
ReapFrequency uint
// ReapLookupTables enables the reaping of history lookup tables
ReapLookupTables bool
// StaleThreshold represents the number of ledgers a history database may be
// out-of-date by before horizon begins to respond with an error to history
// requests.
Expand Down
8 changes: 8 additions & 0 deletions services/horizon/internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,14 @@
return nil
},
},
{

Check failure on line 690 in services/horizon/internal/flags.go

View workflow job for this annotation

GitHub Actions / golangci

missing type in composite literal (typecheck)
Name: "reap-lookup-tables",
sreuland marked this conversation as resolved.
Show resolved Hide resolved
ConfigKey: &config.ReapLookupTables,
OptType: types.Bool,
FlagDefault: true,
Usage: "enables the reaping of history lookup tables.",
UsedInCommands: IngestionCommands,
},
&support.ConfigOption{
Name: "history-stale-threshold",
ConfigKey: &config.StaleThreshold,
Expand Down
4 changes: 2 additions & 2 deletions services/horizon/internal/ingest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type Config struct {
HistoryArchiveCaching bool

DisableStateVerification bool
EnableReapLookupTables bool
ReapLookupTables bool
EnableExtendedLogLedgerStats bool

MaxReingestRetries int
Expand Down Expand Up @@ -757,7 +757,7 @@ func (s *system) maybeVerifyState(lastIngestedLedger uint32, expectedBucketListH
}

func (s *system) maybeReapLookupTables(lastIngestedLedger uint32) {
if !s.config.EnableReapLookupTables {
if !s.config.ReapLookupTables {
return
}

Expand Down
4 changes: 2 additions & 2 deletions services/horizon/internal/ingest/resume_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,9 @@ func (s *ResumeTestTestSuite) TestReapingObjectsDisabled() {
}

func (s *ResumeTestTestSuite) TestErrorReapingObjectsIgnored() {
s.system.config.EnableReapLookupTables = true
s.system.config.ReapLookupTables = true
defer func() {
s.system.config.EnableReapLookupTables = false
s.system.config.ReapLookupTables = false
}()
s.historyQ.On("Begin", s.ctx).Return(nil).Once()
s.historyQ.On("GetLastLedgerIngest", s.ctx).Return(uint32(100), nil).Once()
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func initIngester(app *App) {
DisableStateVerification: app.config.IngestDisableStateVerification,
StateVerificationCheckpointFrequency: uint32(app.config.IngestStateVerificationCheckpointFrequency),
StateVerificationTimeout: app.config.IngestStateVerificationTimeout,
EnableReapLookupTables: app.config.HistoryRetentionCount > 0,
ReapLookupTables: app.config.ReapLookupTables && app.config.HistoryRetentionCount > 0,
EnableExtendedLogLedgerStats: app.config.IngestEnableExtendedLogLedgerStats,
RoundingSlippageFilter: app.config.RoundingSlippageFilter,
SkipTxmeta: app.config.SkipTxmeta,
Expand Down
Loading