Skip to content

Commit

Permalink
Merge pull request #181 from yibantianxia/pq-kp-dev-q8
Browse files Browse the repository at this point in the history
禁止多区间切分
  • Loading branch information
liuwei-ck authored Oct 18, 2021
2 parents eb082ff + 45b35ea commit 3b8557c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions sql/handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6376,6 +6376,7 @@ int handler::multi_range_read_init(RANGE_SEQ_IF *seq_funcs,
DBUG_TRACE;
mrr_iter = seq_funcs->init(seq_init_param, n_ranges, mode);
mrr_funcs = *seq_funcs;
ranges_in_seq = n_ranges;
mrr_is_output_sorted = mode & HA_MRR_SORTED;
mrr_have_range = false;
return 0;
Expand Down
10 changes: 5 additions & 5 deletions storage/innobase/handler/handler0alter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ int ha_innobase::pq_leader_range_select_scan_init(uint keyno, void *&pq_ctx, uin
config.m_range_errno = range_errno;
config.m_pcur = pcur;
config.m_pq_reverse_scan = pq_reverse_scan;

config.m_is_single_range = ranges_in_seq == 1;
auto success =
pq_reader->add_scan(trx, config, nullptr,false);
pq_reader->snapshot = trx->read_view;
Expand Down Expand Up @@ -1416,7 +1416,7 @@ int ha_innobase::pq_leader_ref_init(uint keyno, void *&pq_ctx, uint &n_threads)
config.m_range_errno = range_errno;
config.m_pcur = pcur;
config.m_pq_reverse_scan = pq_reverse_scan;

config.m_is_single_range = true;
auto success =
pq_reader->add_scan(trx, config, nullptr, false);
pq_reader->snapshot = trx->read_view;
Expand Down Expand Up @@ -1509,7 +1509,7 @@ int ha_innobase::pq_leader_scan_init(uint keyno, void *&pq_ctx, uint &n_threads)
config.m_range_errno = ret;
config.m_pcur = pcur;
config.m_pq_reverse_scan = pq_reverse_scan;

config.m_is_single_range = true;
auto success =
pq_reader->add_scan(trx, config, nullptr, false);
pq_reader->snapshot = trx->read_view;
Expand Down Expand Up @@ -1666,7 +1666,7 @@ int ha_innobase::parallel_scan_init(void *&scan_ctx, size_t &num_threads) {
Parallel_reader::Scan_range full_scan{};

Parallel_reader::Config config(full_scan, m_prebuilt->table->first_index());

config.m_is_single_range = true;
dberr_t err =
adapter->add_scan(trx, config, [=](const Parallel_reader::Ctx *ctx) {
return (adapter->process_rows(ctx));
Expand Down Expand Up @@ -10270,7 +10270,7 @@ int ha_innopart::parallel_scan_init(void *&scan_ctx, size_t &num_threads) {

Parallel_reader::Config config(FULL_SCAN, m_prebuilt->table->first_index(),
0, dd_partitions[i]->number());

config.m_is_single_range = true;
dberr_t err =
adapter->add_scan(trx, config, [=](const Parallel_reader::Ctx *ctx) {
return (adapter->process_rows(ctx));
Expand Down
5 changes: 4 additions & 1 deletion storage/innobase/include/row0pread.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ class Parallel_reader {
m_read_ahead(config.m_read_ahead),
m_range_errno(config.m_range_errno),
m_pcur(config.m_pcur),
m_pq_reverse_scan(config.m_pq_reverse_scan) {}
m_pq_reverse_scan(config.m_pq_reverse_scan),
m_is_single_range(config.m_is_single_range) {}

~Config() {
}
Expand Down Expand Up @@ -216,6 +217,8 @@ class Parallel_reader {
btr_pcur_t *m_pcur{nullptr};

bool m_pq_reverse_scan{false};

bool m_is_single_range{false};
};

/** Constructor.
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/row/row0pread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ dberr_t Parallel_reader::Scan_ctx::create_ranges(const Scan_range &scan_range,

page_cur_move_to_next(&page_cursor);
}
if (ranges.size() == 1 && depth == split_level) {
if (ranges.size() == 1 && depth == split_level && m_config.m_is_single_range) {
if (at_leaf) {
ranges.clear();
while (!page_cur_is_after_last(&start_page_cursor)) {
Expand Down

0 comments on commit 3b8557c

Please sign in to comment.