add defense and log for table store iter

This commit is contained in:
saltonz
2023-06-29 05:17:57 +00:00
committed by ob-robot
parent 03de88f65b
commit 865f0a38ea
2 changed files with 6 additions and 2 deletions

View File

@ -292,7 +292,10 @@ int ObTableStoreIterator::get_ith_table(const int64_t pos, ObITable *&table)
} else {
const int64_t hdl_idx = table_ptr_array_.at(pos).hdl_idx_;
ObSSTable *sstable = nullptr;
if (OB_FAIL(sstable_handle_array_.at(hdl_idx).get_sstable(sstable))) {
if (OB_UNLIKELY(hdl_idx < 0 || hdl_idx >= sstable_handle_array_.count())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpected handle idx for loaded sstable", K(ret), K(hdl_idx), KPC(tmp_table), KPC(this));
} else if (OB_FAIL(sstable_handle_array_.at(hdl_idx).get_sstable(sstable))) {
LOG_WARN("fail to get sstable value", K(ret), K(hdl_idx), K(sstable_handle_array_));
} else {
table = sstable;

View File

@ -78,7 +78,8 @@ public:
{
return (NULL == memstore_retired_) ? false : ATOMIC_LOAD(memstore_retired_);
}
TO_STRING_KV(K_(table_ptr_array), K_(sstable_handle_array), K_(pos), K_(step), K_(memstore_retired));
TO_STRING_KV(K_(table_ptr_array), K_(sstable_handle_array), K_(pos), K_(step), K_(memstore_retired),
K_(need_load_sstable), K_(table_store_handle), KPC_(transfer_src_table_store_handle));
private:
int inner_move_idx_to_next();
int add_tables(const ObMemtableArray &memtable_array, const int64_t start_pos = 0);