-
Notifications
You must be signed in to change notification settings - Fork 872
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
feat(tiering): Defragmentation #3021
Conversation
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Signed-off-by: Vladislav Oleshko <vlad@dragonflydb.io>
Finally with all the issues resolved, we can have proper defrag 🤓 |
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, minor comments
src/server/tiering/op_manager.cc
Outdated
ReadOp* info = &pending_reads_.at(offset); | ||
|
||
// Reorder base read (offset 0) to be last, so reads for defragmentation are handled last |
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 please explain this?
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.
If we already have a page read for defragmentation pending and some other read for the sub-segment is enqueued, we first must handle the sub-segment read, only then the full page read
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 suggest copying this explanation into the comment
src/server/tiering/op_manager.cc
Outdated
bool deleting_full = false; | ||
std::string key_value; | ||
for (auto& ko : info->key_ops) { | ||
for (size_t i = 0; i < info->key_ops.size(); i++) { // more items can be read while iterating |
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 does it mean more items can be read while iterating
?
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.
When we call ReportDelete, it might issue a read for the whole page to trigger defragmentation, which will be added to this list
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.
please add a comment:
// Note that functions in the loop may append items to info->key_ops
during the traversal.
return {full_segment, false /* fragmented */, true /* empty */}; | ||
} | ||
|
||
if (bin.bytes < kPageSize / 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.
is it the condition to trigger fragmentation?
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.
Yes 🤓 Not very sophisticated
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, but please add comments that I asked.
Added comments |
No description provided.