[CP] Fix rescan hold macro handle too long
This commit is contained in:
@ -29,6 +29,7 @@ void ObIndexTreePrefetcher::reset()
|
||||
{
|
||||
is_inited_ = false;
|
||||
is_rescan_ = false;
|
||||
rescan_cnt_ = 0;
|
||||
data_version_ = 0;
|
||||
sstable_ = nullptr;
|
||||
data_block_cache_ = nullptr;
|
||||
@ -108,6 +109,14 @@ int ObIndexTreePrefetcher::switch_context(
|
||||
if (OB_FAIL(micro_block_handle_mgr_.init(true, false, *access_ctx.stmt_allocator_))) {
|
||||
LOG_WARN("failed to init block handle mgr", K(ret));
|
||||
}
|
||||
} else {
|
||||
rescan_cnt_++;
|
||||
if (rescan_cnt_ >= MAX_RESCAN_HOLD_LIMIT) {
|
||||
rescan_cnt_ = 0;
|
||||
if (OB_FAIL(micro_block_handle_mgr_.reset_handle_cache())) {
|
||||
STORAGE_LOG(WARN, "failed to reset handle cache", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -483,6 +492,14 @@ int ObIndexTreeMultiPrefetcher::switch_context(
|
||||
if (OB_FAIL(micro_block_handle_mgr_.init(true, false, *access_ctx.stmt_allocator_))) {
|
||||
LOG_WARN("failed to init block handle mgr", K(ret));
|
||||
}
|
||||
} else {
|
||||
rescan_cnt_++;
|
||||
if (rescan_cnt_ >= MAX_RESCAN_HOLD_LIMIT) {
|
||||
rescan_cnt_ = 0;
|
||||
if (OB_FAIL(micro_block_handle_mgr_.reset_handle_cache())) {
|
||||
STORAGE_LOG(WARN, "failed to reset handle cache", K(ret));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (index_scanner_.is_valid()) {
|
||||
|
@ -115,6 +115,7 @@ public:
|
||||
ObIndexTreePrefetcher() :
|
||||
is_inited_(false),
|
||||
is_rescan_(false),
|
||||
rescan_cnt_(0),
|
||||
data_version_(0),
|
||||
sstable_(nullptr),
|
||||
data_block_cache_(nullptr),
|
||||
@ -172,8 +173,10 @@ private:
|
||||
}
|
||||
|
||||
protected:
|
||||
static const int64_t MAX_RESCAN_HOLD_LIMIT = 64;
|
||||
bool is_inited_;
|
||||
bool is_rescan_;
|
||||
int64_t rescan_cnt_;
|
||||
int64_t data_version_;
|
||||
ObSSTable *sstable_;
|
||||
ObDataMicroBlockCache *data_block_cache_;
|
||||
|
@ -57,6 +57,15 @@ public:
|
||||
|
||||
virtual ~ObHandleCache() {}
|
||||
|
||||
void reset_handles()
|
||||
{
|
||||
for (int64_t i = 0; i < N; ++i) {
|
||||
nodes_[i].reset();
|
||||
}
|
||||
MEMSET(buckets_, -1, sizeof(buckets_));
|
||||
MEMSET(chain_, -1, sizeof(chain_));
|
||||
}
|
||||
|
||||
int get_handle(const Key &key, Handle &handle)
|
||||
{
|
||||
int ret = common::OB_SUCCESS;
|
||||
|
@ -333,5 +333,21 @@ int ObMicroBlockHandleMgr::put_micro_block_handle(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObMicroBlockHandleMgr::reset_handle_cache()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (IS_NOT_INIT) {
|
||||
ret = OB_NOT_INIT;
|
||||
STORAGE_LOG(WARN, "block handle mgr is not inited", K(ret));
|
||||
} else if (is_multi_) {
|
||||
if (is_ordered_) {
|
||||
last_handle_->reset();
|
||||
} else {
|
||||
handle_cache_->reset_handles();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ public:
|
||||
const blocksstable::MacroBlockId ¯o_id,
|
||||
const blocksstable::ObIndexBlockRowHeader &idx_header,
|
||||
ObMicroBlockDataHandle µ_block_handle);
|
||||
int reset_handle_cache();
|
||||
private:
|
||||
// allocator for index micro block prefetch failed and async io
|
||||
common::ObFIFOAllocator allocator_;
|
||||
|
Reference in New Issue
Block a user