-
Notifications
You must be signed in to change notification settings - Fork 529
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
Compactor: add function to remove no compact marker #6917
Conversation
pkg/storage/tsdb/block/block_test.go
Outdated
for _, tcase := range []struct { | ||
name string |
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.
unless you need strict ordering, I would find map[string]struct{..}
nicer, with key being the test name.
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.
I was using the vector to keep the similar test styles with all other tests in this file. I don't have strong opinion on this, will change it to map.
pkg/storage/tsdb/block/block_test.go
Outdated
100, 0, 1000, labels.FromStrings("ext1", "val1")) | ||
require.NoError(t, err) | ||
|
||
tcase.preUpload(t, id, bkt) |
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.
nit: We upload marker file before uploading block.
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.
what do you mean? this preUpload is just to load a no-compact marker file in the object store in order to test the delete.
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.
Next line calls Upload(ctx, log.NewNopLogger(), bkt, path.Join(tmpDir, id.String()), nil)
which uploads block. But preUpload
can already upload no-compact mark. It's not a big deal, but this sequence of actions doesn't happen in practice.
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.
I got what you said, it makes sense, I moved the upload also into the test setup function. it is in good order now, upload blocks, then upload the marker.
Co-authored-by: Peter Štibraný <pstibrany@gmail.com>
Co-authored-by: Peter Štibraný <pstibrany@gmail.com>
Co-authored-by: Peter Štibraný <pstibrany@gmail.com>
a1c4a75
to
a72dbb3
Compare
pkg/storage/tsdb/block/block.go
Outdated
if err := bkt.Delete(ctx, m); err != nil { | ||
return errors.Wrapf(err, "deletion of no-compaction marker for block %s has failed", id.String()) | ||
} | ||
level.Info(logger).Log("msg", "block has been unmarked for no compaction", "block", id) |
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.
Can you explain better what has happened? The double negative sounds complicated. Something like "no compaction mark has been removed; block may be compacted again the future"
setupTest func(t testing.TB, id ulid.ULID, bkt objstore.Bucket) | ||
expectedError func(id ulid.ULID) error | ||
}{ | ||
"unmark existing block should succeed": { |
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.
Should were add a test case for unmarking a block which doesn't exist?
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.
The second test "unmark non-existing block should fail", is this what you want?
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.
crap, this was written in autopilot. I meant write a test which tries to unmark a block which doesn't have a marker
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.
👌 will add it in the next PR
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.
Thanks, lgtm (after addressing Dimitar's comments).
ff67a7f
to
724f0a5
Compare
What this PR does
Add function to remove no-compact marker, this function could then be called from admin UI in order to mark/remove no-compact marker on the block. a follow up of this PR #6848
Which issue(s) this PR fixes or relates to
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]
.about-versioning.md
updated with experimental features.