fix "Unexpected old row update or delete a non exist index row"
This commit is contained in:
@ -43,6 +43,7 @@ int ObMvccValueIterator::init(const ObIMvccCtx& ctx, const ObTransSnapInfo& snap
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
skip_compact_ = skip_compact;
|
skip_compact_ = skip_compact;
|
||||||
|
bool can_read_by_sql_no = false;
|
||||||
reset();
|
reset();
|
||||||
int64_t lock_for_read_start = ObClockGenerator::getClock();
|
int64_t lock_for_read_start = ObClockGenerator::getClock();
|
||||||
// snapshot version equal INT64_MAX is unexpected
|
// snapshot version equal INT64_MAX is unexpected
|
||||||
@ -62,7 +63,10 @@ int ObMvccValueIterator::init(const ObIMvccCtx& ctx, const ObTransSnapInfo& snap
|
|||||||
value_ = value;
|
value_ = value;
|
||||||
is_inited_ = true;
|
is_inited_ = true;
|
||||||
version_iter_ = value->get_list_head();
|
version_iter_ = value->get_list_head();
|
||||||
} else if (read_by_sql_no(ctx, snapshot_info, const_cast<ObMvccRow*>(value), query_flag)) {
|
} else if (OB_FAIL(read_by_sql_no(ctx, snapshot_info, const_cast<ObMvccRow*>(value), query_flag, can_read_by_sql_no))) {
|
||||||
|
//do nothing
|
||||||
|
} else {
|
||||||
|
if (can_read_by_sql_no) {
|
||||||
ctx_ = &ctx;
|
ctx_ = &ctx;
|
||||||
value_ = value;
|
value_ = value;
|
||||||
is_inited_ = true;
|
is_inited_ = true;
|
||||||
@ -86,6 +90,7 @@ int ObMvccValueIterator::init(const ObIMvccCtx& ctx, const ObTransSnapInfo& snap
|
|||||||
is_inited_ = true;
|
is_inited_ = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// stat lock for read time
|
// stat lock for read time
|
||||||
const_cast<ObIMvccCtx&>(ctx).add_lock_for_read_elapse(ObClockGenerator::getClock() - lock_for_read_start);
|
const_cast<ObIMvccCtx&>(ctx).add_lock_for_read_elapse(ObClockGenerator::getClock() - lock_for_read_start);
|
||||||
return ret;
|
return ret;
|
||||||
@ -273,11 +278,10 @@ void ObMvccValueIterator::move_to_next_node()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if read self transaction when fetch cursor
|
// check if read self transaction when fetch cursor
|
||||||
bool ObMvccValueIterator::read_by_sql_no(
|
int ObMvccValueIterator::read_by_sql_no(
|
||||||
const ObIMvccCtx& ctx, const ObTransSnapInfo& snapshot_info, ObMvccRow* value, const ObQueryFlag& query_flag)
|
const ObIMvccCtx& ctx, const ObTransSnapInfo& snapshot_info, ObMvccRow* value, const ObQueryFlag& query_flag, bool& can_read_by_sql_no)
|
||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
bool can_read_by_sql_no = false;
|
|
||||||
bool is_locked = false;
|
bool is_locked = false;
|
||||||
|
|
||||||
ObMvccTransNode* iter = value->get_list_head();
|
ObMvccTransNode* iter = value->get_list_head();
|
||||||
@ -343,7 +347,7 @@ bool ObMvccValueIterator::read_by_sql_no(
|
|||||||
if (is_locked) {
|
if (is_locked) {
|
||||||
value->latch_.unlock();
|
value->latch_.unlock();
|
||||||
}
|
}
|
||||||
return can_read_by_sql_no;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObMvccValueIterator::reset()
|
void ObMvccValueIterator::reset()
|
||||||
|
|||||||
@ -115,8 +115,8 @@ public:
|
|||||||
{
|
{
|
||||||
return version_iter_;
|
return version_iter_;
|
||||||
}
|
}
|
||||||
bool read_by_sql_no(const ObIMvccCtx& ctx, const transaction::ObTransSnapInfo& snapshot_info, ObMvccRow* value,
|
int read_by_sql_no(const ObIMvccCtx& ctx, const transaction::ObTransSnapInfo& snapshot_info, ObMvccRow* value,
|
||||||
const ObQueryFlag& query_flag);
|
const ObQueryFlag& query_flag, bool& can_read_by_sql_no);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int find_start_pos(const int64_t read_snapshot);
|
int find_start_pos(const int64_t read_snapshot);
|
||||||
|
|||||||
Reference in New Issue
Block a user