提交 001aa8fd 编写于 作者: K kongfy 提交者: LINGuanRen

fix a concurrent problem in btree related to purge logic

上级 62a80601
......@@ -171,7 +171,9 @@ int BtreeNode::get_next_active_child(int pos, int64_t version, int64_t* cnt, Mul
++pos;
} else {
while (++pos < size(index)) {
if (!get_tag(pos, index)) {
if (!get_tag(pos, index)
// double check if condition stil hold, prevent the use of future tag
|| version < max_del_version_) {
break;
}
if (OB_NOT_NULL(cnt)) {
......@@ -188,7 +190,9 @@ int BtreeNode::get_prev_active_child(int pos, int64_t version, int64_t* cnt, Mul
--pos;
} else {
while (--pos >= 0) {
if (!get_tag(pos, index)) {
if (!get_tag(pos, index)
// double check if condition stil hold, prevent the use of future tag
|| version < max_del_version_) {
break;
}
if (OB_NOT_NULL(cnt)) {
......@@ -716,8 +720,8 @@ int ScanHandle::scan_forward(bool skip_inactive, int64_t* skip_cnt)
int ret = OB_SUCCESS;
BtreeNode* node = nullptr;
int pos = 0;
int64_t version = skip_inactive ? version_ : 0;
MultibitSet* index = &this->index_;
int64_t version = skip_inactive ? version_ : -1;
MultibitSet *index = &this->index_;
while (OB_SUCCESS == ret) {
if (OB_FAIL(path_.pop(node, pos))) {
ret = OB_ITER_END;
......@@ -744,8 +748,8 @@ int ScanHandle::scan_backward(bool skip_inactive, int64_t* skip_cnt)
int ret = OB_SUCCESS;
BtreeNode* node = nullptr;
int pos = 0;
int64_t version = skip_inactive ? version_ : 0;
MultibitSet* index = &this->index_;
int64_t version = skip_inactive ? version_ : -1;
MultibitSet *index = &this->index_;
while (OB_SUCCESS == ret) {
if (OB_FAIL(path_.pop(node, pos))) {
ret = OB_ITER_END;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册