Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
野花太放肆
oceanbase
提交
a9d79d2a
O
oceanbase
项目概览
野花太放肆
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
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,体验更适合开发者的 AI 搜索 >>
提交
a9d79d2a
编写于
2月 14, 2023
作者:
O
obdev
提交者:
ob-robot
2月 14, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[BUGFIX]fix lob bugs
上级
fdee1d29
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
59 addition
and
25 deletion
+59
-25
deps/oblib/src/common/object/ob_object.cpp
deps/oblib/src/common/object/ob_object.cpp
+34
-19
deps/oblib/src/common/object/ob_object.h
deps/oblib/src/common/object/ob_object.h
+1
-1
src/share/ob_lob_access_utils.cpp
src/share/ob_lob_access_utils.cpp
+13
-4
src/share/ob_lob_access_utils.h
src/share/ob_lob_access_utils.h
+3
-1
src/sql/rewrite/ob_query_range.cpp
src/sql/rewrite/ob_query_range.cpp
+8
-0
未找到文件。
deps/oblib/src/common/object/ob_object.cpp
浏览文件 @
a9d79d2a
...
...
@@ -485,7 +485,7 @@ int ObLobLocatorV2:: get_mem_locator(ObMemLobCommon *&mem_loc) const
{
validate_has_lob_header
(
has_lob_header_
);
int
ret
=
OB_SUCCESS
;
if
(
OB_UNLIKELY
(
!
has_lob_header_
))
{
if
(
OB_UNLIKELY
(
!
has_lob_header_
||
size_
==
0
||
OB_ISNULL
(
ptr_
)
))
{
ret
=
OB_ERR_NULL_VALUE
;
}
else
if
(
is_lob_disk_locator
())
{
ret
=
OB_ERR_NULL_VALUE
;
...
...
@@ -500,7 +500,7 @@ int ObLobLocatorV2::get_extern_header(ObMemLobExternHeader *&extern_header) cons
validate_has_lob_header
(
has_lob_header_
);
int
ret
=
OB_SUCCESS
;
ObMemLobCommon
*
loc
=
reinterpret_cast
<
ObMemLobCommon
*>
(
ptr_
);
if
(
OB_UNLIKELY
(
!
has_lob_header_
))
{
if
(
OB_UNLIKELY
(
!
has_lob_header_
||
size_
==
0
||
OB_ISNULL
(
ptr_
)
))
{
ret
=
OB_ERR_NULL_VALUE
;
}
else
if
(
is_lob_disk_locator
())
{
ret
=
OB_ERR_NULL_VALUE
;
...
...
@@ -531,7 +531,7 @@ int ObLobLocatorV2::get_disk_locator(ObLobCommon *&disk_loc) const
validate_has_lob_header
(
has_lob_header_
);
int
ret
=
OB_SUCCESS
;
ObMemLobCommon
*
loc
=
reinterpret_cast
<
ObMemLobCommon
*>
(
ptr_
);
if
(
OB_UNLIKELY
(
!
has_lob_header_
))
{
if
(
OB_UNLIKELY
(
!
has_lob_header_
||
size_
==
0
||
OB_ISNULL
(
ptr_
)
))
{
ret
=
OB_ERR_NULL_VALUE
;
COMMON_LOG
(
WARN
,
"Lob: try to get disk locator without lob header"
,
K
(
ret
));
}
else
if
(
is_lob_disk_locator
())
{
...
...
@@ -576,8 +576,11 @@ int ObLobLocatorV2::get_inrow_data(ObString &inrow_data) const
int
ret
=
OB_SUCCESS
;
ObString
disk_loc_buff
;
ObMemLobCommon
*
loc
=
reinterpret_cast
<
ObMemLobCommon
*>
(
ptr_
);
if
(
!
has_lob_header_
)
{
if
(
!
has_lob_header_
||
size_
==
0
)
{
inrow_data
.
assign_ptr
(
ptr_
,
size_
);
}
else
if
(
OB_ISNULL
(
ptr_
))
{
ret
=
OB_ERR_UNEXPECTED
;
COMMON_LOG
(
WARN
,
"Lob: get null ptr"
,
K
(
ret
),
K
(
size_
),
K
(
ptr_
));
}
else
if
(
!
is_lob_disk_locator
()
&&
loc
->
is_simple
())
{
inrow_data
.
assign_ptr
(
ptr_
+
MEM_LOB_COMMON_HEADER_LEN
,
size_
-
MEM_LOB_COMMON_HEADER_LEN
);
}
else
if
(
OB_FAIL
(
get_disk_locator
(
disk_loc_buff
)))
{
...
...
@@ -610,7 +613,7 @@ bool ObLobLocatorV2::is_inrow() const
bool
bret
=
false
;
ObString
disk_loc_buff
;
ObMemLobCommon
*
loc
=
reinterpret_cast
<
ObMemLobCommon
*>
(
ptr_
);
if
(
!
has_lob_header_
)
{
if
(
!
has_lob_header_
||
size_
==
0
||
OB_ISNULL
(
ptr_
)
)
{
bret
=
true
;
}
else
if
(
!
is_lob_disk_locator
()
&&
loc
->
is_simple
())
{
bret
=
true
;
...
...
@@ -629,7 +632,7 @@ bool ObLobLocatorV2::is_empty_lob() const
bool
bret
=
false
;
ObString
disk_loc_buff
;
ObMemLobCommon
*
loc
=
reinterpret_cast
<
ObMemLobCommon
*>
(
ptr_
);
if
(
!
has_lob_header_
||
size_
==
0
)
{
if
(
!
has_lob_header_
||
size_
==
0
||
OB_ISNULL
(
ptr_
)
)
{
bret
=
(
size_
==
0
);
}
else
if
(
!
is_lob_disk_locator
()
&&
loc
->
is_simple
())
{
bret
=
(
size_
-
MEM_LOB_COMMON_HEADER_LEN
==
0
);
...
...
@@ -649,7 +652,7 @@ int ObLobLocatorV2::get_lob_data_byte_len(int64_t &len) const
int
ret
=
OB_SUCCESS
;
ObString
disk_loc_buff
;
ObMemLobCommon
*
loc
=
reinterpret_cast
<
ObMemLobCommon
*>
(
ptr_
);
if
(
!
has_lob_header_
)
{
if
(
!
has_lob_header_
||
size_
==
0
||
OB_ISNULL
(
ptr_
)
)
{
len
=
size_
;
}
else
if
(
!
is_lob_disk_locator
()
&&
loc
->
is_simple
())
{
len
=
size_
-
MEM_LOB_COMMON_HEADER_LEN
;
...
...
@@ -713,7 +716,7 @@ int ObLobLocatorV2::get_real_locator_len(int64_t &real_len) const
ObLobCommon
*
disk_loc
=
NULL
;
ObMemLobCommon
*
loc
=
reinterpret_cast
<
ObMemLobCommon
*>
(
ptr_
);
real_len
=
size_
;
if
(
!
has_lob_header_
)
{
if
(
!
has_lob_header_
||
size_
==
0
||
OB_ISNULL
(
ptr_
)
)
{
}
else
if
(
!
is_lob_disk_locator
()
&&
loc
->
is_simple_
)
{
}
else
if
(
OB_FAIL
(
get_disk_locator
(
disk_loc
)))
{
COMMON_LOG
(
WARN
,
"Lob: get disk locator failed"
,
K
(
ret
),
K
(
*
this
));
...
...
@@ -733,16 +736,23 @@ int ObLobLocatorV2::set_payload_data(const ObString& payload)
OB_ASSERT
(
has_lob_header_
);
// only used in build_lob_locator_v2, must has lob header
int
ret
=
OB_SUCCESS
;
ObMemLobCommon
*
loc
=
reinterpret_cast
<
ObMemLobCommon
*>
(
ptr_
);
OB_ASSERT
(
loc
->
lob_common_
.
is_mem_loc_
==
1
);
uint32_t
buf_len
=
size_
-
(
loc
->
data_
-
ptr_
);
if
(
!
loc
->
has_extern
())
{
OB_ASSERT
(
payload
.
length
()
==
buf_len
);
// debug
MEMCPY
(
loc
->
data_
,
payload
.
ptr
(),
buf_len
);
if
(
size_
==
0
||
OB_ISNULL
(
ptr_
))
{
ret
=
OB_ERR_UNEXPECTED
;
COMMON_LOG
(
WARN
,
"Lob: get null ptr"
,
K
(
ret
),
K
(
size_
),
K
(
ptr_
));
}
else
if
(
loc
->
lob_common_
.
is_mem_loc_
!=
1
)
{
ret
=
OB_ERR_UNEXPECTED
;
COMMON_LOG
(
WARN
,
"Lob: get disk loc"
,
K
(
ret
),
K
(
loc
->
lob_common_
));
}
else
{
ObString
disk_loc_buff
;
if
(
OB_SUCC
(
get_disk_locator
(
disk_loc_buff
)))
{
OB_ASSERT
(
payload
.
length
()
==
disk_loc_buff
.
length
());
MEMCPY
(
disk_loc_buff
.
ptr
(),
payload
.
ptr
(),
disk_loc_buff
.
length
());
uint32_t
buf_len
=
size_
-
(
loc
->
data_
-
ptr_
);
if
(
!
loc
->
has_extern
())
{
OB_ASSERT
(
payload
.
length
()
==
buf_len
);
// debug
MEMCPY
(
loc
->
data_
,
payload
.
ptr
(),
buf_len
);
}
else
{
ObString
disk_loc_buff
;
if
(
OB_SUCC
(
get_disk_locator
(
disk_loc_buff
)))
{
OB_ASSERT
(
payload
.
length
()
==
disk_loc_buff
.
length
());
MEMCPY
(
disk_loc_buff
.
ptr
(),
payload
.
ptr
(),
disk_loc_buff
.
length
());
}
}
}
return
ret
;
...
...
@@ -754,8 +764,13 @@ int ObLobLocatorV2::set_payload_data(const ObLobCommon *lob_comm, const ObString
int
ret
=
OB_SUCCESS
;
uint32_t
buf_len
=
0
;
ObMemLobCommon
*
loc
=
reinterpret_cast
<
ObMemLobCommon
*>
(
ptr_
);
OB_ASSERT
(
loc
->
lob_common_
.
is_mem_loc_
==
1
);
if
(
loc
->
is_simple
())
{
if
(
size_
==
0
||
OB_ISNULL
(
ptr_
))
{
ret
=
OB_ERR_UNEXPECTED
;
COMMON_LOG
(
WARN
,
"Lob: get null ptr"
,
K
(
ret
),
K
(
size_
),
K
(
ptr_
));
}
else
if
(
loc
->
lob_common_
.
is_mem_loc_
!=
1
)
{
ret
=
OB_ERR_UNEXPECTED
;
COMMON_LOG
(
WARN
,
"Lob: get disk loc"
,
K
(
ret
),
K
(
loc
->
lob_common_
));
}
else
if
(
loc
->
is_simple
())
{
buf_len
=
size_
-
(
loc
->
data_
-
ptr_
);
OB_ASSERT
(
payload
.
length
()
<=
buf_len
);
if
(
payload
.
length
()
>
0
)
{
...
...
deps/oblib/src/common/object/ob_object.h
浏览文件 @
a9d79d2a
...
...
@@ -968,7 +968,7 @@ public:
OB_INLINE
bool
has_inrow_data
()
const
{
bool
bret
=
false
;
if
(
!
has_lob_header_
)
{
if
(
!
has_lob_header_
||
size_
==
0
)
{
bret
=
true
;
}
else
if
(
OB_NOT_NULL
(
ptr_
))
{
if
(
is_lob_disk_locator
())
{
...
...
src/share/ob_lob_access_utils.cpp
浏览文件 @
a9d79d2a
...
...
@@ -922,7 +922,9 @@ int ObTextStringIter::append_outrow_lob_fulldata(ObObj &obj,
int
ObTextStringIter
::
convert_outrow_lob_to_inrow_templob
(
const
ObObj
&
in_obj
,
ObObj
&
out_obj
,
const
sql
::
ObBasicSessionInfo
*
session
,
ObIAllocator
*
allocator
)
ObIAllocator
*
allocator
,
bool
allow_persist_inrow
,
bool
need_deep_copy
)
{
int
ret
=
OB_SUCCESS
;
ObObjType
type
=
in_obj
.
get_type
();
...
...
@@ -938,7 +940,8 @@ int ObTextStringIter::convert_outrow_lob_to_inrow_templob(const ObObj &in_obj,
if
(
!
loc
.
is_valid
())
{
ret
=
OB_INVALID_ARGUMENT
;
COMMON_LOG
(
WARN
,
"Lob: invalid lob loc"
,
K
(
ret
),
K
(
loc
),
K
(
in_obj
));
}
else
if
(
!
loc
.
is_persist_lob
()
&&
(
loc
.
is_inrow
()
||
loc
.
is_simple
()))
{
// do nothing
}
else
if
((
!
loc
.
is_persist_lob
()
||
allow_persist_inrow
)
&&
(
loc
.
is_inrow
()
||
loc
.
is_simple
()))
{
// do nothing
}
else
if
(
loc
.
is_delta_temp_lob
())
{
ret
=
OB_INVALID_ARGUMENT
;
COMMON_LOG
(
WARN
,
"Lob: converting delta lob!"
,
K
(
ret
));
...
...
@@ -982,7 +985,13 @@ int ObTextStringIter::convert_outrow_lob_to_inrow_templob(const ObObj &in_obj,
}
if
(
OB_SUCC
(
ret
)
&&
is_pass_thougth
)
{
out_obj
=
in_obj
;
if
(
need_deep_copy
)
{
if
(
OB_FAIL
(
ob_write_obj
(
*
allocator
,
in_obj
,
out_obj
)))
{
LOG_WARN
(
"do deepy copy obj failed."
,
K
(
ret
),
K
(
in_obj
));
}
}
else
{
out_obj
=
in_obj
;
}
}
}
return
ret
;
...
...
@@ -1053,7 +1062,7 @@ int ObTextStringResult::init(int64_t res_len, ObIAllocator *allocator)
if
(
OB_NOT_NULL
(
buffer_
)
||
is_init_
)
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"Lob: textstring result init already"
,
K
(
ret
),
K
(
*
this
));
}
else
if
(
!
(
ob_is_string_or_lob_type
(
type_
)
||
ob_is_json
(
type_
)))
{
}
else
if
(
!
(
ob_is_string_or_lob_type
(
type_
)
||
is_lob_storage
(
type_
)))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"Lob: unexpected expr result type for textstring result"
,
K
(
ret
),
K
(
type_
));
}
else
if
(
OB_FAIL
(
calc_buffer_len
(
res_len
)))
{
...
...
src/share/ob_lob_access_utils.h
浏览文件 @
a9d79d2a
...
...
@@ -178,7 +178,9 @@ public:
static
int
convert_outrow_lob_to_inrow_templob
(
const
ObObj
&
in_obj
,
ObObj
&
out_obj
,
const
sql
::
ObBasicSessionInfo
*
session
,
ObIAllocator
*
allocator
);
ObIAllocator
*
allocator
,
bool
allow_persist_inrow
=
false
,
bool
need_deep_copy
=
false
);
private:
int
get_outrow_lob_full_data
();
...
...
src/sql/rewrite/ob_query_range.cpp
浏览文件 @
a9d79d2a
...
...
@@ -5970,6 +5970,10 @@ int ObQueryRange::get_result_value(ObObj &val, ObExecContext &exec_ctx, ObIAlloc
val
=
phy_ctx
->
get_param_store
().
at
(
param_idx
);
if
(
val
.
is_nop_value
())
{
ret
=
OB_ERR_NOP_VALUE
;
}
else
if
(
val
.
is_lob_storage
())
{
if
(
OB_FAIL
(
ObTextStringIter
::
convert_outrow_lob_to_inrow_templob
(
val
,
val
,
NULL
,
&
res_allocator
,
true
)))
{
LOG_WARN
(
"fail to convert to inrow lob"
,
K
(
ret
),
K
(
val
));
}
}
}
}
else
if
(
OB_ISNULL
(
temp_expr
=
expr_final_infos_
.
at
(
expr_idx
).
temp_expr_
))
{
...
...
@@ -5979,6 +5983,10 @@ int ObQueryRange::get_result_value(ObObj &val, ObExecContext &exec_ctx, ObIAlloc
LOG_WARN
(
"failed to eval temp expr"
,
K
(
ret
));
}
else
if
(
result
.
is_nop_value
())
{
ret
=
OB_ERR_NOP_VALUE
;
}
else
if
(
result
.
is_lob_storage
())
{
if
(
OB_FAIL
(
ObTextStringIter
::
convert_outrow_lob_to_inrow_templob
(
result
,
val
,
NULL
,
&
res_allocator
,
true
,
true
)))
{
LOG_WARN
(
"fail to convert to inrow lob"
,
K
(
ret
),
K
(
result
));
}
}
else
if
(
OB_FAIL
(
ob_write_obj
(
res_allocator
,
result
,
val
)))
{
LOG_WARN
(
"failed to write obj"
,
K
(
result
),
K
(
ret
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录