From c72576e72f560d076515b1391ad5211d3837a6cd Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 23 Jan 2023 11:35:58 +0300 Subject: [PATCH] [#2208] engine: Log time-consuming shard operations 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 --- pkg/local_object_storage/engine/evacuate.go | 4 ++++ pkg/local_object_storage/shard/mode.go | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/pkg/local_object_storage/engine/evacuate.go b/pkg/local_object_storage/engine/evacuate.go index 49df6fdfb..abe439270 100644 --- a/pkg/local_object_storage/engine/evacuate.go +++ b/pkg/local_object_storage/engine/evacuate.go @@ -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. @@ -185,5 +187,7 @@ mainLoop: } } + e.log.Info("finished shards evacuation", + zap.Strings("shard_ids", sidList)) return res, nil } diff --git a/pkg/local_object_storage/shard/mode.go b/pkg/local_object_storage/shard/mode.go index 4f4513631..0ca2609fe 100644 --- a/pkg/local_object_storage/shard/mode.go +++ b/pkg/local_object_storage/shard/mode.go @@ -3,6 +3,7 @@ package shard import ( "github.com/TrueCloudLab/frostfs-node/pkg/local_object_storage/shard/mode" "github.com/TrueCloudLab/frostfs-node/pkg/local_object_storage/util/logicerr" + "go.uber.org/zap" ) // ErrReadOnlyMode is returned when it is impossible to apply operation @@ -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, } @@ -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 }