Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
b20901e8
O
oceanbase
项目概览
Metz
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b20901e8
编写于
8月 04, 2021
作者:
K
kongfy
提交者:
wangzelin.wzl
8月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix rowlock double locked problem
上级
d275ff56
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
10 deletion
+31
-10
src/storage/memtable/mvcc/ob_mvcc_row.cpp
src/storage/memtable/mvcc/ob_mvcc_row.cpp
+0
-1
src/storage/memtable/ob_memtable.cpp
src/storage/memtable/ob_memtable.cpp
+28
-7
src/storage/ob_sstable.cpp
src/storage/ob_sstable.cpp
+3
-2
未找到文件。
src/storage/memtable/mvcc/ob_mvcc_row.cpp
浏览文件 @
b20901e8
...
...
@@ -1130,7 +1130,6 @@ int ObMvccRow::check_row_locked(
}
// locked by other
if
(
is_locked
&&
lock_descriptor
!=
ctx
.
get_ctx_descriptor
())
{
lock_descriptor
=
row_lock_
.
get_exclusive_uid
();
int64_t
lock_wait_start_ts
=
ctx
.
get_lock_wait_start_ts
()
>
0
?
ctx
.
get_lock_wait_start_ts
()
:
common
::
ObClockGenerator
::
getClock
();
int64_t
query_abs_lock_wait_timeout
=
ctx
.
get_query_abs_lock_wait_timeout
(
lock_wait_start_ts
);
...
...
src/storage/memtable/ob_memtable.cpp
浏览文件 @
b20901e8
...
...
@@ -1912,15 +1912,18 @@ int ObMemtable::lock_row_on_frozen_stores(const ObStoreCtx& ctx, const ObMemtabl
ret
=
OB_ERR_UNEXPECTED
;
TRANS_LOG
(
ERROR
,
"stores in context is null"
,
K
(
ret
));
}
else
{
bool
locked_by_self
=
false
;
int64_t
max_trans_version
=
0
;
const
ObIArray
<
ObITable
*>*
stores
=
ctx
.
tables_
;
ObStoreRowLockState
lock_state
;
// ignore active memtable
for
(
int64_t
i
=
stores
->
count
()
-
2
;
OB_SUCC
(
ret
)
&&
i
>=
0
;
i
--
)
{
int64_t
current_version
=
0
;
bool
is_locked
=
false
;
uint32_t
lock_descriptor
=
0
;
ObStoreRowLockState
lock_state
;
lock_state
.
reset
();
if
(
NULL
==
stores
->
at
(
i
))
{
ret
=
OB_ERR_UNEXPECTED
;
...
...
@@ -1929,7 +1932,13 @@ int ObMemtable::lock_row_on_frozen_stores(const ObStoreCtx& ctx, const ObMemtabl
ObMemtable
*
memtable
=
static_cast
<
ObMemtable
*>
(
stores
->
at
(
i
));
if
(
OB_FAIL
(
memtable
->
get_mvcc_engine
().
check_row_locked
(
*
ctx
.
mem_ctx_
,
key
,
is_locked
,
lock_descriptor
,
current_version
)))
{
TRANS_LOG
(
WARN
,
"mvcc engine check row lock fail"
,
K
(
ret
),
K
(
is_locked
),
K
(
lock_descriptor
));
TRANS_LOG
(
WARN
,
"mvcc engine check row lock fail, may be locked by other"
,
K
(
ret
),
K
(
is_locked
),
K
(
lock_descriptor
));
}
else
{
locked_by_self
|=
is_locked
&&
lock_descriptor
==
ctx
.
mem_ctx_
->
get_ctx_descriptor
();
}
}
else
if
(
stores
->
at
(
i
)
->
is_sstable
())
{
ObSSTable
*
sstable
=
static_cast
<
ObSSTable
*>
(
stores
->
at
(
i
));
...
...
@@ -1937,6 +1946,7 @@ int ObMemtable::lock_row_on_frozen_stores(const ObStoreCtx& ctx, const ObMemtabl
TRANS_LOG
(
WARN
,
"failed to check row lock by other"
,
K
(
ret
),
K
(
*
key
),
K
(
lock_state
));
}
else
{
current_version
=
lock_state
.
trans_version_
;
locked_by_self
|=
lock_state
.
is_locked_
&&
ctx
.
trans_id_
==
lock_state
.
lock_trans_id_
;
}
TRANS_LOG
(
DEBUG
,
"check_row_locked meet sstable"
,
K
(
ret
),
K
(
*
key
),
K
(
*
sstable
),
K
(
current_version
));
}
else
{
...
...
@@ -1945,16 +1955,27 @@ int ObMemtable::lock_row_on_frozen_stores(const ObStoreCtx& ctx, const ObMemtabl
}
max_trans_version
=
max
(
max_trans_version
,
current_version
);
TRANS_LOG
(
DEBUG
,
"check_row_locked"
,
K
(
i
),
K
(
stores
->
count
()),
K
(
stores
->
at
(
i
)));
TRANS_LOG
(
DEBUG
,
"check_row_locked"
,
K
(
i
),
K
(
stores
->
count
()),
K
(
stores
->
at
(
i
)),
K
(
locked_by_self
),
K
(
current_version
),
K
(
max_trans_version
));
}
if
(
OB_SUCC
(
ret
))
{
value
->
update_max_trans_version
(
max_trans_version
);
value
->
set_lower_lock_scaned
();
if
(
!
locked_by_self
)
{
// there is no locks on frozen stores
if
(
max_trans_version
>
ctx
.
mem_ctx_
->
get_read_snapshot
())
{
ret
=
OB_TRANSACTION_SET_VIOLATION
;
TRANS_LOG
(
WARN
,
"TRANS_SET_VIOLATION"
,
K
(
ret
),
K
(
max_trans_version
),
"ctx"
,
ctx
.
mem_ctx_
);
}
if
(
max_trans_version
>
ctx
.
mem_ctx_
->
get_read_snapshot
())
{
ret
=
OB_TRANSACTION_SET_VIOLATION
;
TRANS_LOG
(
WARN
,
"TRANS_SET_VIOLATION"
,
K
(
ret
),
K
(
max_trans_version
),
"ctx"
,
ctx
.
mem_ctx_
);
value
->
set_lower_lock_scaned
();
TRANS_LOG
(
DEBUG
,
"lower lock check finish"
,
K
(
*
value
),
K
(
*
stores
));
}
}
}
...
...
src/storage/ob_sstable.cpp
浏览文件 @
b20901e8
...
...
@@ -3033,9 +3033,10 @@ int ObSSTable::check_row_locked(const ObStoreCtx& ctx, const common::ObStoreRowk
STORAGE_LOG
(
WARN
,
"failed to open getter, "
,
K
(
ret
),
K
(
iter_param
),
K
(
access_context
),
K
(
ext_rowkey
));
}
else
if
(
OB_SUCC
(
row_iterator
->
get_next_row
(
store_row
)))
{
lock_state
.
trans_version_
=
store_row
->
snapshot_version_
;
lock_state
.
is_locked_
=
((
ObSSTableRowLockChecker
*
)
row_iterator
)
->
is_curr_row_locked
();
lock_state
.
lock_trans_id_
=
((
ObSSTableRowLockChecker
*
)
row_iterator
)
->
get_lock_trans_id
();
}
lock_state
.
is_locked_
=
((
ObSSTableRowLockChecker
*
)
row_iterator
)
->
is_curr_row_locked
();
lock_state
.
lock_trans_id_
=
((
ObSSTableRowLockChecker
*
)
row_iterator
)
->
get_lock_trans_id
();
}
row_iterator
->~
ObISSTableRowIterator
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录