use last data handle for multi get

This commit is contained in:
chaser-ch 2025-01-02 06:46:06 +00:00 committed by ob-robot
parent 87a9c7311e
commit 59d93cc7a2
3 changed files with 23 additions and 5 deletions

View File

@ -400,7 +400,7 @@ int ObIndexTreePrefetcher::prefetch_block_data(
const bool need_submit_io)
{
int ret = OB_SUCCESS;
if (is_rescan() && last_handle_hit(index_block_info, is_data, micro_handle)) {
if (need_cache_last_block() && last_handle_hit(index_block_info, is_data, micro_handle)) {
++access_ctx_->table_store_stat_.block_cache_hit_cnt_;
LOG_DEBUG("last micro block handle hits", K(is_data), K(index_block_info),
K(last_micro_block_handle_), K(micro_handle));
@ -417,7 +417,7 @@ int ObIndexTreePrefetcher::prefetch_block_data(
} else {
LOG_WARN("Fail to get micro block handle from handle mgr", K(ret));
}
} else if (is_rescan() && is_data && micro_handle.in_block_state()) {
} else if (need_cache_last_block() && is_data && micro_handle.in_block_state()) {
last_micro_block_handle_ = micro_handle;
}
return ret;

View File

@ -122,9 +122,18 @@ public:
class ObIndexTreePrefetcher
{
public:
enum ObPrefetcherType : uint8_t
{
BASIC = 0,
MULTI_GET = 1,
MULTI_SCAN = 2,
INVALID_TYPE
};
public:
ObIndexTreePrefetcher() :
is_inited_(false),
prefetcher_type_(BASIC),
iter_type_(0),
cur_level_(0),
index_tree_height_(0),
@ -163,8 +172,9 @@ public:
int single_prefetch(ObSSTableReadHandle &read_handle);
int lookup_in_index_tree(ObSSTableReadHandle &read_handle, const bool force_prefetch);
OB_INLINE bool is_valid() { return is_inited_; }
OB_INLINE ObPrefetcherType get_prefetcher_type() { return prefetcher_type_; }
ObMicroBlockDataHandle &get_last_data_handle() { return last_micro_block_handle_; }
VIRTUAL_TO_STRING_KV(K_(is_inited), K_(iter_type), K_(cur_level), K_(index_tree_height),
VIRTUAL_TO_STRING_KV(K_(is_inited), K_(prefetcher_type), K_(iter_type), K_(cur_level), K_(index_tree_height),
K_(max_rescan_height), K_(max_rescan_range_cnt), K_(data_version), K_(table_scan_cnt), K_(index_scanner),
KPC_(sstable), KPC_(iter_param), K_(last_micro_block_handle));
protected:
@ -188,6 +198,8 @@ protected:
ObTableAccessContext &access_ctx);
OB_INLINE bool is_first_scan() const { return nullptr == sstable_; }
OB_INLINE bool is_rescan() const { return 1 < table_scan_cnt_; }
OB_INLINE bool is_multi_get() const { return prefetcher_type_ == MULTI_GET; }
OB_INLINE bool need_cache_last_block() const { return is_rescan() || is_multi_get(); }
private:
ObMicroBlockDataHandle &get_read_handle(const int64_t level)
{
@ -198,6 +210,7 @@ protected:
static const int64_t MAX_RESCAN_HOLD_LIMIT = 64;
static const int16_t MAX_INDEX_TREE_HEIGHT = 16;
bool is_inited_;
ObPrefetcherType prefetcher_type_;
int16_t iter_type_;
int16_t cur_level_;
int16_t index_tree_height_;
@ -322,7 +335,9 @@ public:
max_handle_prefetching_cnt_(0),
rowkeys_(nullptr),
ext_read_handles_()
{}
{
prefetcher_type_ = MULTI_GET;
}
virtual ~ObIndexTreeMultiPrefetcher() { reset(); }
virtual void reset() override;
virtual void reuse() override;
@ -403,7 +418,9 @@ public:
read_handles_(),
tree_handles_(nullptr),
multi_io_params_()
{}
{
prefetcher_type_ = MULTI_SCAN;
}
virtual ~ObIndexTreeMultiPassPrefetcher();
virtual void reset() override;
virtual void reuse() override;

View File

@ -449,6 +449,7 @@ int ObMicroBlockHandleMgr::get_micro_block_handle(
LOG_WARN("Fail to submit async io for prefetch", K(ret), K(index_block_info), K(micro_block_handle));
} else {
REALTIME_MONITOR_ADD_IO_READ_BYTES(access_ctx, size);
LOG_DEBUG("debug async io", K(ret), K(index_block_info), K(micro_block_handle));
}
} else {
// get data / index block cache from cache