Skip to content

Commit

Permalink
force bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsc committed Jun 12, 2024
1 parent 9b3c2f3 commit ff0abf6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions backend/pkg/exporter/modules/dashboard_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ const debugAggregateRollingWindowsDuringBackfillUTCBoundEpoch = true // prod: tr

const debugDeadlockBandaid = true // prod: fix root cause then set to false

// This flag can be used to force a bootstrap of the rolling tables. This is done once, after the bootstrap completes it switches back to off and normal rolling aggregation.
// Can be used to fix a corrupted rolling table.
var debugForceBootstrapRollingTables = false // prod: false

// ----------- END OF DEBUG FLAGS ------------

// How many epochs will be fetched in parallel from the node (relevant for backfill and rolling tail fetching). We are fetching the head epoch and
Expand Down Expand Up @@ -862,6 +866,8 @@ func (d *dashboardData) aggregatePerEpoch(updateRollingWindows bool, preventClea
return errors.Wrap(err, "failed to aggregate rolling windows")
}

debugForceBootstrapRollingTables = false // reset flag after first run

err = refreshMaterializedSlashedByCounts()
if err != nil {
return errors.Wrap(err, "failed to refresh slashed by counts")
Expand Down
4 changes: 2 additions & 2 deletions backend/pkg/exporter/modules/dashboard_data_w_rolling.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (d *RollingAggregator) getTailBoundsXDays(days int, boundsStart uint64, int

// Note that currentEpochHead is the current exported epoch in the db
func (d *RollingAggregator) Aggregate(days int, tableName string, currentEpochHead uint64) error {
return d.aggregateInternal(days, tableName, currentEpochHead, false)
return d.aggregateInternal(days, tableName, currentEpochHead, debugForceBootstrapRollingTables)
}

// Note that currentEpochHead is the current exported epoch in the db
Expand Down Expand Up @@ -216,7 +216,7 @@ func (d *RollingAggregator) getMissingRollingTailEpochs(days int, intendedHeadEp
}
}

needsBootstrap := int64(intendedHeadEpoch-bounds.EpochEnd) >= int64(d.getBootstrapOnEpochsBehind())
needsBootstrap := debugForceBootstrapRollingTables || int64(intendedHeadEpoch-bounds.EpochEnd) >= int64(d.getBootstrapOnEpochsBehind())

d.log.Infof("%dd needs bootstrap: %v", days, needsBootstrap)
// if rolling table is empty / not bootstrapped yet or needs a bootstrap assume bounds of what the would be after a bootstrap
Expand Down

0 comments on commit ff0abf6

Please sign in to comment.