Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
ea4e6498
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,发现更多精彩内容 >>
提交
ea4e6498
编写于
12月 08, 2022
作者:
O
obdev
提交者:
ob-robot
1月 12, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add defensive code for col checksum
上级
75c6144a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
54 addition
and
5 deletion
+54
-5
src/storage/blocksstable/ob_index_block_builder.cpp
src/storage/blocksstable/ob_index_block_builder.cpp
+2
-1
src/storage/blocksstable/ob_sstable_meta.h
src/storage/blocksstable/ob_sstable_meta.h
+4
-2
src/storage/tablet/ob_tablet.cpp
src/storage/tablet/ob_tablet.cpp
+43
-0
src/storage/tablet/ob_tablet.h
src/storage/tablet/ob_tablet.h
+1
-0
src/storage/tablet/ob_tablet_create_delete_helper.cpp
src/storage/tablet/ob_tablet_create_delete_helper.cpp
+4
-2
未找到文件。
src/storage/blocksstable/ob_index_block_builder.cpp
浏览文件 @
ea4e6498
...
...
@@ -315,7 +315,8 @@ int ObSSTableMergeRes::fill_column_checksum(
int
ret
=
OB_SUCCESS
;
if
(
OB_UNLIKELY
(
column_default_checksum
.
empty
()
||
column_default_checksum
.
count
()
<
data_column_cnt_
))
{
ret
=
OB_INVALID_ARGUMENT
;
STORAGE_LOG
(
WARN
,
"invalid argument"
,
K
(
ret
),
K
(
column_default_checksum
),
K
(
data_column_cnt_
));
STORAGE_LOG
(
WARN
,
"invalid argument"
,
K
(
ret
),
K
(
column_default_checksum
.
count
()),
K
(
data_column_cnt_
),
K
(
column_default_checksum
));
}
else
{
if
(
OB_UNLIKELY
(
data_column_cnt_
!=
column_default_checksum
.
count
()))
{
STORAGE_LOG
(
INFO
,
"column default count doesn't equal to data column count in merge res"
,
K
(
column_default_checksum
.
count
()),
K
(
data_column_cnt_
));
...
...
src/storage/blocksstable/ob_sstable_meta.h
浏览文件 @
ea4e6498
...
...
@@ -161,7 +161,8 @@ public:
const
int64_t
data_len
,
int64_t
&
pos
);
int64_t
get_serialize_size
()
const
;
TO_STRING_KV
(
K_
(
basic_meta
),
K_
(
column_checksums
),
K_
(
data_root_info
),
K_
(
macro_info
),
KP_
(
allocator
));
TO_STRING_KV
(
K_
(
basic_meta
),
K_
(
column_checksums
),
K
(
column_checksums_
.
count
()),
K_
(
data_root_info
),
K_
(
macro_info
),
KP_
(
allocator
));
private:
bool
check_meta
()
const
;
int
init_base_meta
(
const
ObTabletCreateSSTableParam
&
param
,
common
::
ObIAllocator
*
allocator
);
...
...
@@ -198,7 +199,8 @@ public:
bool
is_valid
()
const
;
void
reset
();
int
assign
(
const
ObMigrationSSTableParam
&
param
);
TO_STRING_KV
(
K_
(
basic_meta
),
K_
(
column_checksums
),
K_
(
column_default_checksums
),
K_
(
table_key
));
TO_STRING_KV
(
K_
(
basic_meta
),
K
(
column_checksums_
.
count
()),
K
(
column_default_checksums_
.
count
()),
K_
(
column_checksums
),
K_
(
column_default_checksums
),
K_
(
table_key
));
private:
static
const
int64_t
MIGRATION_SSTABLE_PARAM_VERSION
=
1
;
typedef
common
::
ObSEArray
<
int64_t
,
common
::
OB_ROW_DEFAULT_COLUMNS_COUNT
>
ColChecksumArray
;
...
...
src/storage/tablet/ob_tablet.cpp
浏览文件 @
ea4e6498
...
...
@@ -168,6 +168,8 @@ int ObTablet::init(
LOG_WARN
(
"failed to build read info"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
pre_transform_sstable_root_block
(
*
full_read_info_
.
get_index_read_info
())))
{
LOG_WARN
(
"failed to pre-transform sstable root block"
,
K
(
ret
),
K
(
full_read_info_
));
}
else
if
(
OB_FAIL
(
check_sstable_column_checksum
()))
{
LOG_WARN
(
"failed to check sstable column checksum"
,
K
(
ret
),
KPC
(
this
));
}
else
{
is_inited_
=
true
;
LOG_INFO
(
"succeeded to init tablet"
,
K
(
ret
),
KP
(
this
),
K
(
ls_id
),
K
(
tablet_id
),
K
(
data_tablet_id
),
...
...
@@ -236,6 +238,8 @@ int ObTablet::init(
}
else
if
(
OB_FAIL
(
check_max_sync_schema_version
()))
{
LOG_WARN
(
"unexpected max sync schema version"
,
K
(
ret
),
K
(
param
),
K
(
old_tablet
),
K
(
max_sync_schema_version
),
K
(
storage_schema_
));
}
else
if
(
OB_FAIL
(
check_sstable_column_checksum
()))
{
LOG_WARN
(
"failed to check sstable column checksum"
,
K
(
ret
),
KPC
(
this
));
}
else
{
if
(
old_tablet
.
get_tablet_meta
().
has_next_tablet_
)
{
set_next_tablet_guard
(
old_tablet
.
next_tablet_guard_
);
...
...
@@ -300,6 +304,8 @@ int ObTablet::init(
LOG_WARN
(
"failed to pre-transform sstable root block"
,
K
(
ret
),
K
(
full_read_info_
));
}
else
if
(
OB_FAIL
(
check_max_sync_schema_version
()))
{
LOG_WARN
(
"unexpected max sync schema version"
,
K
(
ret
),
K
(
param
),
K
(
is_update
),
K
(
storage_schema_
));
}
else
if
(
OB_FAIL
(
check_sstable_column_checksum
()))
{
LOG_WARN
(
"failed to check sstable column checksum"
,
K
(
ret
),
KPC
(
this
));
}
else
{
is_inited_
=
true
;
LOG_INFO
(
"succeeded to init tablet"
,
K
(
ret
),
K
(
param
),
KPC
(
this
));
...
...
@@ -346,6 +352,8 @@ int ObTablet::init(
LOG_WARN
(
"fail to build read info"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
pre_transform_sstable_root_block
(
*
full_read_info_
.
get_index_read_info
())))
{
LOG_WARN
(
"failed to pre-transform sstable root block"
,
K
(
ret
),
K
(
full_read_info_
));
}
else
if
(
OB_FAIL
(
check_sstable_column_checksum
()))
{
LOG_WARN
(
"failed to check sstable column checksum"
,
K
(
ret
),
KPC
(
this
));
}
else
{
if
(
old_tablet
.
get_tablet_meta
().
has_next_tablet_
)
{
set_next_tablet_guard
(
old_tablet
.
next_tablet_guard_
);
...
...
@@ -408,6 +416,8 @@ int ObTablet::init(
LOG_WARN
(
"failed to pre-transform sstable root block"
,
K
(
ret
),
K
(
full_read_info_
));
}
else
if
(
OB_FAIL
(
check_max_sync_schema_version
()))
{
LOG_WARN
(
"unexpected max sync schema version"
,
K
(
ret
),
K
(
param
),
K
(
old_tablet
),
K
(
storage_schema_
));
}
else
if
(
OB_FAIL
(
check_sstable_column_checksum
()))
{
LOG_WARN
(
"failed to check sstable column checksum"
,
K
(
ret
),
KPC
(
this
));
}
else
{
if
(
old_tablet
.
get_tablet_meta
().
has_next_tablet_
)
{
set_next_tablet_guard
(
old_tablet
.
next_tablet_guard_
);
...
...
@@ -432,6 +442,34 @@ int ObTablet::init(
return
ret
;
}
int
ObTablet
::
check_sstable_column_checksum
()
const
{
int
ret
=
OB_SUCCESS
;
ObSEArray
<
ObITable
*
,
MAX_SSTABLE_CNT_IN_STORAGE
>
sstables
;
int64_t
schema_col_cnt
=
0
;
int64_t
sstable_col_cnt
=
0
;
if
(
OB_UNLIKELY
(
!
table_store_
.
is_valid
()
||
!
storage_schema_
.
is_valid
()))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"failed to check tablet "
,
K
(
ret
),
K
(
table_store_
),
K
(
storage_schema_
));
}
else
if
(
OB_FAIL
(
storage_schema_
.
get_stored_column_count_in_sstable
(
schema_col_cnt
)))
{
LOG_WARN
(
"failed to get stored column count of storage schema"
,
K
(
ret
),
KPC
(
this
));
}
else
if
(
OB_FAIL
(
inner_get_all_sstables
(
sstables
)))
{
LOG_WARN
(
"failed to get stored column count of storage schema"
,
K
(
ret
),
KPC
(
this
));
}
else
{
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
sstables
.
count
();
++
i
)
{
ObSSTable
*
cur
=
reinterpret_cast
<
ObSSTable
*>
(
sstables
.
at
(
i
));
if
(
OB_ISNULL
(
cur
))
{
ret
=
OB_ERR_NULL_VALUE
;
LOG_WARN
(
"invalid null sstable"
,
K
(
ret
),
K
(
i
),
KP
(
cur
),
KPC
(
this
));
}
else
if
((
sstable_col_cnt
=
cur
->
get_meta
().
get_col_checksum
().
count
())
>
schema_col_cnt
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_ERROR
(
"The storage schema is older than the sstable, and cann’t explain the data."
,
K
(
ret
),
K
(
i
),
K
(
sstable_col_cnt
),
K
(
schema_col_cnt
),
KPC
(
cur
),
K_
(
storage_schema
));
}
}
}
return
ret
;
}
int
ObTablet
::
serialize
(
char
*
buf
,
const
int64_t
len
,
int64_t
&
pos
)
{
int
ret
=
OB_SUCCESS
;
...
...
@@ -1971,6 +2009,11 @@ int ObTablet::build_migration_sstable_param(
}
else
if
(
OB_FAIL
(
ObSSTableMergeRes
::
fill_column_default_checksum_from_schema
(
&
storage_schema_
,
mig_sstable_param
.
column_default_checksums_
)))
{
LOG_WARN
(
"fail to assign column default checksums"
,
K
(
ret
),
K
(
storage_schema_
));
}
else
if
(
OB_UNLIKELY
(
mig_sstable_param
.
column_default_checksums_
.
count
()
<
mig_sstable_param
.
column_checksums_
.
count
()))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"unexpected column count"
,
K
(
ret
),
KP
(
this
),
K
(
mig_sstable_param
),
K
(
sstable_meta
),
K
(
storage_schema_
));
}
else
{
mig_sstable_param
.
table_key_
=
sstable
->
get_key
();
}
...
...
src/storage/tablet/ob_tablet.h
浏览文件 @
ea4e6498
...
...
@@ -460,6 +460,7 @@ private:
int
set_tx_data_in_tablet_pointer
(
const
ObTabletTxMultiSourceDataUnit
&
tx_data
);
int
get_max_sync_storage_schema_version
(
int64_t
&
max_schema_version
)
const
;
int
check_max_sync_schema_version
()
const
;
int
check_sstable_column_checksum
()
const
;
template
<
class
T
>
int
dec_unsynced_cnt_for_if_need
(
...
...
src/storage/tablet/ob_tablet_create_delete_helper.cpp
浏览文件 @
ea4e6498
...
...
@@ -2332,7 +2332,6 @@ int ObTabletCreateDeleteHelper::build_create_sstable_param(
param
.
data_blocks_cnt_
=
0
;
param
.
micro_block_cnt_
=
0
;
param
.
use_old_macro_block_count_
=
0
;
param
.
column_cnt_
=
table_schema
.
get_column_count
()
+
multi_version_col_cnt
;
param
.
data_checksum_
=
0
;
param
.
occupy_size_
=
0
;
param
.
ddl_scn_
.
set_min
();
...
...
@@ -2340,7 +2339,10 @@ int ObTabletCreateDeleteHelper::build_create_sstable_param(
param
.
original_size_
=
0
;
param
.
ddl_scn_
.
set_min
();
param
.
compressor_type_
=
ObCompressorType
::
NONE_COMPRESSOR
;
if
(
OB_FAIL
(
ObSSTableMergeRes
::
fill_column_checksum_for_empty_major
(
param
.
column_cnt_
,
if
(
OB_FAIL
(
table_schema
.
get_store_column_count
(
param
.
column_cnt_
,
true
/*is_full*/
)))
{
LOG_WARN
(
"fail to get stored col cnt of table schema"
,
K
(
ret
),
K
(
table_schema
));
}
else
if
(
FALSE_IT
(
param
.
column_cnt_
+=
multi_version_col_cnt
))
{
}
else
if
(
OB_FAIL
(
ObSSTableMergeRes
::
fill_column_checksum_for_empty_major
(
param
.
column_cnt_
,
param
.
column_checksums_
)))
{
LOG_WARN
(
"fail to fill column checksum for empty major"
,
K
(
ret
),
K
(
param
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录