-
Notifications
You must be signed in to change notification settings - Fork 0
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
parallelization of simple query #132
Conversation
e2a85cd
to
f987122
Compare
begin.key(), begin.endpointkind(), end.key(), end.endpointkind()); | ||
auto pivot_count = scan_parallel_count - 1; | ||
auto pivots = distribution.compute_pivots(pivot_count, range); | ||
bounds.emplace_back(std::move(begin)); |
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.
boundsに対するemplace_backを行う前にstd::vector::reserveを呼んであらかじめ必要な領域を確保してください。
} | ||
} else { | ||
bounds.emplace_back(std::move(begin)); | ||
} | ||
bounds.emplace_back(std::move(end)); | ||
for (size_t i = 0; i + 1 < bounds.size(); i += 2) { | ||
scan_ranges.emplace_back(std::make_shared<impl::scan_range>( |
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.
for文の前にstd::vector::reserveしてください。
size_t scan_parallel_count = global::config_pool()->scan_default_parallel(); | ||
auto option = request_context_->transaction()->option(); | ||
bool is_rtx = option && option->type() == kvs::transaction_option::transaction_type::read_only; | ||
if (scan_parallel_count > 1 && is_rtx) { |
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_empty=trueの場合はそもそも分割が必要ないのでこのif文に入らないようにした方がいいですね。
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.
configuration::rtx_parallel_scan=trueかどうかの確認も必要ではないでしょうか。
auto pivot_count = scan_parallel_count - 1; | ||
auto pivots = distribution.compute_pivots(pivot_count, range); | ||
bounds.emplace_back(std::move(begin)); | ||
for (const auto& pivot : pivots) { |
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.
L.420のfor文でboundsを作成し、その内容を L.430で2個ずつ取り出して最終的なscan_rangesを作っています。
好みの問題に近いですが、 L.420のfor文で直接scan_rangesまで作ってしまった方がシンプルではないでしょうか。
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.
レビューしました。指摘部分対応後にマージしてOKです。
@kuron99 テスト中に問題見つけました。 pivotとして81 ffが選択されても bound(kvs::end_point_kind::exclusive, pivots.front().size(),
std::make_unique<data::aligned_buffer>(pivots.front())),
is_empty)); boundに入れると 20 00になってます。結果不正が起きているので調査します
|
@YoshiakiNishimura simple_key_distribution::compute_pivotsが戻しているstd::string_viewってローカルに確保されたstd::string (L.41)のものなので作成後に書きかわってしまうとかでしょうか?
|
@kuron99 std::vector<simple_key_distribution::pivot_type> ->std::vectorstd::stringで試してみます。(この場合コピーが発生して問題なく動作すると思います) |
f987122
to
8ef38aa
Compare
問題対応 & 指摘反映しましたのでmergeします |
https://github.com/project-tsurugi/tsurugi-issues/issues/991
scan_default_parallelの値でscanのrangeを分割する