-
Notifications
You must be signed in to change notification settings - Fork 411
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
[FLASH-206] Refactor Process About Region Data #36
Conversation
solotzg
commented
Apr 4, 2019
•
edited
Loading
edited
- move the process about region data, such as write|default|lock cf to a new class RegionData.
- Decode the TiKV key & value at first.
- Optimize and refactor some code.
/run-integration-tests |
Maybe we should stop making the contributor agreement? It is a private project and those features won't likely be merged back to CH later. |
auto next(RegionWriteCFDataTrait::Keys * keys = nullptr) | ||
{ | ||
if (!found) | ||
throw Exception(String() + "table: " + DB::toString(expected_table_id) + " is not found", ErrorCodes::LOGICAL_ERROR); |
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 we need 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.
yes, that's a mistake
} | ||
|
||
private: | ||
RegionPtr store; | ||
std::unique_lock<std::shared_mutex> lock; | ||
|
||
bool found; | ||
RegionWriteCFData::Data::iterator write_cf_data_it; |
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.
Maybe storing RegionWriteCFData::Map
is better?
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.
that's also a choice. if so, we need to store the expected table id because removeDataByWriteIt
needs.
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 is kind of weird that caching an iterator here, since it won't change.
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.
Here, I just use this iterator as a pointer to seek TableID
and RegionWriteCFData::Map
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 think it is better to cache TableID
and RegionWriteCFData::Map &
directly here, because an iterator is potentially means changing. And it should run faster since we can skip one pointer reference. But any way, it is your choice.
/rebuild |
2 similar comments
/rebuild |
/rebuild |
/run-integration-tests |
LGTM |