Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
clmforever
oceanbase
提交
2ca80bac
O
oceanbase
项目概览
clmforever
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2ca80bac
编写于
11月 22, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
11月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
BUGFIX: wake up lock wait mgr if OUT_TRANS_UNLOCK finished
上级
26f34fa1
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
23 deletion
+26
-23
src/share/ob_debug_sync_point.h
src/share/ob_debug_sync_point.h
+1
-0
src/storage/tablelock/ob_lock_memtable.cpp
src/storage/tablelock/ob_lock_memtable.cpp
+1
-18
src/storage/tablelock/ob_lock_memtable.h
src/storage/tablelock/ob_lock_memtable.h
+0
-1
src/storage/tablelock/ob_obj_lock.cpp
src/storage/tablelock/ob_obj_lock.cpp
+21
-2
src/storage/tablelock/ob_obj_lock.h
src/storage/tablelock/ob_obj_lock.h
+1
-0
src/storage/tablelock/ob_table_lock_common.h
src/storage/tablelock/ob_table_lock_common.h
+0
-2
src/storage/tablelock/ob_table_lock_service.cpp
src/storage/tablelock/ob_table_lock_service.cpp
+2
-0
未找到文件。
src/share/ob_debug_sync_point.h
浏览文件 @
2ca80bac
...
...
@@ -424,6 +424,7 @@ class ObString;
ACT(AFTER_BACKUP_FETCH_MACRO_BLOCK_FAILED,)\
ACT(BEFORE_TABLE_REDEFINITION_TASK_EFFECT,)\
ACT(ALTER_LS_CHOOSE_SRC,)\
ACT(BEFORE_LOCK_SERVICE_UNLOCK,)\
ACT(MAX_DEBUG_SYNC_POINT,)
DECLARE_ENUM
(
ObDebugSyncPoint
,
debug_sync_point
,
OB_DEBUG_SYNC_POINT_DEF
);
...
...
src/storage/tablelock/ob_lock_memtable.cpp
浏览文件 @
2ca80bac
...
...
@@ -171,8 +171,7 @@ int ObLockMemtable::lock_(
if
(
ret
==
OB_OBJ_LOCK_EXIST
)
{
ret
=
OB_SUCCESS
;
}
if
(
ENABLE_USE_LOCK_WAIT_MGR
&&
OB_TRY_LOCK_ROW_CONFLICT
==
ret
&&
if
(
OB_TRY_LOCK_ROW_CONFLICT
==
ret
&&
lock_op
.
is_dml_lock_op
()
&&
// only in trans dml lock will wait at lock wait mgr.
conflict_tx_set
.
count
()
!=
0
)
{
// TODO: yanyuan.cxf only wait at the first conflict trans now, but we need
...
...
@@ -351,19 +350,6 @@ int ObLockMemtable::post_obj_lock_conflict_(ObMvccAccessCtx &acc_ctx,
return
ret
;
}
void
ObLockMemtable
::
wakeup_waiters_
(
const
ObTableLockOp
&
lock_op
)
{
// dml in trans lock does not need do this.
if
(
OB_LIKELY
(
!
lock_op
.
need_wakeup_waiter
()))
{
// do nothing
}
else
if
(
OB_ISNULL
(
MTL
(
ObLockWaitMgr
*
)))
{
LOG_WARN
(
"MTL(ObLockWaitMgr*) is null"
);
}
else
{
MTL
(
ObLockWaitMgr
*
)
->
wakeup
(
lock_op
.
lock_id_
);
LOG_DEBUG
(
"ObLockMemtable::wakeup_waiters_ "
,
K
(
lock_op
));
}
}
int
ObLockMemtable
::
check_lock_conflict
(
const
ObMemtableCtx
*
mem_ctx
,
const
ObTableLockOp
&
lock_op
,
...
...
@@ -489,9 +475,6 @@ void ObLockMemtable::remove_lock_record(const ObTableLockOp &lock_op)
LOG_WARN
(
"invalid argument"
,
K
(
ret
),
K
(
lock_op
));
}
else
{
obj_lock_map_
.
remove_lock_record
(
lock_op
);
if
(
ENABLE_USE_LOCK_WAIT_MGR
)
{
wakeup_waiters_
(
lock_op
);
}
}
LOG_DEBUG
(
"ObLockMemtable::remove_lock_record"
,
K
(
lock_op
));
}
...
...
src/storage/tablelock/ob_lock_memtable.h
浏览文件 @
2ca80bac
...
...
@@ -207,7 +207,6 @@ private:
const
ObLockID
&
lock_id
,
const
ObTransID
&
conflict_tx_id
,
ObFunction
<
int
(
bool
&
need_wait
)
>
&
recheck_f
);
void
wakeup_waiters_
(
const
ObTableLockOp
&
lock_op
);
private:
typedef
common
::
SpinRWLock
RWLock
;
typedef
common
::
SpinRLockGuard
RLockGuard
;
...
...
src/storage/tablelock/ob_obj_lock.cpp
浏览文件 @
2ca80bac
...
...
@@ -15,6 +15,7 @@
#include "share/ob_define.h"
#include "share/ob_errno.h"
#include "lib/oblog/ob_log_module.h"
#include "storage/memtable/ob_lock_wait_mgr.h"
#include "storage/tx/ob_trans_deadlock_adapter.h"
#include "storage/tx/ob_trans_define.h"
#include "storage/tx/ob_trans_part_ctx.h"
...
...
@@ -401,6 +402,11 @@ int ObOBJLock::update_lock_status(
LOG_WARN
(
"compact tablelock failed"
,
K
(
tmp_ret
),
K
(
lock_op
));
}
}
if
(
OB_SUCC
(
ret
)
&&
lock_op
.
op_type_
==
OUT_TRANS_UNLOCK
&&
status
==
LOCK_OP_COMPLETE
)
{
wakeup_waiters_
(
lock_op
);
}
}
LOG_DEBUG
(
"update lock status"
,
K
(
ret
),
K
(
lock_op
),
K
(
commit_version
),
K
(
status
));
return
ret
;
...
...
@@ -470,8 +476,7 @@ int ObOBJLock::lock(
// something else.
need_retry
=
false
;
ret
=
OB_TRANS_KILLED
;
}
else
if
(
ENABLE_USE_LOCK_WAIT_MGR
&&
lock_op
.
is_dml_lock_op
()
/* only dml lock will wait at lock wait mgr */
)
{
}
else
if
(
lock_op
.
is_dml_lock_op
()
/* only dml lock will wait at lock wait mgr */
)
{
// wait at lock wait mgr but not retry at here.
need_retry
=
false
;
}
else
{
...
...
@@ -590,10 +595,24 @@ void ObOBJLock::remove_lock_op(
drop_op_list_if_empty_
(
lock_op
.
lock_mode_
,
op_list
,
allocator
);
wakeup_waiters_
(
lock_op
);
}
LOG_DEBUG
(
"ObOBJLock::remove_lock_op finish."
);
}
void
ObOBJLock
::
wakeup_waiters_
(
const
ObTableLockOp
&
lock_op
)
{
// dml in trans lock does not need do this.
if
(
OB_LIKELY
(
!
lock_op
.
need_wakeup_waiter
()))
{
// do nothing
}
else
if
(
OB_ISNULL
(
MTL
(
ObLockWaitMgr
*
)))
{
LOG_WARN
(
"MTL(ObLockWaitMgr*) is null"
);
}
else
{
MTL
(
ObLockWaitMgr
*
)
->
wakeup
(
lock_op
.
lock_id_
);
LOG_DEBUG
(
"ObOBJLock::wakeup_waiters_ "
,
K
(
lock_op
));
}
}
int64_t
ObOBJLock
::
get_min_ddl_lock_committed_log_ts
(
const
int64_t
flushed_log_ts
)
const
{
int
ret
=
OB_SUCCESS
;
...
...
src/storage/tablelock/ob_obj_lock.h
浏览文件 @
2ca80bac
...
...
@@ -155,6 +155,7 @@ private:
const
int64_t
commit_log_ts
,
const
ObTableLockOpStatus
status
,
ObTableLockOpList
*
op_list
);
void
wakeup_waiters_
(
const
ObTableLockOp
&
lock_op
);
int
recover_
(
const
ObTableLockOp
&
lock_op
,
ObMalloc
&
allocator
);
...
...
src/storage/tablelock/ob_table_lock_common.h
浏览文件 @
2ca80bac
...
...
@@ -427,8 +427,6 @@ typedef common::ObSimpleIterator<ObLockID, ObSimpleIteratorModIds::OB_OBJ_LOCK_M
// Is used to store and traverse all lock op
typedef
common
::
ObSimpleIterator
<
ObTableLockOp
,
ObSimpleIteratorModIds
::
OB_OBJ_LOCK
,
16
>
ObLockOpIterator
;
// whether use lock wait mgr or not.
static
const
bool
ENABLE_USE_LOCK_WAIT_MGR
=
true
;
// the threshold of timeout interval which will enable the deadlock avoid.
static
const
int64_t
MIN_DEADLOCK_AVOID_TIMEOUT_US
=
60
*
1000
*
1000
;
// 1 min
bool
is_deadlock_avoid_enabled
(
const
int64_t
expire_time
);
...
...
src/storage/tablelock/ob_table_lock_service.cpp
浏览文件 @
2ca80bac
...
...
@@ -290,6 +290,7 @@ int ObTableLockService::unlock_table(const uint64_t table_id,
LOG_INFO
(
"ObTableLockService::unlock_table"
,
K
(
table_id
),
K
(
lock_mode
),
K
(
lock_owner
),
K
(
timeout_us
));
int
ret
=
OB_SUCCESS
;
DEBUG_SYNC
(
BEFORE_LOCK_SERVICE_UNLOCK
);
if
(
IS_NOT_INIT
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"lock service is not inited"
,
K
(
ret
),
K
(
table_id
),
K
(
lock_mode
),
...
...
@@ -353,6 +354,7 @@ int ObTableLockService::unlock_tablet(const uint64_t table_id,
const
int64_t
timeout_us
)
{
int
ret
=
OB_SUCCESS
;
DEBUG_SYNC
(
BEFORE_LOCK_SERVICE_UNLOCK
);
if
(
IS_NOT_INIT
)
{
ret
=
OB_NOT_INIT
;
LOG_WARN
(
"lock service is not inited"
,
K
(
ret
),
K
(
table_id
),
K
(
tablet_id
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录