Skip to content

Commit

Permalink
log progress of loading wal segment file
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Feb 8, 2024
1 parent f4df54c commit 38d3730
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cmd/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,7 @@ func (fnb *FlowNodeBuilder) initFvmOptions() {

// handleModules initializes the given module.
func (fnb *FlowNodeBuilder) handleModule(v namedModuleFunc) error {
fnb.Logger.Info().Str("module", v.name).Msg("module initialization started")
err := v.fn(fnb.NodeConfig)
if err != nil {
return fmt.Errorf("module %s initialization failed: %w", v.name, err)
Expand Down Expand Up @@ -1398,6 +1399,7 @@ func (fnb *FlowNodeBuilder) handleComponent(v namedComponentFunc, dependencies <

logger := fnb.Logger.With().Str("component", v.name).Logger()

logger.Info().Msg("component initialization started")
// First, build the component using the factory method.
readyAware, err := v.fn(fnb.NodeConfig)
if err != nil {
Expand Down Expand Up @@ -1469,6 +1471,7 @@ func (fnb *FlowNodeBuilder) handleRestartableComponent(v namedComponentFunc, par

// This may be called multiple times if the component is restarted
componentFactory := func() (component.Component, error) {
log.Info().Msg("component initialization started")
c, err := v.fn(fnb.NodeConfig)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230711213910-baad011d2b13
github.com/onflow/flow-nft/lib/go/contracts v1.1.0
github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d
github.com/onflow/wal v0.0.0-20240208022732-d756cd497d3b
github.com/slok/go-http-metrics v0.10.0
github.com/sony/gobreaker v0.5.0
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 h1:aPEJyR4rPBvD
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593/go.mod h1:6hk1eMY/u5t+Cf18q5lFMUA1Rc+Sm5I6Ra1QuPyxXCo=
github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ=
github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg=
github.com/cockroachdb/sentry-go v0.6.1-cockroachdb.2/go.mod h1:8BT+cPK6xvFOcRlk0R8eg+OTkcqI6baNH4xAkpiYVvQ=
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo=
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
Expand Down Expand Up @@ -857,6 +858,7 @@ github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
Expand Down Expand Up @@ -1242,6 +1244,7 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/montanaflynn/stats v0.6.6 h1:Duep6KMIDpY4Yo11iFsvyqJDyfzLF9+sndUKT+v64GQ=
github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
Expand Down Expand Up @@ -1372,6 +1375,8 @@ github.com/onflow/sdks v0.5.0 h1:2HCRibwqDaQ1c9oUApnkZtEAhWiNY2GTpRD5+ftdkN8=
github.com/onflow/sdks v0.5.0/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU=
github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d h1:gAEqYPn3DS83rHIKEpsajnppVD1+zwuYPFyeDVFaQvg=
github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d/go.mod h1:iMC8gkLqu4nkbkAla5HkSBb+FGyQOZiWz3DYm2wSXCk=
github.com/onflow/wal v0.0.0-20240208022732-d756cd497d3b h1:6O/BEmA99PDT5QVjoJgrYlGsWnpxGJTAMmsC+V9gyds=
github.com/onflow/wal v0.0.0-20240208022732-d756cd497d3b/go.mod h1:iMC8gkLqu4nkbkAla5HkSBb+FGyQOZiWz3DYm2wSXCk=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down
2 changes: 1 addition & 1 deletion ledger/complete/compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ func replaySegments(
updateFn func(update *ledger.TrieUpdate) error,
deleteFn func(rootHash ledger.RootHash) error,
) error {
sr, err := prometheusWAL.NewSegmentsRangeReader(prometheusWAL.SegmentRange{
sr, err := prometheusWAL.NewSegmentsRangeReader(unittest.Logger(), prometheusWAL.SegmentRange{
Dir: dir,
First: 0,
Last: to,
Expand Down
2 changes: 1 addition & 1 deletion ledger/complete/wal/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func (w *DiskWAL) replay(
Int("loaded_checkpoint", loadedCheckpoint).
Msgf("replaying segments from %d to %d", startSegment, to)

sr, err := prometheusWAL.NewSegmentsRangeReader(prometheusWAL.SegmentRange{
sr, err := prometheusWAL.NewSegmentsRangeReader(w.log, prometheusWAL.SegmentRange{
Dir: w.wal.Dir(),
First: startSegment,
Last: to,
Expand Down
2 changes: 2 additions & 0 deletions module/executiondatasync/tracker/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,12 @@ func (s *storage) init(startHeight uint64) error {
)
}

s.logger.Info().Msgf("prune from height %v up to height %d", fulfilledHeight, prunedHeight)
// replay pruning in case it was interrupted during previous shutdown
if err := s.PruneUpToHeight(prunedHeight); err != nil {
return fmt.Errorf("failed to replay pruning: %w", err)
}
s.logger.Info().Msgf("finished pruning")
} else if errors.Is(fulfilledHeightErr, badger.ErrKeyNotFound) && errors.Is(prunedHeightErr, badger.ErrKeyNotFound) {
// db is empty, we need to bootstrap it
if err := s.bootstrap(startHeight); err != nil {
Expand Down

0 comments on commit 38d3730

Please sign in to comment.