-
Notifications
You must be signed in to change notification settings - Fork 820
Write block deletion marks in the global location too #3561
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
Conversation
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.
Nice job! I have mostly minor nits and comments, nothing blocking.
Unrelated to this PR: have you considered naming bucketindex.Block
to BlockMeta
.
return ulid.ULID{}, false | ||
} | ||
|
||
return block.IsBlockDir(parts[len(parts)-2]) |
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.
return block.IsBlockDir(parts[len(parts)-2]) | |
return block.IsBlockDir(path.Dir(name)) |
and avoid split.
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.
It's not the same thing. The object prefix could be /user-1/<block-id>/deletion-mark.json
. We need to pick the 2nd last segment, not the whole path.Dir()
.
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 need to pick the 2nd last segment, not the whole path.Dir().
block.IsBlockDir
already covers that.
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 missed that, sorry. Fixed!
func (w *Writer) generateBlockDeletionMarkIndexEntry(ctx context.Context, id ulid.ULID) (*BlockDeletionMark, error) { | ||
markFile := path.Join(id.String(), metadata.DeletionMarkFilename) | ||
|
||
// Get the block's deletion mark file. |
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 replace marker reading code in this method with:
m := metadata.DeletionMark{}
err := metadata.ReadMarker(ctx, w.logger, w.bkt, id.String(), &m)
(UserBucketClient
already implements required InstrumentedBucket
)
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.
Very good point. Done, thanks!
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Marco Pracucci <marco@pracucci.com>
db4528c
to
c78f8d9
Compare
Yes. I would prefer to not call it "BlockMeta" to avoid misunderstanding. We don't index the BlockMeta, but some information about the Block and I would prefer not couple it with the |
Signed-off-by: Marco Pracucci <marco@pracucci.com>
Thanks a lot @pstibrany for your valuable feedback! I addressed most comments and replied to few other ones. Could you take another look, please? |
Signed-off-by: Marco Pracucci <marco@pracucci.com>
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.
LGTM, nice work.
Signed-off-by: Marco Pracucci <marco@pracucci.com>
In bucket_index.json aleady have block ids which is marked delete, |
@AllenzhLi Without a per-tenant global |
Bucket index JSON is created based on found blocks and deletion marks. Querier and store-gateway only use index (and ignore blocks marked for deletion). During compaction, compactor will only create deletion marks, but not update the index. Index update is a separate loop, that looks for deletion marks. |
Understood, thanks. |
What this PR does:
This is another preliminary step required to implement the bucket index, as designed in #3554. In this PR:
Which issue(s) this PR fixes:
N/A
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]