Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
60f8ae0d
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
60f8ae0d
编写于
12月 29, 2021
作者:
G
godyangfight
提交者:
LINGuanRen
12月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Misreuse minor sstable or trans sstable with same tablekey
上级
c2cb7a79
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
82 addition
and
38 deletion
+82
-38
src/storage/ob_partition_migrator.cpp
src/storage/ob_partition_migrator.cpp
+78
-37
src/storage/ob_partition_migrator.h
src/storage/ob_partition_migrator.h
+2
-1
src/storage/ob_pg_storage.cpp
src/storage/ob_pg_storage.cpp
+2
-0
未找到文件。
src/storage/ob_partition_migrator.cpp
浏览文件 @
60f8ae0d
...
...
@@ -1051,50 +1051,52 @@ int64_t ObMigrateRecoveryPointCtx::to_string(char *buf, const int64_t buf_len) c
}
int ObMigrateFinishPhysicalTask::check_sstable_meta(
const blocksstable::ObSSTableBaseMeta &src_meta, const blocksstable::ObSSTableBaseMeta &write_meta)
const blocksstable::ObSSTableBaseMeta &src_meta, const blocksstable::ObSSTableBaseMeta &write_meta
, const bool is_check_in_advance
)
{
int ret = OB_SUCCESS;
const int32_t ERROR_CODE = is_check_in_advance ? OB_ENTRY_EXIST : OB_INVALID_DATA;
if (src_meta.index_id_ != write_meta.index_id_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "index_id_ not match", K(ret));
} else if (src_meta.row_count_ != write_meta.row_count_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "row_count_ not match", K(ret));
} else if (src_meta.occupy_size_ != write_meta.occupy_size_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "occupy_size_ not match", K(ret));
} else if (src_meta.data_checksum_ != write_meta.data_checksum_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "data checksum not match", K(ret));
} else if (src_meta.row_checksum_ != write_meta.row_checksum_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "row_checksum_ not match", K(ret));
} else if (src_meta.data_version_ != write_meta.data_version_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "data_version_ not match", K(ret));
} else if (src_meta.rowkey_column_count_ != write_meta.rowkey_column_count_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "rowkey_column_count_ not match", K(ret));
} else if (src_meta.table_type_ != write_meta.table_type_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "table_type_ not match", K(ret));
} else if (src_meta.index_type_ != write_meta.index_type_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "index_type_ not match", K(ret));
} else if (src_meta.macro_block_count_ != write_meta.macro_block_count_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "macro_block_count_ not match", K(ret));
} else if (src_meta.lob_macro_block_count_ != write_meta.lob_macro_block_count_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "lob_macro_block_count_ not match", K(ret));
} else if (src_meta.column_cnt_ != write_meta.column_cnt_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "column_cnt_ not match", K(ret));
} else if (src_meta.total_sstable_count_ != write_meta.total_sstable_count_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "total_sstable_count_ not match", K(ret));
} else if (src_meta.max_logic_block_index_ != write_meta.max_logic_block_index_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "max_logic_block_index_ not match", K(ret));
} else {
for (int64_t i = 0; OB_SUCC(ret) && i < src_meta.column_cnt_; ++i) {
...
...
@@ -1103,7 +1105,7 @@ int ObMigrateFinishPhysicalTask::check_sstable_meta(
if (src_col.column_id_ != write_col.column_id_ ||
src_col.column_default_checksum_ != write_col.column_default_checksum_ ||
src_col.column_checksum_ != write_col.column_checksum_) {
ret =
OB_INVALID_DATA
;
ret =
ERROR_CODE
;
STORAGE_LOG(WARN, "column_metas_ not match", K(ret), K(i), K(src_meta), K(write_meta));
}
}
...
...
@@ -1111,6 +1113,30 @@ int ObMigrateFinishPhysicalTask::check_sstable_meta(
return ret;
}
int ObMigrateFinishPhysicalTask::check_sstable_meta(
const bool is_check_in_advance, ObTableHandle &handle)
{
int ret = OB_SUCCESS;
ObSSTable *sstable = nullptr;
if (!is_inited_) {
ret = OB_NOT_INIT;
LOG_WARN("migrate finish physical task do not init", K(ret));
} else if (!handle.is_valid()) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("check sstable meta get invalid argument", K(ret), K(handle));
} else if (OB_FAIL(handle.get_sstable(sstable))) {
LOG_WARN("fail to get sstable", K(ret));
} else if (OB_ISNULL(sstable)) {
ret = OB_ERR_SYS;
LOG_WARN("sstable should not be null", K(ret));
} else if (OB_FAIL(check_sstable_meta(sstable_ctx_.meta_, sstable->get_meta(), is_check_in_advance))) {
LOG_WARN("failed to check sstable meta",
K(ret), K(sstable_ctx_.meta_), "new_meta", sstable->get_meta());
}
return ret;
}
int ObMigratePrepareTask::create_new_partition(const ObAddr &src_server, ObReplicaOpArg &replica_op_arg,
ObIPartitionGroupGuard &partition_guard, ObStorageFileHandle &file_handle)
{
...
...
@@ -8136,11 +8162,18 @@ int ObMigratePrepareTask::check_can_reuse_sstable(
LOG_WARN("failed to convert sstable info to table key", K(ret), K(table_info));
} else if (OB_FAIL(check_and_reuse_sstable(pkey, table_key, is_reuse, part_ctx))) {
LOG_WARN("failed to check can reuse sstable", K(ret), "table_key", table_key);
} else if (!is_reuse) {
// do nothing
} else if (OB_FAIL(table_info.minor_sstables_.remove(i))) {
LOG_WARN("failed to remove reused table", K(ret), "table_key", table_key);
} else if (is_reuse) {
FLOG_INFO("minor sstable do not reuse", "src table info",
table_info.minor_sstables_.at(i), "convert table key", table_key);
}
//Because trans sstable can not reuse, so minor sstables cannot be reuse too.
//else if (OB_FAIL(check_and_reuse_sstable(pkey, table_key, is_reuse, part_ctx))) {
// LOG_WARN("failed to check can reuse sstable", K(ret), "table_key", table_key);
//} else if (!is_reuse) {
// //do nothing
//} else if (OB_FAIL(table_info.minor_sstables_.remove(i))) {
// LOG_WARN("failed to remove reused table", K(ret), "table_key", table_key);
//}
}
}
}
...
...
@@ -12262,27 +12295,37 @@ int ObMigrateFinishPhysicalTask::process()
if (OB_SUCC(ret)) {
param.table_key_ = &dest_table_key;
param.meta_ = &sstable_ctx_.meta_;
bool is_check_in_advance = false;
int tmp_ret = OB_SUCCESS;
if (OB_ISNULL(partition = ctx->partition_guard_.get_partition_group())) {
ret = OB_ERR_SYS;
LOG_ERROR("partition must not null", K(ret));
} else if (OB_SUCCESS != (tmp_ret = acquire_sstable(dest_table_key, handle))) {
LOG_WARN("failed to acquire sstbale", K(ret), K(dest_table_key));
is_check_in_advance = false;
} else {
is_check_in_advance = true;
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(partition->create_sstable(param, handle))) {
LOG_WARN("fail to create sstable", K(ret));
if (OB_ENTRY_EXIST == ret) {
// cover ret
if (!dest_table_key.is_trans_sstable() && OB_FAIL(acquire_sstable(dest_table_key, handle))) {
LOG_WARN("failed to acquire sstables", K(ret), K(dest_table_key));
}
}
LOG_WARN("fail to create sstable", K(ret), K(param));
} else if (OB_FAIL(check_sstable_meta(is_check_in_advance, handle))) {
LOG_WARN("failed to check sstable meta",
K(ret), K(sstable_ctx_.meta_), K(handle));
}
if (OB_FAIL(ret)) {
} else if (OB_FAIL(handle.get_sstable(sstable))) {
LOG_WARN("fail to get sstable", K(ret));
} else if (OB_ISNULL(sstable)) {
ret = OB_ERR_SYS;
LOG_WARN("sstable should not be null", K(ret));
}
tg.click("create_sstable");
if (OB_SUCC(ret)) {
if (OB_FAIL(handle.get_sstable(sstable))) {
LOG_WARN("fail to get sstable", K(ret));
} else if (OB_ISNULL(sstable)) {
ret = OB_ERR_SYS;
LOG_WARN("sstable should not be null", K(ret));
} else if (ObIPartitionMigrateCtx::RECOVERY_POINT_CTX == part_migrate_ctx_->get_type()) {
if (ObIPartitionMigrateCtx::RECOVERY_POINT_CTX == part_migrate_ctx_->get_type()) {
if (OB_FAIL(part_migrate_ctx_->add_sstable(*sstable))) {
LOG_WARN("failed to add sstable", K(ret));
}
...
...
@@ -12317,6 +12360,8 @@ int ObMigrateFinishPhysicalTask::acquire_sstable(const ObITable::TableKey &dest_
int ret = OB_SUCCESS;
handle.reset();
ObSSTable *sstable = NULL;
const bool is_check_in_advance = true;
if (!is_inited_) {
ret = OB_NOT_INIT;
LOG_WARN("finish physical task do not init", K(ret));
...
...
@@ -12325,10 +12370,6 @@ int ObMigrateFinishPhysicalTask::acquire_sstable(const ObITable::TableKey &dest_
LOG_WARN("acquire sstable get invalid argument", K(ret), K(dest_table_key));
} else if (OB_FAIL(ObPartitionService::get_instance().acquire_sstable(dest_table_key, handle))) {
LOG_WARN("failed to acquire sstable", K(ret), K(dest_table_key));
} else if (OB_FAIL(handle.get_sstable(sstable))) {
LOG_WARN("failed to get sstable", K(ret), K(handle));
} else if (OB_FAIL(check_sstable_meta(sstable_ctx_.meta_, sstable->get_meta()))) {
LOG_WARN("failed to check sstable meta", K(ret), K(sstable_ctx_.meta_), "new_meta", sstable->get_meta());
}
return ret;
}
...
...
src/storage/ob_partition_migrator.h
浏览文件 @
60f8ae0d
...
...
@@ -1106,8 +1106,9 @@ public:
private:
int
check_sstable_meta
(
const
blocksstable
::
ObSSTableBaseMeta
&
src_meta
,
const
blocksstable
::
ObSSTableBaseMeta
&
write_meta
);
const
blocksstable
::
ObSSTableBaseMeta
&
src_meta
,
const
blocksstable
::
ObSSTableBaseMeta
&
write_meta
,
const
bool
is_check_in_advance
);
int
acquire_sstable
(
const
ObITable
::
TableKey
&
dest_table_key
,
ObTableHandle
&
handle
);
int
check_sstable_meta
(
const
bool
is_check_in_advance
,
ObTableHandle
&
handle
);
private:
bool
is_inited_
;
...
...
src/storage/ob_pg_storage.cpp
浏览文件 @
60f8ae0d
...
...
@@ -5998,6 +5998,8 @@ int ObPGStorage::create_sstables(const common::ObIArray<ObPGCreateSSTableParam>&
need_create_sstable
=
false
;
if
(
OB_FAIL
(
tables_handle
.
add_table
(
table_handle
)))
{
LOG_WARN
(
"fail to add table"
,
K
(
ret
));
}
else
{
FLOG_INFO
(
"local has sstable, no need create it again"
,
K
(
table_key
));
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录