From a181c9e434636aff4d75f12fcf7b5448314ea646 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Wed, 10 May 2023 17:16:15 +0300 Subject: [PATCH] [#332] gc: Add additional logging Signed-off-by: Dmitrii Stepanov --- internal/logs/logs.go | 6 ++++++ pkg/local_object_storage/shard/gc.go | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/internal/logs/logs.go b/internal/logs/logs.go index 9b6e03499b..69a3b229aa 100644 --- a/internal/logs/logs.go +++ b/internal/logs/logs.go @@ -478,4 +478,10 @@ const ( FrostFSNodeContainerRemovalEventReceivedButTreesWerentRemoved = "container removal event received, but trees weren't removed" // Error in ../node/cmd/frostfs-node/tree.go FrostFSNodeCantListenGRPCEndpointControl = "can't listen gRPC endpoint (control)" // Error in ../node/cmd/frostfs-node/control.go CommonApplicationStarted = "application started" // Info in ../node/cmd/frostfs-ir/main.go + ShardGCCollectingExpiredObjectsStarted = "collecting expired objects started" + ShardGCCollectingExpiredObjectsCompleted = "collecting expired objects completed" + ShardGCCollectingExpiredLocksStarted = "collecting expired locks started" + ShardGCCollectingExpiredLocksCompleted = "collecting expired locks completed" + ShardGCRemoveGarbageStarted = "garbage remove started" + ShardGCRemoveGarbageCompleted = "garbage remove completed" ) diff --git a/pkg/local_object_storage/shard/gc.go b/pkg/local_object_storage/shard/gc.go index 86995cd060..82876e675d 100644 --- a/pkg/local_object_storage/shard/gc.go +++ b/pkg/local_object_storage/shard/gc.go @@ -204,6 +204,9 @@ func (s *Shard) removeGarbage() { return } + s.log.Debug(logs.ShardGCRemoveGarbageStarted) + defer s.log.Debug(logs.ShardGCRemoveGarbageCompleted) + buf := make([]oid.Address, 0, s.rmBatchSize) var iterPrm meta.GarbageIterationPrm @@ -259,6 +262,9 @@ func (s *Shard) getExpiredObjectsParameters() (workersCount, batchSize int) { } func (s *Shard) collectExpiredObjects(ctx context.Context, e Event) { + s.log.Debug(logs.ShardGCCollectingExpiredObjectsStarted, zap.Uint64("epoch", e.(newEpoch).epoch)) + defer s.log.Debug(logs.ShardGCCollectingExpiredObjectsCompleted, zap.Uint64("epoch", e.(newEpoch).epoch)) + workersCount, batchSize := s.getExpiredObjectsParameters() errGroup, egCtx := errgroup.WithContext(ctx) @@ -344,6 +350,7 @@ func (s *Shard) collectExpiredTombstones(ctx context.Context, e Event) { log := s.log.With(zap.Uint64("epoch", epoch)) log.Debug(logs.ShardStartedExpiredTombstonesHandling) + defer log.Debug(logs.ShardFinishedExpiredTombstonesHandling) const tssDeleteBatch = 50 tss := make([]meta.TombstonedObject, 0, tssDeleteBatch) @@ -400,11 +407,12 @@ func (s *Shard) collectExpiredTombstones(ctx context.Context, e Event) { tss = tss[:0] tssExp = tssExp[:0] } - - log.Debug(logs.ShardFinishedExpiredTombstonesHandling) } func (s *Shard) collectExpiredLocks(ctx context.Context, e Event) { + s.log.Debug(logs.ShardGCCollectingExpiredLocksStarted, zap.Uint64("epoch", e.(newEpoch).epoch)) + defer s.log.Debug(logs.ShardGCCollectingExpiredLocksCompleted, zap.Uint64("epoch", e.(newEpoch).epoch)) + workersCount, batchSize := s.getExpiredObjectsParameters() errGroup, egCtx := errgroup.WithContext(ctx)