Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lihongda1002
oceanbase
提交
feb6c0e7
O
oceanbase
项目概览
lihongda1002
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
feb6c0e7
编写于
9月 24, 2021
作者:
Z
zx0
提交者:
wangzelin.wzl
9月 24, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix "Unexpected old row update or delete a non exist index row"
上级
0a794fca
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
25 deletion
+29
-25
src/storage/memtable/mvcc/ob_mvcc_iterator.cpp
src/storage/memtable/mvcc/ob_mvcc_iterator.cpp
+27
-23
src/storage/memtable/mvcc/ob_mvcc_iterator.h
src/storage/memtable/mvcc/ob_mvcc_iterator.h
+2
-2
未找到文件。
src/storage/memtable/mvcc/ob_mvcc_iterator.cpp
浏览文件 @
feb6c0e7
...
...
@@ -43,6 +43,7 @@ int ObMvccValueIterator::init(const ObIMvccCtx& ctx, const ObTransSnapInfo& snap
{
int
ret
=
OB_SUCCESS
;
skip_compact_
=
skip_compact
;
bool
can_read_by_sql_no
=
false
;
reset
();
int64_t
lock_for_read_start
=
ObClockGenerator
::
getClock
();
// snapshot version equal INT64_MAX is unexpected
...
...
@@ -62,28 +63,32 @@ int ObMvccValueIterator::init(const ObIMvccCtx& ctx, const ObTransSnapInfo& snap
value_
=
value
;
is_inited_
=
true
;
version_iter_
=
value
->
get_list_head
();
}
else
if
(
read_by_sql_no
(
ctx
,
snapshot_info
,
const_cast
<
ObMvccRow
*>
(
value
),
query_flag
))
{
ctx_
=
&
ctx
;
value_
=
value
;
is_inited_
=
true
;
}
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
{
// read by snapshot
ctx_
=
&
ctx
;
value_
=
value
;
// not need lock_for_read when row is not locked
if
(
value
->
row_lock_
.
is_locked
()
&&
OB_FAIL
(
value
->
lock_for_read
(
key
,
const_cast
<
ObIMvccCtx
&>
(
ctx
))))
{
TRANS_LOG
(
WARN
,
"wait row lock fail"
,
K
(
ret
),
K
(
ctx
),
KP
(
value
),
K
(
*
value
));
}
else
if
(
OB_FAIL
(
find_start_pos
(
snapshot_info
.
get_snapshot_version
())))
{
TRANS_LOG
(
WARN
,
"fail to find start pos for iterator"
,
K
(
ret
));
if
(
can_read_by_sql_no
)
{
ctx_
=
&
ctx
;
value_
=
value
;
is_inited_
=
true
;
}
else
{
if
(
GCONF
.
enable_sql_audit
)
{
mark_trans_node
(
snapshot_info
.
get_snapshot_version
(),
query_flag
.
is_prewarm
());
}
// set has_read_relocated_row flag true when reading relocated row
if
(
value
->
is_has_relocated
())
{
const_cast
<
ObIMvccCtx
*>
(
&
ctx
)
->
set_has_read_relocated_row
();
// read by snapshot
ctx_
=
&
ctx
;
value_
=
value
;
// not need lock_for_read when row is not locked
if
(
value
->
row_lock_
.
is_locked
()
&&
OB_FAIL
(
value
->
lock_for_read
(
key
,
const_cast
<
ObIMvccCtx
&>
(
ctx
))))
{
TRANS_LOG
(
WARN
,
"wait row lock fail"
,
K
(
ret
),
K
(
ctx
),
KP
(
value
),
K
(
*
value
));
}
else
if
(
OB_FAIL
(
find_start_pos
(
snapshot_info
.
get_snapshot_version
())))
{
TRANS_LOG
(
WARN
,
"fail to find start pos for iterator"
,
K
(
ret
));
}
else
{
if
(
GCONF
.
enable_sql_audit
)
{
mark_trans_node
(
snapshot_info
.
get_snapshot_version
(),
query_flag
.
is_prewarm
());
}
// set has_read_relocated_row flag true when reading relocated row
if
(
value
->
is_has_relocated
())
{
const_cast
<
ObIMvccCtx
*>
(
&
ctx
)
->
set_has_read_relocated_row
();
}
is_inited_
=
true
;
}
is_inited_
=
true
;
}
}
// stat lock for read time
...
...
@@ -273,11 +278,10 @@ void ObMvccValueIterator::move_to_next_node()
}
// check if read self transaction when fetch cursor
bool
ObMvccValueIterator
::
read_by_sql_no
(
const
ObIMvccCtx
&
ctx
,
const
ObTransSnapInfo
&
snapshot_info
,
ObMvccRow
*
value
,
const
ObQueryFlag
&
query_flag
)
int
ObMvccValueIterator
::
read_by_sql_no
(
const
ObIMvccCtx
&
ctx
,
const
ObTransSnapInfo
&
snapshot_info
,
ObMvccRow
*
value
,
const
ObQueryFlag
&
query_flag
,
bool
&
can_read_by_sql_no
)
{
int
ret
=
OB_SUCCESS
;
bool
can_read_by_sql_no
=
false
;
bool
is_locked
=
false
;
ObMvccTransNode
*
iter
=
value
->
get_list_head
();
...
...
@@ -343,7 +347,7 @@ bool ObMvccValueIterator::read_by_sql_no(
if
(
is_locked
)
{
value
->
latch_
.
unlock
();
}
return
can_read_by_sql_no
;
return
ret
;
}
void
ObMvccValueIterator
::
reset
()
...
...
src/storage/memtable/mvcc/ob_mvcc_iterator.h
浏览文件 @
feb6c0e7
...
...
@@ -115,8 +115,8 @@ public:
{
return
version_iter_
;
}
bool
read_by_sql_no
(
const
ObIMvccCtx
&
ctx
,
const
transaction
::
ObTransSnapInfo
&
snapshot_info
,
ObMvccRow
*
value
,
const
ObQueryFlag
&
query_flag
);
int
read_by_sql_no
(
const
ObIMvccCtx
&
ctx
,
const
transaction
::
ObTransSnapInfo
&
snapshot_info
,
ObMvccRow
*
value
,
const
ObQueryFlag
&
query_flag
,
bool
&
can_read_by_sql_no
);
private:
int
find_start_pos
(
const
int64_t
read_snapshot
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录