Skip to content
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

LinkCompaction: Add Link Compaction related interfaces #232

Open
wants to merge 5 commits into
base: link-compaction
Choose a base branch
from

Conversation

royguo
Copy link
Member

@royguo royguo commented Apr 7, 2022

No description provided.

@royguo royguo force-pushed the link-compaction-sketch branch from 907db3e to 0bb114e Compare April 7, 2022 15:11
@royguo royguo changed the title [WIP] Add Link Compaction related interfaces LinkCompaction: Add Link Compaction related interfaces Apr 7, 2022
@royguo royguo force-pushed the link-compaction-sketch branch from 0bb114e to 6ce5863 Compare April 7, 2022 15:16
@royguo royguo force-pushed the link-compaction-sketch branch from 6ce5863 to c9dd2ff Compare April 11, 2022 10:30
@royguo royguo force-pushed the link-compaction-sketch branch 3 times, most recently from de060ed to 33ea11e Compare April 19, 2022 02:48
@yapple
Copy link
Collaborator

yapple commented Apr 19, 2022

should we add some simple unit tests?

@royguo
Copy link
Member Author

royguo commented Apr 19, 2022

should we add some simple unit tests?

This is not an official MR, I will re-submit a standard MR with enough UT sooner after we finished all critical logic.

@royguo royguo force-pushed the link-compaction-sketch branch from 33ea11e to d9e6677 Compare April 20, 2022 02:36
table/two_level_iterator.cc Outdated Show resolved Hide resolved
table/two_level_iterator.cc Outdated Show resolved Hide resolved
table/two_level_iterator.cc Outdated Show resolved Hide resolved
table/two_level_iterator.cc Outdated Show resolved Hide resolved
}

// Seek all iterators to their first item.
Status SeekToFirst() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SeekToFirst/Seek...这些建议放在一个单独的LinkBlockIterator类中

// position `idx`, fill all touched keys into the key buffer.
auto it = iterator_cache_->GetIterator(file_number);
it->SeekForPrev(max_key_);
assert(it->status().ok());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里不能assert,建议失败的状态需要返回出去

// TODO Shall we init all other iterators to the right place so we can
// reuse them in later Next()/Prev()?
auto it = iterator_cache_->GetIterator(file_numbers_[iter_idx]);
it->Seek(target);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最后这一次file seek的开销是否可以去掉?在buffered_key的过程中已经把相应的file通过SeekForPrev+Prev走到了正确的位置了

@royguo royguo force-pushed the link-compaction-sketch branch from 3ed371c to ff8e329 Compare May 10, 2022 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants