fix small sstable reuse

This commit is contained in:
obdev 2024-02-07 12:18:33 +00:00 committed by ob-robot
parent 54568efebf
commit 01079be5de
3 changed files with 10 additions and 10 deletions

View File

@ -273,8 +273,8 @@ int ObKVCacheMap::get(
iter = bucket_ptr; iter = bucket_ptr;
bool is_equal = false; bool is_equal = false;
while (NULL != iter && OB_SUCC(ret)) { while (NULL != iter && OB_SUCC(ret)) {
if (store_->add_handle_ref(iter->mb_handle_, iter->seq_num_)) { if (hash_code == iter->hash_code_) {
if (hash_code == iter->hash_code_) { if (store_->add_handle_ref(iter->mb_handle_, iter->seq_num_)) {
if (OB_FAIL(key.equal(*iter->key_, is_equal))) { if (OB_FAIL(key.equal(*iter->key_, is_equal))) {
COMMON_LOG(WARN, "Failed to check kvcache key equal", K(ret)); COMMON_LOG(WARN, "Failed to check kvcache key equal", K(ret));
} else if (is_equal) { } else if (is_equal) {
@ -290,8 +290,8 @@ int ObKVCacheMap::get(
break; break;
} }
store_->de_handle_ref(iter->mb_handle_);
} }
store_->de_handle_ref(iter->mb_handle_);
} }
iter = iter->next_; iter = iter->next_;
} }
@ -310,8 +310,8 @@ int ObKVCacheMap::get(
iter = bucket_ptr; iter = bucket_ptr;
bool is_equal = false; bool is_equal = false;
while (NULL != iter && OB_LIKELY(OB_SUCCESS == tmp_ret)) { while (NULL != iter && OB_LIKELY(OB_SUCCESS == tmp_ret)) {
if (store_->add_handle_ref(iter->mb_handle_, iter->seq_num_)) { if (hash_code == iter->hash_code_) {
if (hash_code == iter->hash_code_) { if (store_->add_handle_ref(iter->mb_handle_, iter->seq_num_)) {
if (OB_TMP_FAIL(key.equal(*iter->key_, is_equal))) { if (OB_TMP_FAIL(key.equal(*iter->key_, is_equal))) {
COMMON_LOG(WARN, "Failed to check kvcache key equal", K(tmp_ret)); COMMON_LOG(WARN, "Failed to check kvcache key equal", K(tmp_ret));
} else if (is_equal) { } else if (is_equal) {
@ -322,8 +322,8 @@ int ObKVCacheMap::get(
store_->de_handle_ref(old_handle); store_->de_handle_ref(old_handle);
break; break;
} }
store_->de_handle_ref(iter->mb_handle_);
} }
store_->de_handle_ref(iter->mb_handle_);
} }
prev = iter; prev = iter;
iter = iter->next_; iter = iter->next_;

View File

@ -56,6 +56,7 @@ public:
access_ctx_(nullptr), access_ctx_(nullptr),
sstable_(nullptr), sstable_(nullptr),
allocator_(common::ObModIds::OB_SSTABLE_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID()), allocator_(common::ObModIds::OB_SSTABLE_READER, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID()),
io_buf_(),
prefetch_macro_cursor_(0), prefetch_macro_cursor_(0),
cur_macro_cursor_(0), cur_macro_cursor_(0),
is_macro_prefetch_end_(false), is_macro_prefetch_end_(false),
@ -66,8 +67,7 @@ public:
is_inited_(false), is_inited_(false),
last_micro_block_recycled_(false), last_micro_block_recycled_(false),
last_mvcc_row_already_output_(false), last_mvcc_row_already_output_(false),
iter_macro_cnt_(0), iter_macro_cnt_(0)
io_buf_()
{} {}
virtual ~ObSSTableRowWholeScanner(); virtual ~ObSSTableRowWholeScanner();
@ -125,6 +125,7 @@ private:
blocksstable::ObSSTable *sstable_; blocksstable::ObSSTable *sstable_;
blocksstable::ObDatumRange query_range_; blocksstable::ObDatumRange query_range_;
common::ObArenaAllocator allocator_; common::ObArenaAllocator allocator_;
compaction::ObCompactionBuffer io_buf_[PREFETCH_DEPTH];
int64_t prefetch_macro_cursor_; int64_t prefetch_macro_cursor_;
int64_t cur_macro_cursor_; int64_t cur_macro_cursor_;
bool is_macro_prefetch_end_; bool is_macro_prefetch_end_;
@ -138,7 +139,6 @@ private:
bool last_micro_block_recycled_; bool last_micro_block_recycled_;
bool last_mvcc_row_already_output_; bool last_mvcc_row_already_output_;
int64_t iter_macro_cnt_; int64_t iter_macro_cnt_;
compaction::ObCompactionBuffer io_buf_[PREFETCH_DEPTH];
}; };
} }

View File

@ -308,7 +308,7 @@ int ObTabletMergeInfo::create_sstable(
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
// if base sstable is small sstable and was reused, we disable the small sstable optimization // if base sstable is small sstable and was reused, we disable the small sstable optimization
const ObSSTable *sstable = static_cast<const ObSSTable*>(tables_handle.get_table(0)); const ObSSTable *sstable = static_cast<const ObSSTable*>(tables_handle.get_table(0));
const bool is_reused_small_sst = is_major_merge_type(ctx.get_merge_type()) const bool is_reused_small_sst = is_major_or_meta_merge_type(ctx.get_merge_type())
&& nullptr == cg_schema //row store mode && nullptr == cg_schema //row store mode
&& sstable->is_small_sstable() && sstable->is_small_sstable()
&& 1 == sstable_merge_info_.macro_block_count_ && 1 == sstable_merge_info_.macro_block_count_