From 53a5d18e1afdefcada834d56840bd81832aae247 Mon Sep 17 00:00:00 2001 From: Qweder93 Date: Sun, 2 Aug 2020 20:00:05 +0300 Subject: [PATCH] storagenode: fixed logging about piece being moved to trash, and added logging when piece was actually deleted Change-Id: I46f6a141b27033c2087b5c4681506d80b90f4a18 --- storagenode/pieces/cache.go | 1 + storagenode/pieces/store.go | 2 ++ storagenode/retain/retain.go | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/storagenode/pieces/cache.go b/storagenode/pieces/cache.go index ccbd1dc67..57bd23510 100644 --- a/storagenode/pieces/cache.go +++ b/storagenode/pieces/cache.go @@ -231,6 +231,7 @@ func (blobs *BlobsUsageCache) Delete(ctx context.Context, blobRef storage.BlobRe return err } blobs.Update(ctx, satelliteID, -pieceTotal, -pieceContentSize, 0) + blobs.log.Debug("deleted piece", zap.String("satelliteID", satelliteID.String()), zap.Int64("space was freed", pieceContentSize)) return nil } diff --git a/storagenode/pieces/store.go b/storagenode/pieces/store.go index 7aa362254..24c7f57ba 100644 --- a/storagenode/pieces/store.go +++ b/storagenode/pieces/store.go @@ -295,6 +295,8 @@ func (store *Store) Delete(ctx context.Context, satellite storj.NodeID, pieceID err = errs.Combine(err, store.v0PieceInfo.Delete(ctx, satellite, pieceID)) } + store.log.Debug("deleted piece", zap.String("satelliteID", satellite.String()), zap.String("pieceID", pieceID.String())) + return Error.Wrap(err) } diff --git a/storagenode/retain/retain.go b/storagenode/retain/retain.go index 5e632578d..0020df604 100644 --- a/storagenode/retain/retain.go +++ b/storagenode/retain/retain.go @@ -378,7 +378,7 @@ func (s *Service) retainPieces(ctx context.Context, req Request) (err error) { } pieceID := access.PieceID() if !filter.Contains(pieceID) { - s.log.Debug("About to delete piece id", + s.log.Debug("About to move piece to trash", zap.Stringer("Satellite ID", satelliteID), zap.Stringer("Piece ID", pieceID), zap.String("Status", s.config.Status.String())) @@ -408,7 +408,7 @@ func (s *Service) retainPieces(ctx context.Context, req Request) (err error) { return Error.Wrap(err) } mon.IntVal("garbage_collection_pieces_deleted").Observe(int64(numDeleted)) - s.log.Debug("Deleted pieces during retain", zap.Int("num deleted", numDeleted), zap.String("Retain Status", s.config.Status.String())) + s.log.Debug("Moved pieces to trash during retain", zap.Int("num deleted", numDeleted), zap.String("Retain Status", s.config.Status.String())) return nil }