Constructing prefetch arrays in ObIndexTreeMultiPassPrefetcher on demand to optimize performance of checking row lock.
This commit is contained in:
@ -125,8 +125,8 @@ void TestSSTableRowScanner::test_one_case(
|
|||||||
ASSERT_EQ(OB_SUCCESS, row.init(allocator_, TEST_COLUMN_CNT));
|
ASSERT_EQ(OB_SUCCESS, row.init(allocator_, TEST_COLUMN_CNT));
|
||||||
const ObDatumRow *prow = nullptr;
|
const ObDatumRow *prow = nullptr;
|
||||||
const ObDatumRow *kv_prow = nullptr;
|
const ObDatumRow *kv_prow = nullptr;
|
||||||
ObSSTableRowScanner scanner;
|
ObSSTableRowScanner<> scanner;
|
||||||
ObSSTableRowScanner kv_scanner;
|
ObSSTableRowScanner<> kv_scanner;
|
||||||
|
|
||||||
if (HIT_PART == hit_mode) {
|
if (HIT_PART == hit_mode) {
|
||||||
const int64_t part_start = start + (end - start) / 3;
|
const int64_t part_start = start + (end - start) / 3;
|
||||||
|
@ -654,7 +654,8 @@ int ObIndexTreeMultiPrefetcher::drill_down(
|
|||||||
|
|
||||||
////////////////////////////////// MultiPassPrefetcher /////////////////////////////////////////////
|
////////////////////////////////// MultiPassPrefetcher /////////////////////////////////////////////
|
||||||
|
|
||||||
void ObIndexTreeMultiPassPrefetcher::reset()
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
void ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::reset()
|
||||||
{
|
{
|
||||||
for (int64_t i = 0; i < DEFAULT_SCAN_MICRO_DATA_HANDLE_CNT; i++) {
|
for (int64_t i = 0; i < DEFAULT_SCAN_MICRO_DATA_HANDLE_CNT; i++) {
|
||||||
micro_data_handles_[i].reset();
|
micro_data_handles_[i].reset();
|
||||||
@ -686,7 +687,8 @@ void ObIndexTreeMultiPassPrefetcher::reset()
|
|||||||
tree_handles_.reset();
|
tree_handles_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObIndexTreeMultiPassPrefetcher::reuse()
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
void ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::reuse()
|
||||||
{
|
{
|
||||||
ObIndexTreePrefetcher::reuse();
|
ObIndexTreePrefetcher::reuse();
|
||||||
clean_blockscan_check_info();
|
clean_blockscan_check_info();
|
||||||
@ -706,7 +708,8 @@ void ObIndexTreeMultiPassPrefetcher::reuse()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::init(
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::init(
|
||||||
const int iter_type,
|
const int iter_type,
|
||||||
ObSSTable &sstable,
|
ObSSTable &sstable,
|
||||||
const ObTableIterParam &iter_param,
|
const ObTableIterParam &iter_param,
|
||||||
@ -748,7 +751,8 @@ int ObIndexTreeMultiPassPrefetcher::init(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::switch_context(
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::switch_context(
|
||||||
const int iter_type,
|
const int iter_type,
|
||||||
const ObTableReadInfo &index_read_info,
|
const ObTableReadInfo &index_read_info,
|
||||||
ObSSTable &sstable,
|
ObSSTable &sstable,
|
||||||
@ -789,7 +793,8 @@ int ObIndexTreeMultiPassPrefetcher::switch_context(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::init_basic_info(
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::init_basic_info(
|
||||||
const int iter_type,
|
const int iter_type,
|
||||||
ObSSTable &sstable,
|
ObSSTable &sstable,
|
||||||
ObTableAccessContext &access_ctx,
|
ObTableAccessContext &access_ctx,
|
||||||
@ -865,14 +870,16 @@ int ObIndexTreeMultiPassPrefetcher::init_basic_info(
|
|||||||
* so that index block could be load when read the rows of data_block.
|
* so that index block could be load when read the rows of data_block.
|
||||||
* If the last row read is non-data-block, stop the prefetching. Others, micro data blocks prefetched.
|
* If the last row read is non-data-block, stop the prefetching. Others, micro data blocks prefetched.
|
||||||
*/
|
*/
|
||||||
int ObIndexTreeMultiPassPrefetcher::prefetch()
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::prefetch()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
|
const int32_t prefetch_limit = MAX(2, max_micro_handle_cnt_ / 2);
|
||||||
if (IS_NOT_INIT) {
|
if (IS_NOT_INIT) {
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("ObIndexTreeMultiPassPrefetcher not init", K(ret));
|
LOG_WARN("ObIndexTreeMultiPassPrefetcher not init", K(ret));
|
||||||
} else if (is_prefetch_end_) {
|
} else if (is_prefetch_end_) {
|
||||||
} else if (micro_data_prefetch_idx_ - cur_micro_data_fetch_idx_ >= max_micro_handle_cnt_ / 2) {
|
} else if (micro_data_prefetch_idx_ - cur_micro_data_fetch_idx_ >= prefetch_limit) {
|
||||||
// continue current prefetch
|
// continue current prefetch
|
||||||
} else if (OB_FAIL(prefetch_index_tree())) {
|
} else if (OB_FAIL(prefetch_index_tree())) {
|
||||||
if (OB_LIKELY(OB_ITER_END == ret)) {
|
if (OB_LIKELY(OB_ITER_END == ret)) {
|
||||||
@ -893,7 +900,8 @@ int ObIndexTreeMultiPassPrefetcher::prefetch()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prefetch index block tree from up to down, cur_level_ is the level of index tree last read
|
// prefetch index block tree from up to down, cur_level_ is the level of index tree last read
|
||||||
int ObIndexTreeMultiPassPrefetcher::prefetch_index_tree()
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::prefetch_index_tree()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_UNLIKELY(index_tree_height_ <= cur_level_)) {
|
if (OB_UNLIKELY(index_tree_height_ <= cur_level_)) {
|
||||||
@ -920,7 +928,9 @@ int ObIndexTreeMultiPassPrefetcher::prefetch_index_tree()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::try_add_query_range(ObIndexTreeLevelHandle &tree_handle)
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::try_add_query_range(
|
||||||
|
ObIndexTreeLevelHandle &tree_handle)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (cur_range_prefetch_idx_ - cur_range_fetch_idx_ == max_range_prefetching_cnt_ ||
|
if (cur_range_prefetch_idx_ - cur_range_fetch_idx_ == max_range_prefetching_cnt_ ||
|
||||||
@ -979,7 +989,8 @@ int ObIndexTreeMultiPassPrefetcher::try_add_query_range(ObIndexTreeLevelHandle &
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int32_t OB_SSTABLE_MICRO_AVG_COUNT = 100;
|
static int32_t OB_SSTABLE_MICRO_AVG_COUNT = 100;
|
||||||
int ObIndexTreeMultiPassPrefetcher::prefetch_micro_data()
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::prefetch_micro_data()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_UNLIKELY(index_tree_height_ <= cur_level_ ||
|
if (OB_UNLIKELY(index_tree_height_ <= cur_level_ ||
|
||||||
@ -1065,7 +1076,8 @@ int ObIndexTreeMultiPassPrefetcher::prefetch_micro_data()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// drill down to get next valid index micro block
|
// drill down to get next valid index micro block
|
||||||
int ObIndexTreeMultiPassPrefetcher::drill_down()
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::drill_down()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (index_tree_height_ <= cur_level_) {
|
if (index_tree_height_ <= cur_level_) {
|
||||||
@ -1109,7 +1121,8 @@ int ObIndexTreeMultiPassPrefetcher::drill_down()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::prepare_read_handle(
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::prepare_read_handle(
|
||||||
ObIndexTreeMultiPassPrefetcher::ObIndexTreeLevelHandle &tree_handle,
|
ObIndexTreeMultiPassPrefetcher::ObIndexTreeLevelHandle &tree_handle,
|
||||||
ObSSTableReadHandle &read_handle)
|
ObSSTableReadHandle &read_handle)
|
||||||
{
|
{
|
||||||
@ -1225,7 +1238,8 @@ OB_INLINE static int binary_check_micro_infos(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::check_data_infos_border(
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::check_data_infos_border(
|
||||||
const int64_t start_pos,
|
const int64_t start_pos,
|
||||||
const int64_t end_pos,
|
const int64_t end_pos,
|
||||||
const ObDatumRowkey &border_rowkey,
|
const ObDatumRowkey &border_rowkey,
|
||||||
@ -1309,7 +1323,10 @@ int ObIndexTreeMultiPassPrefetcher::check_data_infos_border(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::refresh_blockscan_checker(const int64_t start_micro_idx, const ObDatumRowkey &border_rowkey)
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::refresh_blockscan_checker(
|
||||||
|
const int64_t start_micro_idx,
|
||||||
|
const ObDatumRowkey &border_rowkey)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
// 1. check blockscan in the rest micro data prefetched
|
// 1. check blockscan in the rest micro data prefetched
|
||||||
@ -1347,7 +1364,8 @@ int ObIndexTreeMultiPassPrefetcher::refresh_blockscan_checker(const int64_t star
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::check_blockscan(bool &can_blockscan)
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::check_blockscan(bool &can_blockscan)
|
||||||
{
|
{
|
||||||
static int64 MICRO_DATA_CHECK_DEPTH = DEFAULT_SCAN_MICRO_DATA_HANDLE_CNT / 2;
|
static int64 MICRO_DATA_CHECK_DEPTH = DEFAULT_SCAN_MICRO_DATA_HANDLE_CNT / 2;
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
@ -1374,7 +1392,8 @@ int ObIndexTreeMultiPassPrefetcher::check_blockscan(bool &can_blockscan)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::check_row_lock(
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::check_row_lock(
|
||||||
const blocksstable::ObMicroIndexInfo &index_info,
|
const blocksstable::ObMicroIndexInfo &index_info,
|
||||||
bool &is_row_lock_checked)
|
bool &is_row_lock_checked)
|
||||||
{
|
{
|
||||||
@ -1398,7 +1417,8 @@ int ObIndexTreeMultiPassPrefetcher::check_row_lock(
|
|||||||
|
|
||||||
//////////////////////////////////////// ObIndexTreeLevelHandle //////////////////////////////////////////////
|
//////////////////////////////////////// ObIndexTreeLevelHandle //////////////////////////////////////////////
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::ObIndexTreeLevelHandle::prefetch(
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::ObIndexTreeLevelHandle::prefetch(
|
||||||
const ObTableReadInfo &read_info,
|
const ObTableReadInfo &read_info,
|
||||||
const ObDatumRowkey &border_rowkey,
|
const ObDatumRowkey &border_rowkey,
|
||||||
const int64_t level,
|
const int64_t level,
|
||||||
@ -1468,7 +1488,8 @@ int ObIndexTreeMultiPassPrefetcher::ObIndexTreeLevelHandle::prefetch(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObIndexTreeMultiPassPrefetcher::ObIndexTreeLevelHandle::forward(
|
template <int32_t DATA_PREFETCH_DEPTH, int32_t INDEX_PREFETCH_DEPTH>
|
||||||
|
int ObIndexTreeMultiPassPrefetcher<DATA_PREFETCH_DEPTH, INDEX_PREFETCH_DEPTH>::ObIndexTreeLevelHandle::forward(
|
||||||
const ObTableReadInfo &read_info,
|
const ObTableReadInfo &read_info,
|
||||||
const ObDatumRowkey &border_rowkey,
|
const ObDatumRowkey &border_rowkey,
|
||||||
const bool has_lob_out)
|
const bool has_lob_out)
|
||||||
@ -1522,5 +1543,9 @@ int ObIndexTreeMultiPassPrefetcher::ObIndexTreeLevelHandle::forward(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Explicit instantiations.
|
||||||
|
template class ObIndexTreeMultiPassPrefetcher<32, 3>;
|
||||||
|
template class ObIndexTreeMultiPassPrefetcher<2, 1>;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -304,6 +304,7 @@ private:
|
|||||||
const bool force_prefetch);
|
const bool force_prefetch);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <int32_t DATA_PREFETCH_DEPTH = 32, int32_t INDEX_PREFETCH_DEPTH = 3>
|
||||||
class ObIndexTreeMultiPassPrefetcher : public ObIndexTreePrefetcher
|
class ObIndexTreeMultiPassPrefetcher : public ObIndexTreePrefetcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -409,8 +410,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const int32_t DEFAULT_SCAN_RANGE_PREFETCH_CNT = 4;
|
static const int32_t DEFAULT_SCAN_RANGE_PREFETCH_CNT = 4;
|
||||||
static const int32_t DEFAULT_SCAN_MICRO_DATA_HANDLE_CNT = 32;
|
static const int32_t DEFAULT_SCAN_MICRO_DATA_HANDLE_CNT = DATA_PREFETCH_DEPTH;
|
||||||
static const int32_t INDEX_TREE_PREFETCH_DEPTH = 3;
|
static const int32_t INDEX_TREE_PREFETCH_DEPTH = INDEX_PREFETCH_DEPTH;
|
||||||
struct ObIndexBlockReadHandle {
|
struct ObIndexBlockReadHandle {
|
||||||
ObIndexBlockReadHandle() :
|
ObIndexBlockReadHandle() :
|
||||||
end_prefetched_row_idx_(-1),
|
end_prefetched_row_idx_(-1),
|
||||||
|
@ -21,7 +21,7 @@ namespace oceanbase {
|
|||||||
using namespace blocksstable;
|
using namespace blocksstable;
|
||||||
namespace storage {
|
namespace storage {
|
||||||
|
|
||||||
class ObSSTableMultiVersionRowGetter : public ObSSTableRowScanner
|
class ObSSTableMultiVersionRowGetter : public ObSSTableRowScanner<>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObSSTableMultiVersionRowGetter()
|
ObSSTableMultiVersionRowGetter()
|
||||||
|
@ -22,7 +22,7 @@ using namespace transaction;
|
|||||||
|
|
||||||
namespace storage {
|
namespace storage {
|
||||||
|
|
||||||
class ObSSTableRowLockChecker : public ObSSTableRowScanner {
|
class ObSSTableRowLockChecker : public ObSSTableRowScanner<ObIndexTreeMultiPassPrefetcher<2, 1>> {
|
||||||
public:
|
public:
|
||||||
ObSSTableRowLockChecker();
|
ObSSTableRowLockChecker();
|
||||||
virtual ~ObSSTableRowLockChecker();
|
virtual ~ObSSTableRowLockChecker();
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
namespace oceanbase {
|
namespace oceanbase {
|
||||||
namespace storage {
|
namespace storage {
|
||||||
class ObSSTableRowMultiScanner : public ObSSTableRowScanner
|
class ObSSTableRowMultiScanner : public ObSSTableRowScanner<>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObSSTableRowMultiScanner()
|
ObSSTableRowMultiScanner()
|
||||||
|
@ -22,12 +22,14 @@ namespace oceanbase
|
|||||||
using namespace common;
|
using namespace common;
|
||||||
namespace storage
|
namespace storage
|
||||||
{
|
{
|
||||||
ObSSTableRowScanner::~ObSSTableRowScanner()
|
template<typename PrefetchType>
|
||||||
|
ObSSTableRowScanner<PrefetchType>::~ObSSTableRowScanner()
|
||||||
{
|
{
|
||||||
FREE_PTR_FROM_CONTEXT(access_ctx_, micro_scanner_, ObIMicroBlockRowScanner);
|
FREE_PTR_FROM_CONTEXT(access_ctx_, micro_scanner_, ObIMicroBlockRowScanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObSSTableRowScanner::reset()
|
template<typename PrefetchType>
|
||||||
|
void ObSSTableRowScanner<PrefetchType>::reset()
|
||||||
{
|
{
|
||||||
ObStoreRowIterator::reset();
|
ObStoreRowIterator::reset();
|
||||||
FREE_PTR_FROM_CONTEXT(access_ctx_, micro_scanner_, ObIMicroBlockRowScanner);
|
FREE_PTR_FROM_CONTEXT(access_ctx_, micro_scanner_, ObIMicroBlockRowScanner);
|
||||||
@ -39,7 +41,8 @@ void ObSSTableRowScanner::reset()
|
|||||||
prefetcher_.reset();
|
prefetcher_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObSSTableRowScanner::reuse()
|
template<typename PrefetchType>
|
||||||
|
void ObSSTableRowScanner<PrefetchType>::reuse()
|
||||||
{
|
{
|
||||||
ObStoreRowIterator::reuse();
|
ObStoreRowIterator::reuse();
|
||||||
is_opened_ = false;
|
is_opened_ = false;
|
||||||
@ -53,7 +56,8 @@ void ObSSTableRowScanner::reuse()
|
|||||||
prefetcher_.reuse();
|
prefetcher_.reuse();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObSSTableRowScanner::inner_open(
|
template<typename PrefetchType>
|
||||||
|
int ObSSTableRowScanner<PrefetchType>::inner_open(
|
||||||
const ObTableIterParam &iter_param,
|
const ObTableIterParam &iter_param,
|
||||||
ObTableAccessContext &access_ctx,
|
ObTableAccessContext &access_ctx,
|
||||||
ObITable *table,
|
ObITable *table,
|
||||||
@ -102,7 +106,8 @@ int ObSSTableRowScanner::inner_open(
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObSSTableRowScanner::init_micro_scanner()
|
template<typename PrefetchType>
|
||||||
|
int ObSSTableRowScanner<PrefetchType>::init_micro_scanner()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (nullptr != micro_scanner_) {
|
if (nullptr != micro_scanner_) {
|
||||||
@ -129,7 +134,8 @@ int ObSSTableRowScanner::init_micro_scanner()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObSSTableRowScanner::open_cur_data_block(ObSSTableReadHandle &read_handle)
|
template<typename PrefetchType>
|
||||||
|
int ObSSTableRowScanner<PrefetchType>::open_cur_data_block(ObSSTableReadHandle &read_handle)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (prefetcher_.cur_micro_data_fetch_idx_ < read_handle.micro_begin_idx_ ||
|
if (prefetcher_.cur_micro_data_fetch_idx_ < read_handle.micro_begin_idx_ ||
|
||||||
@ -199,7 +205,8 @@ int ObSSTableRowScanner::open_cur_data_block(ObSSTableReadHandle &read_handle)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObSSTableRowScanner::inner_get_next_row(const ObDatumRow *&store_row)
|
template<typename PrefetchType>
|
||||||
|
int ObSSTableRowScanner<PrefetchType>::inner_get_next_row(const ObDatumRow *&store_row)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_UNLIKELY(!is_opened_)) {
|
if (OB_UNLIKELY(!is_opened_)) {
|
||||||
@ -250,7 +257,8 @@ int ObSSTableRowScanner::inner_get_next_row(const ObDatumRow *&store_row)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObSSTableRowScanner::fetch_row(ObSSTableReadHandle &read_handle, const ObDatumRow *&store_row)
|
template<typename PrefetchType>
|
||||||
|
int ObSSTableRowScanner<PrefetchType>::fetch_row(ObSSTableReadHandle &read_handle, const ObDatumRow *&store_row)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_UNLIKELY(read_handle.is_get_)) {
|
if (OB_UNLIKELY(read_handle.is_get_)) {
|
||||||
@ -308,7 +316,8 @@ int ObSSTableRowScanner::fetch_row(ObSSTableReadHandle &read_handle, const ObDat
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObSSTableRowScanner::refresh_blockscan_checker(const blocksstable::ObDatumRowkey &rowkey)
|
template<typename PrefetchType>
|
||||||
|
int ObSSTableRowScanner<PrefetchType>::refresh_blockscan_checker(const blocksstable::ObDatumRowkey &rowkey)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (nullptr != block_row_store_ &&
|
if (nullptr != block_row_store_ &&
|
||||||
@ -318,13 +327,15 @@ int ObSSTableRowScanner::refresh_blockscan_checker(const blocksstable::ObDatumRo
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObSSTableRowScanner::can_vectorize() const
|
template<typename PrefetchType>
|
||||||
|
bool ObSSTableRowScanner<PrefetchType>::can_vectorize() const
|
||||||
{
|
{
|
||||||
return (iter_param_->vectorized_enabled_ || iter_param_->enable_pd_aggregate()) &&
|
return (iter_param_->vectorized_enabled_ || iter_param_->enable_pd_aggregate()) &&
|
||||||
nullptr != block_row_store_ && block_row_store_->filter_applied();
|
nullptr != block_row_store_ && block_row_store_->filter_applied();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObSSTableRowScanner::get_next_rows()
|
template<typename PrefetchType>
|
||||||
|
int ObSSTableRowScanner<PrefetchType>::get_next_rows()
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (OB_UNLIKELY(!is_opened_ || nullptr == block_row_store_)) {
|
if (OB_UNLIKELY(!is_opened_ || nullptr == block_row_store_)) {
|
||||||
@ -363,7 +374,8 @@ int ObSSTableRowScanner::get_next_rows()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ObSSTableRowScanner::fetch_rows(ObSSTableReadHandle &read_handle)
|
template<typename PrefetchType>
|
||||||
|
int ObSSTableRowScanner<PrefetchType>::fetch_rows(ObSSTableReadHandle &read_handle)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
if (-1 == read_handle.micro_begin_idx_) {
|
if (-1 == read_handle.micro_begin_idx_) {
|
||||||
@ -421,5 +433,9 @@ int ObSSTableRowScanner::fetch_rows(ObSSTableReadHandle &read_handle)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Explicit instantiations.
|
||||||
|
template class ObSSTableRowScanner<ObIndexTreeMultiPassPrefetcher<32, 3>>;
|
||||||
|
template class ObSSTableRowScanner<ObIndexTreeMultiPassPrefetcher<2, 1>>;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
namespace oceanbase {
|
namespace oceanbase {
|
||||||
using namespace blocksstable;
|
using namespace blocksstable;
|
||||||
namespace storage {
|
namespace storage {
|
||||||
|
template<typename PrefetchType = ObIndexTreeMultiPassPrefetcher<>>
|
||||||
class ObSSTableRowScanner : public ObStoreRowIterator
|
class ObSSTableRowScanner : public ObStoreRowIterator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -60,7 +61,7 @@ protected:
|
|||||||
ObSSTable *sstable_;
|
ObSSTable *sstable_;
|
||||||
const ObTableIterParam *iter_param_;
|
const ObTableIterParam *iter_param_;
|
||||||
ObTableAccessContext *access_ctx_;
|
ObTableAccessContext *access_ctx_;
|
||||||
ObIndexTreeMultiPassPrefetcher prefetcher_;
|
PrefetchType prefetcher_;
|
||||||
ObMacroBlockReader macro_block_reader_;
|
ObMacroBlockReader macro_block_reader_;
|
||||||
ObIMicroBlockRowScanner *micro_scanner_;
|
ObIMicroBlockRowScanner *micro_scanner_;
|
||||||
private:
|
private:
|
||||||
|
@ -138,7 +138,7 @@ int ObSSTable::scan(
|
|||||||
row_scanner);
|
row_scanner);
|
||||||
} else {
|
} else {
|
||||||
ALLOCATE_TABLE_STORE_ROW_IETRATOR(context,
|
ALLOCATE_TABLE_STORE_ROW_IETRATOR(context,
|
||||||
ObSSTableRowScanner,
|
ObSSTableRowScanner<>,
|
||||||
row_scanner);
|
row_scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user