From ff0abf62a5409b50bc29c15ff7a55a2fa55e5808 Mon Sep 17 00:00:00 2001 From: Manuel <5877862+manuelsc@users.noreply.github.com> Date: Wed, 12 Jun 2024 14:13:42 +0200 Subject: [PATCH] force bootstrap --- backend/pkg/exporter/modules/dashboard_data.go | 6 ++++++ backend/pkg/exporter/modules/dashboard_data_w_rolling.go | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/pkg/exporter/modules/dashboard_data.go b/backend/pkg/exporter/modules/dashboard_data.go index 0506799f7..90aacd2c2 100644 --- a/backend/pkg/exporter/modules/dashboard_data.go +++ b/backend/pkg/exporter/modules/dashboard_data.go @@ -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 @@ -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") diff --git a/backend/pkg/exporter/modules/dashboard_data_w_rolling.go b/backend/pkg/exporter/modules/dashboard_data_w_rolling.go index 914fa44b7..cfd63f268 100644 --- a/backend/pkg/exporter/modules/dashboard_data_w_rolling.go +++ b/backend/pkg/exporter/modules/dashboard_data_w_rolling.go @@ -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 @@ -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