Skip to content

Commit

Permalink
run epoch maintenance for quick maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyndon-Li committed Aug 28, 2024
1 parent b363544 commit 88a3b5f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions repo/maintenance/maintenance_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,21 +252,26 @@ func Run(ctx context.Context, runParams RunParameters, safety SafetyParameters)
}

func runQuickMaintenance(ctx context.Context, runParams RunParameters, safety SafetyParameters) error {
s, err := GetSchedule(ctx, runParams.rep)
if err != nil {
return errors.Wrap(err, "unable to get schedule")
}

_, ok, emerr := runParams.rep.ContentManager().EpochManager(ctx)
if ok {
log(ctx).Debugf("quick maintenance not required for epoch manager")
log(ctx).Debugf("Epoch manager is available, run epoch maintenance only for quick maintenance")

if err := runTaskEpochMaintenanceQuick(ctx, runParams, s); err != nil {
return errors.Wrap(err, "error running quick epoch maintenance tasks")
}

return nil
}

if emerr != nil {
return errors.Wrap(emerr, "epoch manager")
}

s, err := GetSchedule(ctx, runParams.rep)
if err != nil {
return errors.Wrap(err, "unable to get schedule")
}

if shouldQuickRewriteContents(s, safety) {
// find 'q' packs that are less than 80% full and rewrite contents in them into
// new consolidated packs, orphaning old packs in the process.
Expand Down Expand Up @@ -299,10 +304,6 @@ func runQuickMaintenance(ctx context.Context, runParams RunParameters, safety Sa
notDeletingOrphanedBlobs(ctx, s, safety)
}

if err := runTaskEpochMaintenanceQuick(ctx, runParams, s); err != nil {
return errors.Wrap(err, "error running quick epoch maintenance tasks")
}

// consolidate many smaller indexes into fewer larger ones.
if err := runTaskIndexCompactionQuick(ctx, runParams, s, safety); err != nil {
return errors.Wrap(err, "error performing index compaction")
Expand Down

0 comments on commit 88a3b5f

Please sign in to comment.