Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
6647f609
O
oceanbase
项目概览
大炮V587
/
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,发现更多精彩内容 >>
提交
6647f609
编写于
12月 09, 2022
作者:
O
obdev
提交者:
ob-robot
1月 12, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
obd: fix collect log error
上级
5b46ed57
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
27 deletion
+29
-27
src/storage/ob_storage_table_guard.cpp
src/storage/ob_storage_table_guard.cpp
+22
-21
src/storage/tablet/ob_tablet_memtable_mgr.cpp
src/storage/tablet/ob_tablet_memtable_mgr.cpp
+7
-6
未找到文件。
src/storage/ob_storage_table_guard.cpp
浏览文件 @
6647f609
...
...
@@ -143,7 +143,7 @@ int ObStorageTableGuard::refresh_and_protect_memtable()
ObTableHandleV2
handle
;
const
share
::
ObLSID
&
ls_id
=
tablet_
->
get_tablet_meta
().
ls_id_
;
const
common
::
ObTabletID
&
tablet_id
=
tablet_
->
get_tablet_meta
().
tablet_id_
;
SCN
clog_checkpoint_scn
=
tablet_
->
get_tablet_meta
().
clog_checkpoint_scn_
;
SCN
clog_checkpoint_scn
;
bool
bool_ret
=
true
;
const
int64_t
start
=
ObTimeUtility
::
current_time
();
...
...
@@ -152,24 +152,28 @@ int ObStorageTableGuard::refresh_and_protect_memtable()
LOG_WARN
(
"memtable mgr is null"
,
K
(
ret
),
KP
(
memtable_mgr
));
}
else
{
do
{
if
(
replay_scn_
<=
clog_checkpoint_scn
)
{
bool_ret
=
false
;
LOG_INFO
(
"no need to replay the log"
,
K
(
ls_id
),
K
(
tablet_id
),
K
(
replay_scn_
),
K
(
clog_checkpoint_scn
));
}
else
if
(
OB_FAIL
(
memtable_mgr
->
get_boundary_memtable
(
handle
)))
{
if
(
OB_FAIL
(
memtable_mgr
->
get_boundary_memtable
(
handle
)))
{
// if there is no memtable, create a new one
if
(
OB_ENTRY_NOT_EXIST
==
ret
)
{
LOG_DEBUG
(
"there is no boundary memtable"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id
));
ObLSHandle
ls_handle
;
// overwrite the ret code OB_ENTRY_NOT_EXIST
if
(
OB_FAIL
(
MTL
(
ObLSService
*
)
->
get_ls
(
ls_id
,
ls_handle
,
ObLSGetMod
::
STORAGE_MOD
)))
{
LOG_WARN
(
"failed to get log stream"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id
));
}
else
if
(
OB_UNLIKELY
(
!
ls_handle
.
is_valid
()))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"unexpected error, invalid ls handle"
,
K
(
ret
),
K
(
ls_handle
),
K
(
ls_id
),
K
(
tablet_id
));
}
else
if
(
OB_FAIL
(
ls_handle
.
get_ls
()
->
get_tablet_svr
()
->
create_memtable
(
tablet_id
,
0
/*schema version*/
,
for_replay_
)))
{
LOG_WARN
(
"fail to create a boundary memtable"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id
));
if
(
OB_FAIL
(
memtable_mgr
->
get_newest_clog_checkpoint_scn
(
clog_checkpoint_scn
)))
{
LOG_WARN
(
"fail to get newest clog_checkpoint_scn"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id
));
}
else
if
(
replay_scn_
>
clog_checkpoint_scn
)
{
// TODO: get the newest schema_version from tablet
ObLSHandle
ls_handle
;
if
(
OB_FAIL
(
MTL
(
ObLSService
*
)
->
get_ls
(
ls_id
,
ls_handle
,
ObLSGetMod
::
STORAGE_MOD
)))
{
LOG_WARN
(
"failed to get log stream"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id
));
}
else
if
(
OB_UNLIKELY
(
!
ls_handle
.
is_valid
()))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"unexpected error, invalid ls handle"
,
K
(
ret
),
K
(
ls_handle
),
K
(
ls_id
),
K
(
tablet_id
));
}
else
if
(
OB_FAIL
(
ls_handle
.
get_ls
()
->
get_tablet_svr
()
->
create_memtable
(
tablet_id
,
0
/*schema version*/
,
for_replay_
)))
{
LOG_WARN
(
"fail to create a boundary memtable"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id
));
}
}
else
{
// replay_log_scn_ <= clog_checkpoint_scn
// no need to create a boundary memtable
ret
=
OB_SUCCESS
;
break
;
}
}
else
{
// OB_ENTRY_NOT_EXIST != ret
LOG_WARN
(
"fail to get boundary memtable"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id
));
...
...
@@ -180,11 +184,8 @@ int ObStorageTableGuard::refresh_and_protect_memtable()
if
(
OB_MINOR_FREEZE_NOT_ALLOW
!=
ret
)
{
LOG_WARN
(
"fail to check_freeze"
,
K
(
ret
),
K
(
tablet_id
),
K
(
bool_ret
),
KPC
(
memtable
));
}
}
if
(
OB_EAGAIN
!=
ret
)
{
// overwrite the ret code OB_EAGAIN
}
else
if
(
OB_FAIL
(
memtable_mgr
->
get_newest_clog_checkpoint_scn
(
clog_checkpoint_scn
)))
{
LOG_WARN
(
"fail to get newest clog_checkpoint_scn"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id
));
}
else
{
// do nothing
}
const
int64_t
cost_time
=
ObTimeUtility
::
current_time
()
-
start
;
if
(
cost_time
>
10
*
1000
)
{
...
...
src/storage/tablet/ob_tablet_memtable_mgr.cpp
浏览文件 @
6647f609
...
...
@@ -156,7 +156,6 @@ int ObTabletMemtableMgr::create_memtable(const SCN clog_checkpoint_scn,
memtable
::
ObMemtable
*
active_memtable
=
nullptr
;
uint32_t
memtable_freeze_clock
=
UINT32_MAX
;
const
share
::
ObLSID
ls_id
=
ls_
->
get_ls_id
();
SCN
new_clog_checkpoint_scn
;
if
(
has_memtable
&&
OB_NOT_NULL
(
active_memtable
=
get_active_memtable_
()))
{
memtable_freeze_clock
=
active_memtable
->
get_freeze_clock
();
}
...
...
@@ -176,11 +175,6 @@ int ObTabletMemtableMgr::create_memtable(const SCN clog_checkpoint_scn,
K
(
get_memtable_count_
()),
KPC
(
first_frozen_memtable
.
get_table
()));
}
}
else
if
(
OB_FAIL
(
get_newest_clog_checkpoint_scn
(
new_clog_checkpoint_scn
)))
{
LOG_WARN
(
"failed to get newest clog_checkpoint_scn"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id_
),
K
(
new_clog_checkpoint_scn
));
}
else
if
(
for_replay
&&
clog_checkpoint_scn
!=
new_clog_checkpoint_scn
)
{
ret
=
OB_EAGAIN
;
LOG_INFO
(
"clog_checkpoint_scn changed, need retry to replay"
,
K
(
ls_id
),
K
(
tablet_id_
),
K
(
clog_checkpoint_scn
),
K
(
new_clog_checkpoint_scn
));
}
else
{
ObITable
::
TableKey
table_key
;
table_key
.
table_type_
=
ObITable
::
DATA_MEMTABLE
;
...
...
@@ -204,6 +198,8 @@ int ObTabletMemtableMgr::create_memtable(const SCN clog_checkpoint_scn,
LOG_WARN
(
"failed to init memtable"
,
K
(
ret
),
K
(
ls_id
),
K
(
table_key
),
KP
(
freezer_
),
KP
(
this
),
K
(
schema_version
),
K
(
logstream_freeze_clock
));
}
else
{
SCN
new_clog_checkpoint_scn
;
SCN
new_snapshot_version
;
memtable
::
ObMemtable
*
last_frozen_memtable
=
get_last_frozen_memtable_
();
if
(
OB_NOT_NULL
(
last_frozen_memtable
))
{
// keep the check order: is_frozen, write_ref_cnt, then unsubmitted_cnt and unsynced_cnt
...
...
@@ -231,6 +227,11 @@ int ObTabletMemtableMgr::create_memtable(const SCN clog_checkpoint_scn,
// there is no frozen memtable and new sstable will not be generated,
// meaning that clog_checkpoint_scn will not be updated now,
// so get newest clog_checkpoint_scn to set left boundary
}
else
if
(
OB_FAIL
(
get_newest_clog_checkpoint_scn
(
new_clog_checkpoint_scn
))){
LOG_WARN
(
"failed to get newest clog_checkpoint_scn"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id_
),
K
(
new_clog_checkpoint_scn
));
}
else
if
(
OB_FAIL
(
get_newest_snapshot_version
(
new_snapshot_version
))){
LOG_WARN
(
"failed to get newest snapshot_version"
,
K
(
ret
),
K
(
ls_id
),
K
(
tablet_id_
),
K
(
new_snapshot_version
));
}
else
{
memtable
->
resolve_left_boundary
(
new_clog_checkpoint_scn
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录