Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
23934c96
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,发现更多精彩内容 >>
提交
23934c96
编写于
8月 12, 2021
作者:
C
chaser-ch
提交者:
wangzelin.wzl
8月 12, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix border key buf overflow problem
上级
ce5da320
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
53 addition
and
36 deletion
+53
-36
src/storage/compaction/ob_partition_merge_util.cpp
src/storage/compaction/ob_partition_merge_util.cpp
+51
-34
src/storage/compaction/ob_partition_merge_util.h
src/storage/compaction/ob_partition_merge_util.h
+2
-2
未找到文件。
src/storage/compaction/ob_partition_merge_util.cpp
浏览文件 @
23934c96
...
...
@@ -807,26 +807,30 @@ int ObMacroRowIterator::compare(const ObMacroRowIterator& other, int64_t& cmp_re
}
else
if
(
cmp_ret
<
0
)
{
cmp_ret
=
-
1
;
}
}
else
{
cmp_ret
=
compare
(
left_rowkey
,
other
.
curr_range_
);
if
(
0
==
cmp_ret
)
{
cmp_ret
=
CANNOT_COMPARE_RIGHT_IS_RANGE
;
}
}
else
if
(
OB_FAIL
(
compare
(
left_rowkey
,
other
.
curr_range_
,
cmp_ret
)))
{
STORAGE_LOG
(
WARN
,
"Failed to compare rowkey with range"
,
K
(
ret
),
K
(
left_rowkey
),
K
(
other
.
curr_range_
));
}
else
if
(
0
==
cmp_ret
)
{
cmp_ret
=
CANNOT_COMPARE_RIGHT_IS_RANGE
;
}
}
else
{
if
(
NULL
!=
other
.
curr_row_
)
{
// when doing minor merge, the only case we need to use trans version column in comparison
// is when left is a range and right is a row
right_rowkey
.
assign
(
other
.
curr_row_
->
row_val_
.
cells_
,
get_rowkey_column_cnt
());
cmp_ret
=
-
compare
(
right_rowkey
,
curr_range_
);
if
(
0
==
cmp_ret
)
{
cmp_ret
=
CANNOT_COMPARE_LEFT_IS_RANGE
;
if
(
OB_FAIL
(
compare
(
right_rowkey
,
curr_range_
,
cmp_ret
)))
{
STORAGE_LOG
(
WARN
,
"Failed to compare rowkey with range"
,
K
(
ret
),
K
(
right_rowkey
),
K
(
curr_range_
));
}
else
{
cmp_ret
=
-
cmp_ret
;
if
(
0
==
cmp_ret
)
{
cmp_ret
=
CANNOT_COMPARE_LEFT_IS_RANGE
;
}
}
}
else
{
left_rowkey
=
curr_range_
.
get_start_key
();
right_rowkey
=
curr_range_
.
get_end_key
();
cmp_ret
=
compare
(
left_rowkey
,
other
.
curr_range_
);
if
(
cmp_ret
>
0
)
{
if
(
OB_FAIL
(
compare
(
left_rowkey
,
other
.
curr_range_
,
cmp_ret
)))
{
STORAGE_LOG
(
WARN
,
"Failed to compare rowkey with range"
,
K
(
ret
),
K
(
left_rowkey
),
K
(
other
.
curr_range_
));
}
else
if
(
cmp_ret
>
0
)
{
cmp_ret
=
1
;
}
else
if
(
cmp_ret
==
0
)
{
if
(
left_rowkey
.
compare
(
other
.
curr_range_
.
get_end_key
())
==
0
&&
...
...
@@ -842,8 +846,9 @@ int ObMacroRowIterator::compare(const ObMacroRowIterator& other, int64_t& cmp_re
cmp_ret
=
CANNOT_COMPARE_RIGHT_IS_RANGE
;
}
}
else
{
cmp_ret
=
compare
(
right_rowkey
,
other
.
curr_range_
);
if
(
cmp_ret
<
0
)
{
if
(
OB_FAIL
(
compare
(
right_rowkey
,
other
.
curr_range_
,
cmp_ret
)))
{
STORAGE_LOG
(
WARN
,
"Failed to compare rowkey with range"
,
K
(
ret
),
K
(
right_rowkey
),
K
(
other
.
curr_range_
));
}
else
if
(
cmp_ret
<
0
)
{
cmp_ret
=
-
1
;
}
else
if
(
cmp_ret
==
0
)
{
if
(
right_rowkey
.
compare
(
other
.
curr_range_
.
get_start_key
())
==
0
&&
...
...
@@ -862,10 +867,16 @@ int ObMacroRowIterator::compare(const ObMacroRowIterator& other, int64_t& cmp_re
return
ret
;
}
void
ObMacroRowIterator
::
get_border_key
(
const
ObStoreRowkey
&
border_key
,
const
bool
is_start_key
,
ObStoreRowkey
&
rowkey
)
int
ObMacroRowIterator
::
get_border_key
(
const
ObStoreRowkey
&
border_key
,
const
bool
is_start_key
,
ObStoreRowkey
&
rowkey
)
{
int
ret
=
OB_SUCCESS
;
if
(
NULL
==
multi_version_row_info_
)
{
rowkey
.
assign
(
const_cast
<
ObObj
*>
(
border_key
.
get_obj_ptr
()),
border_key
.
get_obj_cnt
());
}
else
if
(
border_key
.
is_min
()
||
border_key
.
is_max
())
{
rowkey
=
border_key
;
}
else
if
(
OB_UNLIKELY
(
border_key
.
get_obj_cnt
()
<
rowkey_column_cnt_
))
{
ret
=
OB_ERR_UNEXPECTED
;
STORAGE_LOG
(
WARN
,
"Unexpected column cnt of border key"
,
K
(
ret
),
K
(
border_key
),
K_
(
rowkey_column_cnt
));
}
else
{
rowkey
.
assign
(
cells_
,
multi_version_row_info_
->
multi_version_rowkey_column_cnt_
);
for
(
int64_t
i
=
0
;
i
<
rowkey_column_cnt_
;
++
i
)
{
...
...
@@ -879,43 +890,49 @@ void ObMacroRowIterator::get_border_key(const ObStoreRowkey& border_key, const b
cells_
[
multi_version_row_info_
->
trans_version_index_
+
1
].
set_max_value
();
}
}
return
ret
;
}
int
64_t
ObMacroRowIterator
::
compare
(
const
ObStoreRowkey
&
rowkey
,
const
ObStoreRange
&
range
)
int
ObMacroRowIterator
::
compare
(
const
ObStoreRowkey
&
rowkey
,
const
ObStoreRange
&
range
,
int64_t
&
cmp_ret
)
{
int
64_t
cmp_ret
=
0
;
int
ret
=
OB_SUCCESS
;
int32_t
left_cmp
=
0
;
int32_t
right_cmp
=
0
;
cmp_ret
=
0
;
ObStoreRowkey
start_key
;
ObStoreRowkey
end_key
;
get_border_key
(
range
.
get_start_key
(),
true
,
start_key
);
left_cmp
=
rowkey
.
compare
(
start_key
);
if
(
left_cmp
<
0
)
{
cmp_ret
=
-
1
;
}
else
if
(
left_cmp
==
0
)
{
if
(
range
.
get_border_flag
().
inclusive_start
())
{
cmp_ret
=
0
;
}
else
{
cmp_ret
=
-
1
;
}
if
(
OB_FAIL
(
get_border_key
(
range
.
get_start_key
(),
true
,
start_key
)))
{
STORAGE_LOG
(
WARN
,
"Failed to get start key from border key"
,
K
(
ret
),
K
(
range
));
}
else
{
get_border_key
(
range
.
get_end_key
(),
false
,
end_key
);
right_cmp
=
rowkey
.
compare
(
end_key
);
if
(
right_cmp
>
0
)
{
cmp_ret
=
1
;
}
else
if
(
right_cmp
==
0
)
{
if
(
range
.
get_border_flag
().
inclusive_end
())
{
left_cmp
=
rowkey
.
compare
(
start_key
);
if
(
left_cmp
<
0
)
{
cmp_ret
=
-
1
;
}
else
if
(
left_cmp
==
0
)
{
if
(
range
.
get_border_flag
().
inclusive_start
())
{
cmp_ret
=
0
;
}
else
{
cmp_ret
=
1
;
cmp_ret
=
-
1
;
}
}
else
if
(
OB_FAIL
(
get_border_key
(
range
.
get_end_key
(),
false
,
end_key
)))
{
STORAGE_LOG
(
WARN
,
"Failed to get end key from border key"
,
K
(
ret
),
K
(
range
));
}
else
{
cmp_ret
=
0
;
right_cmp
=
rowkey
.
compare
(
end_key
);
if
(
right_cmp
>
0
)
{
cmp_ret
=
1
;
}
else
if
(
right_cmp
==
0
)
{
if
(
range
.
get_border_flag
().
inclusive_end
())
{
cmp_ret
=
0
;
}
else
{
cmp_ret
=
1
;
}
}
else
{
cmp_ret
=
0
;
}
}
}
return
cmp_
ret
;
return
ret
;
}
int
ObMacroRowIterator
::
multi_version_compare
(
const
ObMacroRowIterator
&
other
,
int64_t
&
cmp_ret
)
...
...
src/storage/compaction/ob_partition_merge_util.h
浏览文件 @
23934c96
...
...
@@ -340,8 +340,8 @@ public:
static
const
int64_t
CANNOT_COMPARE_BOTH_ARE_RANGE
=
3
;
protected:
int
64_t
compare
(
const
common
::
ObStoreRowkey
&
rowkey
,
const
common
::
ObStoreRange
&
range
);
void
get_border_key
(
const
common
::
ObStoreRowkey
&
border_key
,
const
bool
is_start_key
,
common
::
ObStoreRowkey
&
rowkey
);
int
compare
(
const
common
::
ObStoreRowkey
&
rowkey
,
const
common
::
ObStoreRange
&
range
,
int64_t
&
cmp_ret
);
int
get_border_key
(
const
common
::
ObStoreRowkey
&
border_key
,
const
bool
is_start_key
,
common
::
ObStoreRowkey
&
rowkey
);
protected:
int
next_range
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录