satellite/audit: do not delete expired segments

A year ago we made the audit service deleting expired segments.
Meanwhile, we introduced an expired deletetion sub-service in the
metainfo service which sole purpose is deleting expired segments.

Therefore, now we are removing this responsibility from the audit
service. It will continue to avoid reporting failures on expired
segments, but it would not delete them anymore.

We do this to cleanup responsibilities in advance of the metainfo
refactoring.

Change-Id: Id7aab2126f9289dbb5b0bdf7331ba7a3328730e4
This commit is contained in:
Kaloyan Raev 2020-10-19 16:53:23 +03:00
parent 89bdb20a62
commit 1aeb14e65e
3 changed files with 1 additions and 28 deletions

View File

@ -942,11 +942,6 @@ func TestReverifyExpired1(t *testing.T) {
report, err := audits.Verifier.Reverify(ctx, path)
require.NoError(t, err)
// Reverify should delete the expired segment
pointer, err = satellite.Metainfo.Service.Get(ctx, metabase.SegmentKey(path))
require.Error(t, err)
require.Nil(t, pointer)
assert.Len(t, report.Successes, 0)
assert.Len(t, report.Fails, 0)
assert.Len(t, report.Offlines, 0)
@ -1064,11 +1059,6 @@ func TestReverifyExpired2(t *testing.T) {
require.Len(t, report.PendingAudits, 0)
require.Len(t, report.Fails, 0)
// Reverify should delete the expired segment
pointer, err := satellite.Metainfo.Service.Get(ctx, metabase.SegmentKey(path1))
require.Error(t, err)
require.Nil(t, pointer)
// Reverify should remove the node from containment mode
_, err = containment.Get(ctx, pending.NodeID)
require.Error(t, err)

View File

@ -101,10 +101,6 @@ func (verifier *Verifier) Verify(ctx context.Context, path storj.Path, skip map[
return Report{}, err
}
if pointer.ExpirationDate != (time.Time{}) && pointer.ExpirationDate.Before(time.Now()) {
errDelete := verifier.metainfo.Delete(ctx, metabase.SegmentKey(path), pointerBytes)
if errDelete != nil {
return Report{}, Error.Wrap(errDelete)
}
verifier.log.Debug("segment expired before Verify")
return Report{}, nil
}
@ -388,7 +384,7 @@ func (verifier *Verifier) Reverify(ctx context.Context, path storj.Path) (report
err error
}
pointerBytes, pointer, err := verifier.metainfo.GetWithBytes(ctx, metabase.SegmentKey(path))
pointer, err := verifier.metainfo.Get(ctx, metabase.SegmentKey(path))
if err != nil {
if storj.ErrObjectNotFound.Has(err) {
verifier.log.Debug("segment deleted before Reverify")
@ -397,10 +393,6 @@ func (verifier *Verifier) Reverify(ctx context.Context, path storj.Path) (report
return Report{}, err
}
if pointer.ExpirationDate != (time.Time{}) && pointer.ExpirationDate.Before(time.Now()) {
errDelete := verifier.metainfo.Delete(ctx, metabase.SegmentKey(path), pointerBytes)
if errDelete != nil {
return Report{}, Error.Wrap(errDelete)
}
verifier.log.Debug("Segment expired before Reverify")
return Report{}, nil
}
@ -472,10 +464,6 @@ func (verifier *Verifier) Reverify(ctx context.Context, path storj.Path) (report
return
}
if pendingPointer.ExpirationDate != (time.Time{}) && pendingPointer.ExpirationDate.Before(time.Now().UTC()) {
errDelete := verifier.metainfo.Delete(ctx, metabase.SegmentKey(pending.Path), pendingPointerBytes)
if errDelete != nil {
verifier.log.Debug("Reverify: error deleting expired segment", zap.Stringer("Node ID", pending.NodeID), zap.Error(errDelete))
}
verifier.log.Debug("Reverify: segment already expired", zap.Stringer("Node ID", pending.NodeID))
ch <- result{nodeID: pending.NodeID, status: skipped}
return

View File

@ -420,11 +420,6 @@ func TestVerifierExpired(t *testing.T) {
report, err := audits.Verifier.Verify(ctx, path, nil)
require.NoError(t, err)
// Verify should delete the expired segment
pointer, err = satellite.Metainfo.Service.Get(ctx, metabase.SegmentKey(path))
require.Error(t, err)
require.Nil(t, pointer)
assert.Len(t, report.Successes, 0)
assert.Len(t, report.Fails, 0)
assert.Len(t, report.Offlines, 0)