Skip to content

Commit

Permalink
engine: Log time-consuming shard operations
Browse files Browse the repository at this point in the history
Currently the only way to tell whether `evacuate/set-mode` is finished
is to set a very big timeout and _hope_ that the operation will finish.
In this commit we add INFO logs for such operations which should
simplify the life of an administrator.

Signed-off-by: Evgenii Stratonikov <[email protected]>
  • Loading branch information
fyrchik committed Jan 23, 2023
1 parent 604bbe3 commit dad7895
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/local_object_storage/engine/evacuate.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func (e *StorageEngine) Evacuate(prm EvacuateShardPrm) (EvacuateShardRes, error)
return EvacuateShardRes{}, errMustHaveTwoShards
}

e.log.Info("started shards evacuation", zap.Strings("shard_ids", sidList))

// We must have all shards, to have correct information about their
// indexes in a sorted slice and set appropriate marks in the metabase.
// Evacuated shard is skipped during put.
Expand Down Expand Up @@ -185,5 +187,7 @@ mainLoop:
}
}

e.log.Info("finished shards evacuation",
zap.Strings("shard_ids", sidList))
return res, nil
}
7 changes: 7 additions & 0 deletions pkg/local_object_storage/shard/mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package shard
import (
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/shard/mode"
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util/logicerr"
"go.uber.org/zap"
)

// ErrReadOnlyMode is returned when it is impossible to apply operation
Expand All @@ -24,6 +25,10 @@ func (s *Shard) SetMode(m mode.Mode) error {
}

func (s *Shard) setMode(m mode.Mode) error {
s.log.Info("setting shard mode",
zap.Stringer("old_mode", s.info.Mode),
zap.Stringer("new_mode", m))

components := []interface{ SetMode(mode.Mode) error }{
s.metaBase, s.blobStor,
}
Expand Down Expand Up @@ -61,6 +66,8 @@ func (s *Shard) setMode(m mode.Mode) error {
s.metricsWriter.SetReadonly(s.info.Mode != mode.ReadWrite)
}

s.log.Info("shard mode set successfully",
zap.Stringer("mode", s.info.Mode))
return nil
}

Expand Down

0 comments on commit dad7895

Please sign in to comment.