Skip to content

Commit

Permalink
fix: logs
Browse files Browse the repository at this point in the history
  • Loading branch information
istae committed Sep 21, 2023
1 parent 906d9ac commit 703d768
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/storer/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ func Compact(ctx context.Context, basePath string, opts *Options, validate bool)

logger := opts.Logger

logger.Info("starting compaction")

store, err := initStore(basePath, opts)
if err != nil {
return fmt.Errorf("failed creating levelDB index store: %w", err)
Expand All @@ -55,6 +53,8 @@ func Compact(ctx context.Context, basePath string, opts *Options, validate bool)
validationWork(ctx, logger, store, sharkyRecover)
}

logger.Info("starting compaction")

n := time.Now()

iteratateItemsC := make(chan chunkstore.IterateResult)
Expand Down Expand Up @@ -130,14 +130,18 @@ func Compact(ctx context.Context, basePath string, opts *Options, validate bool)
}
}

if err := sharkyRecover.Save(); err != nil {
return fmt.Errorf("sharky save: %w", err)
}

logger.Info("compaction finished", "duration", time.Since(n))

if validate {
logger.Info("performing chunk validation after compaction")
validationWork(ctx, logger, store, sharkyRecover)
}

return sharkyRecover.Save()
return nil
}

func validationWork(ctx context.Context, logger log.Logger, store storage.Store, sharky *sharky.Recovery) {
Expand Down

0 comments on commit 703d768

Please sign in to comment.