-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replicate: Add flag to mark blocks for deletion after replication #7366
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Thomas Sidereal <53402621+Hatry1337@users.noreply.github.com>
Signed-off-by: Thomas Sidereal <53402621+Hatry1337@users.noreply.github.com>
|
||
if !deletionMarkExists { | ||
level.Debug(rs.logger).Log("msg", "marking block for deletion as already replicated", "block_uuid", blockID) | ||
if err := block.MarkForDeletion(ctx, rs.logger, rs.fromBkt, id, "marked for deletion by thanos bucket replicate", promauto.With(nil).NewCounter(prometheus.CounterOpts{})); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have promauto.With(nil).NewCounter(prometheus.CounterOpts{}))
here instead of adding something to replicationScheme.reg
?
gotOrigin := len(originBucket.Objects()) | ||
gotTarget := len(targetBucket.Objects()) | ||
|
||
if gotOrigin != expectedOrigin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use testutil.Equal()
@@ -274,6 +298,23 @@ func (rs *replicationScheme) ensureBlockIsReplicated(ctx context.Context, id uli | |||
return errors.Wrap(err, "upload meta file") | |||
} | |||
|
|||
if rs.markAfter { | |||
deletionMarkFile := path.Join(id.String(), metadata.DeletionMarkFilename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MarkForDeletion
already checks for this, no? It could get quite expensive to check twice if one is replicating, let's say, 10000 blocks.
Changes
--mark-after
tothanos tools bucket replicate
replicationScheme.fromBkt
type fromInstrumentedBucketReader
toInstrumentedBucket
--ignore-marked-for-deletion
if--mark-after
setVerification
--mark-after
flag set