Skip to content

Commit

Permalink
Merge pull request #172 from yibantianxia/pq-kp-dev-q8
Browse files Browse the repository at this point in the history
增加块二次切分和按行切分的功能
  • Loading branch information
liuwei-ck authored Oct 13, 2021
2 parents 65d712a + 8b1eaae commit 8210c62
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions storage/innobase/row/row0pread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ dberr_t Parallel_reader::Scan_ctx::create_ranges(const Scan_range &scan_range,
Savepoint savepoint({mtr->get_savepoint(), nullptr});

auto block = block_get_s_latched(page_id, mtr, __LINE__);

page_no_t child_page_no = FIL_NULL;
/* read_level requested should be less than the tree height. */
ut_ad(m_config.m_read_level <
btr_page_get_level(buf_block_get_frame(block), mtr) + 1);
Expand Down Expand Up @@ -1298,7 +1298,7 @@ dberr_t Parallel_reader::Scan_ctx::create_ranges(const Scan_range &scan_range,
/* Skip the infimum record. */
page_cur_move_to_next(&page_cursor);
}

page_cur_t start_page_cursor = page_cursor;
mem_heap_t *heap{};

const auto at_leaf = page_is_leaf(buf_block_get_frame(block));
Expand Down Expand Up @@ -1328,7 +1328,7 @@ dberr_t Parallel_reader::Scan_ctx::create_ranges(const Scan_range &scan_range,
the root level. */
if (at_level > m_config.m_read_level) {
auto page_no = btr_node_ptr_get_child_page_no(rec, offsets);

child_page_no = page_no;
if (depth < split_level) {
/* Need to create a range starting at a lower level in the tree. */
create_ranges(scan_range, page_no, depth + 1, split_level, ranges, mtr);
Expand Down Expand Up @@ -1384,7 +1384,23 @@ 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 (at_leaf) {
ranges.clear();
while (!page_cur_is_after_last(&start_page_cursor)) {
auto rec = page_cur_get_rec(&start_page_cursor);
offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
if (scan_range.m_end != nullptr && scan_range.m_end->compare(rec, index, offsets) < 0) {
break;
}
create_range(ranges, start_page_cursor, mtr);
page_cur_move_to_next(&start_page_cursor);
}
} else if (child_page_no != FIL_NULL) {
ranges.clear();
create_ranges(scan_range, child_page_no, depth + 1, split_level + 1, ranges, mtr);
}
}
savepoints.push_back(savepoint);

for (auto &savepoint : savepoints) {
Expand Down

0 comments on commit 8210c62

Please sign in to comment.