Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
clmforever
oceanbase
提交
97b45954
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,发现更多精彩内容 >>
提交
97b45954
编写于
8月 12, 2021
作者:
Y
yy0
提交者:
wangzelin.wzl
8月 12, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
not update schema version if replay clog while restore
上级
ab743ff0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
33 addition
and
5 deletion
+33
-5
src/storage/memtable/mvcc/ob_mvcc_ctx.h
src/storage/memtable/mvcc/ob_mvcc_ctx.h
+11
-0
src/storage/memtable/ob_memtable.cpp
src/storage/memtable/ob_memtable.cpp
+8
-5
src/storage/ob_partition_service.cpp
src/storage/ob_partition_service.cpp
+1
-0
src/storage/transaction/ob_trans_part_ctx.cpp
src/storage/transaction/ob_trans_part_ctx.cpp
+12
-0
src/storage/transaction/ob_trans_part_ctx.h
src/storage/transaction/ob_trans_part_ctx.h
+1
-0
未找到文件。
src/storage/memtable/mvcc/ob_mvcc_ctx.h
浏览文件 @
97b45954
...
...
@@ -49,6 +49,7 @@ public:
lock_start_time_
(
0
),
row_purge_version_
(
0
),
redo_log_timestamp_
(
0
),
redo_log_id_
(
0
),
trx_lock_timeout_
(
-
1
),
lock_wait_start_ts_
(
0
),
multi_version_range_
(),
...
...
@@ -273,10 +274,18 @@ public:
{
redo_log_timestamp_
=
redo_log_timestamp
;
}
inline
void
set_redo_log_id
(
const
int64_t
redo_log_id
)
{
redo_log_id_
=
redo_log_id
;
}
inline
int64_t
get_redo_log_timestamp
()
const
{
return
redo_log_timestamp_
;
}
inline
int64_t
get_redo_log_id
()
const
{
return
redo_log_id_
;
}
inline
int64_t
get_callback_list_length
()
const
{
return
trans_mgr_
.
count
();
...
...
@@ -348,6 +357,7 @@ public:
lock_start_time_
=
0
;
row_purge_version_
=
0
;
redo_log_timestamp_
=
0
;
redo_log_id_
=
0
;
multi_version_range_
.
reset
();
multi_version_range_
.
base_version_
=
common
::
ObVersionRange
::
MIN_VERSION
;
// TODO: remove it
lock_wait_start_ts_
=
0
;
...
...
@@ -429,6 +439,7 @@ protected:
int64_t
lock_start_time_
;
int64_t
row_purge_version_
;
int64_t
redo_log_timestamp_
;
int64_t
redo_log_id_
;
int64_t
trx_lock_timeout_
;
int64_t
lock_wait_start_ts_
;
common
::
ObVersionRange
multi_version_range_
;
...
...
src/storage/memtable/ob_memtable.cpp
浏览文件 @
97b45954
...
...
@@ -1323,7 +1323,9 @@ int ObMemtable::replay(const ObStoreCtx& ctx, const char* data, const int64_t da
const
int64_t
log_timestamp
=
mt_ctx
->
get_redo_log_timestamp
();
// In principle, failure is not allowed here, but from implementation aspect,
// the logic inside needs to deal with failures due to lack of memory
if
(
OB_UNLIKELY
(
0
>=
log_timestamp
)
||
OB_UNLIKELY
(
INT64_MAX
==
log_timestamp
))
{
const
int64_t
log_id
=
mt_ctx
->
get_redo_log_id
();
if
(
OB_UNLIKELY
(
0
>=
log_timestamp
)
||
OB_UNLIKELY
(
INT64_MAX
==
log_timestamp
)
||
OB_UNLIKELY
(
0
>=
log_id
)
||
OB_UNLIKELY
(
INT64_MAX
==
log_id
))
{
ret
=
OB_ERR_UNEXPECTED
;
TRANS_LOG
(
ERROR
,
"unexpected log timestamp"
,
K
(
ret
),
K
(
*
mt_ctx
));
}
else
if
(
OB_FAIL
(
mt_ctx
->
set_replay_host
(
this
,
for_replay
)))
{
...
...
@@ -1380,9 +1382,8 @@ int ObMemtable::replay(const ObStoreCtx& ctx, const char* data, const int64_t da
TRANS_LOG
(
WARN
,
"failed to check standby_cluster_schema_condition"
,
K
(
ret
),
K
(
table_id
),
K
(
table_version
));
}
else
{
// FIXME.
transaction
::
ObPartTransCtx
*
part_ctx
=
static_cast
<
transaction
::
ObPartTransCtx
*>
(
mt_ctx
->
get_trans_ctx
());
if
(
0
!=
flag
)
{
transaction
::
ObPartTransCtx
*
part_ctx
=
static_cast
<
transaction
::
ObPartTransCtx
*>
(
mt_ctx
->
get_trans_ctx
());
if
(
OB_FAIL
(
part_ctx
->
replay_rollback_to
(
sql_no
,
ctx
.
log_ts_
)))
{
TRANS_LOG
(
WARN
,
"replay rollback savepoint failed"
,
K
(
ret
),
K
(
*
mt_ctx
),
K
(
sql_no
));
}
else
{
...
...
@@ -1414,8 +1415,10 @@ int ObMemtable::replay(const ObStoreCtx& ctx, const char* data, const int64_t da
K
(
acc_checksum
));
}
}
else
{
ctx
.
mem_ctx_
->
set_table_version
(
table_version
);
set_max_schema_version
(
table_version
);
if
(
part_ctx
->
need_update_schema_version
(
log_id
,
log_timestamp
))
{
ctx
.
mem_ctx_
->
set_table_version
(
table_version
);
set_max_schema_version
(
table_version
);
}
}
}
}
...
...
src/storage/ob_partition_service.cpp
浏览文件 @
97b45954
...
...
@@ -4477,6 +4477,7 @@ int ObPartitionService::replay_redo_log(const common::ObPartitionKey& pkey, cons
} else {
// used to order trans nodes that have not determined the commit version during replay
ctx.mem_ctx_->set_redo_log_timestamp(log_timestamp);
ctx.mem_ctx_->set_redo_log_id(log_id);
if (OB_FAIL(get_partition(pkey, guard))) {
STORAGE_LOG(WARN, "get partition failed", K(pkey), K(ret));
} else if (OB_ISNULL(guard.get_partition_group())) {
...
...
src/storage/transaction/ob_trans_part_ctx.cpp
浏览文件 @
97b45954
...
...
@@ -4132,6 +4132,18 @@ bool ObPartTransCtx::need_rollback_when_restore_(const int64_t commit_version)
commit_version
>
restore_snapshot_version
;
}
bool
ObPartTransCtx
::
need_update_schema_version
(
const
int64_t
log_id
,
const
int64_t
log_ts
)
{
const
int64_t
restore_snapshot_version
=
partition_mgr_
->
get_restore_snapshot_version
();
const
int64_t
last_restore_log_id
=
partition_mgr_
->
get_last_restore_log_id
();
bool
need_update
=
true
;
if
(
restore_snapshot_version
>
0
&&
(
last_restore_log_id
==
OB_INVALID_ID
||
log_id
<=
last_restore_log_id
)
&&
(
log_ts
>
restore_snapshot_version
))
{
need_update
=
false
;
}
return
need_update
;
}
int
ObPartTransCtx
::
trans_replay_commit_
(
const
int64_t
commit_version
,
const
int64_t
checksum
)
{
ObTimeGuard
tg
(
"trans_replay_commit"
,
50
*
1000
);
...
...
src/storage/transaction/ob_trans_part_ctx.h
浏览文件 @
97b45954
...
...
@@ -389,6 +389,7 @@ public:
bool
is_in_trans_table_state
();
virtual
int64_t
get_part_trans_action
()
const
override
;
int
rollback_stmt
(
const
int64_t
from_sql_no
,
const
int64_t
to_sql_no
);
bool
need_update_schema_version
(
const
int64_t
log_id
,
const
int64_t
log_ts
);
public:
INHERIT_TO_STRING_KV
(
"ObDistTransCtx"
,
ObDistTransCtx
,
K_
(
snapshot_version
),
K_
(
local_trans_version
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录