Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
野花太放肆
oceanbase
提交
674e87b4
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 搜索 >>
提交
674e87b4
编写于
3月 27, 2023
作者:
O
obdev
提交者:
ob-robot
3月 27, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the truncation of COMMENT sql
上级
2050d2a8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
23 deletion
+17
-23
deps/oblib/src/lib/utility/ob_print_utils.h
deps/oblib/src/lib/utility/ob_print_utils.h
+14
-14
deps/oblib/unittest/lib/utility/test_print_utils.cpp
deps/oblib/unittest/lib/utility/test_print_utils.cpp
+1
-7
src/sql/engine/expr/ob_expr.h
src/sql/engine/expr/ob_expr.h
+2
-2
未找到文件。
deps/oblib/src/lib/utility/ob_print_utils.h
浏览文件 @
674e87b4
...
...
@@ -147,11 +147,11 @@ public:
class
CStringBufMgr
{
public:
static
const
int
BUF_SIZE
=
8
*
1024
;
static
const
int
MIN_
REST_SIZE
=
1024
;
static
const
int
BUF_SIZE
=
32
*
1024
;
static
const
int
MIN_
SIZE
=
12
*
1024
;
struct
BufNode
{
char
buf_
[
BUF
_SIZE
];
char
buf_
[
MIN
_SIZE
];
int64_t
level_
;
struct
BufNode
*
next_
;
};
...
...
@@ -169,17 +169,19 @@ public:
}
void
inc_level
()
{
level_
++
;
}
void
dec_level
()
{
level_
--
;
}
int64_t
get_pos
()
{
return
pos_
;
}
void
set_pos
(
int64_t
pos
)
void
update_position
(
int64_t
pos
)
{
if
(
0
==
level_
)
{
if
(
MIN_REST_SIZE
>
BUF_SIZE
-
pos
)
{
pos_
+=
pos
;
if
(
MIN_SIZE
>
BUF_SIZE
-
pos_
)
{
pos_
=
0
;
}
else
{
pos_
=
pos
;
}
}
}
int64_t
get_buffer_len
()
{
return
0
==
level_
?
(
BUF_SIZE
-
pos_
)
:
MIN_SIZE
;
}
char
*
acquire
()
{
char
*
buffer
=
NULL
;
...
...
@@ -235,15 +237,14 @@ const char *to_cstring(const T &obj, const bool verbose)
if
(
OB_ISNULL
(
buffer
))
{
LIB_LOG_RET
(
ERROR
,
OB_ALLOCATE_MEMORY_FAILED
,
"buffer is NULL"
);
}
else
{
int64_t
pos
=
mgr
.
get_pos
();
const
int64_t
buf_len
=
CStringBufMgr
::
BUF_SIZE
-
pos
;
const
int64_t
buf_len
=
mgr
.
get_buffer_len
();
str_len
=
obj
.
to_string
(
buffer
,
buf_len
-
1
,
verbose
);
if
(
str_len
>=
0
&&
str_len
<
buf_len
)
{
buffer
[
str_len
]
=
'\0'
;
}
else
{
buffer
[
0
]
=
'\0'
;
}
mgr
.
set_pos
(
pos
+
str_len
+
1
);
mgr
.
update_position
(
str_len
+
1
);
}
mgr
.
try_clear_list
();
mgr
.
dec_level
();
...
...
@@ -261,15 +262,14 @@ const char *to_cstring(const T &obj, FalseType)
if
(
OB_ISNULL
(
buffer
))
{
LIB_LOG_RET
(
ERROR
,
OB_ALLOCATE_MEMORY_FAILED
,
"buffer is NULL"
);
}
else
{
int64_t
pos
=
mgr
.
get_pos
();
const
int64_t
buf_len
=
CStringBufMgr
::
BUF_SIZE
-
pos
;
const
int64_t
buf_len
=
mgr
.
get_buffer_len
();
str_len
=
to_string
(
obj
,
buffer
,
buf_len
-
1
);
if
(
str_len
>=
0
&&
str_len
<
buf_len
)
{
buffer
[
str_len
]
=
'\0'
;
}
else
{
buffer
[
0
]
=
'\0'
;
}
mgr
.
set_pos
(
pos
+
str_len
+
1
);
mgr
.
update_position
(
str_len
+
1
);
}
mgr
.
try_clear_list
();
mgr
.
dec_level
();
...
...
deps/oblib/unittest/lib/utility/test_print_utils.cpp
浏览文件 @
674e87b4
...
...
@@ -108,18 +108,12 @@ TEST(print_utility, to_cstring)
to_cstring
(
*
tuples
[
0
]),
to_cstring
(
*
tuples
[
1
]),
to_cstring
(
*
tuples
[
2
]));
_OB_LOG
(
INFO
,
"print tuple string, {%s}, {%s}, {%s}, {%s}, {%s}, {%s}, {%s}"
,
to_cstring
(
*
tuples
[
3
]),
to_cstring
(
*
tuples
[
4
]),
to_cstring
(
*
tuples
[
5
]),
to_cstring
(
*
tuples
[
6
]),
to_cstring
(
*
tuples
[
7
]),
to_cstring
(
*
tuples
[
8
]),
to_cstring
(
*
tuples
[
9
]));
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
int64_t
pos
=
CStringBufMgr
::
get_thread_local_instance
().
get_pos
();
_OB_LOG
(
INFO
,
"print tuple string, pos = %ld
\n
"
,
pos
);
to_cstring
(
*
tuples
[
0
]);
}
// the performance of to_cstring when observer reach memory limit
EventItem
item
;
item
.
trigger_freq_
=
1
;
item
.
error_code_
=
OB_ALLOCATE_MEMORY_FAILED
;
::
oceanbase
::
common
::
EventTable
::
instance
().
set_event
(
EventTable
::
EN_4
,
item
);
int64_t
pos
=
CStringBufMgr
::
get_thread_local_instance
().
get_pos
();
_OB_LOG
(
INFO
,
"print tuple string, {%s}, pos = %ld
\n
"
,
to_cstring
(
*
tuples
[
0
]),
pos
);
_OB_LOG
(
INFO
,
"print tuple string, {%s}
\n
"
,
to_cstring
(
*
tuples
[
0
]));
}
int
main
(
int
argc
,
char
**
argv
)
...
...
src/sql/engine/expr/ob_expr.h
浏览文件 @
674e87b4
...
...
@@ -1120,8 +1120,7 @@ inline const char *get_vectorized_row_str(ObEvalCtx &eval_ctx,
if
(
OB_ISNULL
(
buffer
))
{
LIB_LOG_RET
(
ERROR
,
OB_ALLOCATE_MEMORY_FAILED
,
"buffer is NULL"
);
}
else
{
int64_t
pos
=
mgr
.
get_pos
();
const
int64_t
buf_len
=
CStringBufMgr
::
BUF_SIZE
-
pos
;
const
int64_t
buf_len
=
mgr
.
get_buffer_len
();
databuff_printf
(
buffer
,
buf_len
,
str_len
,
"vectorized_rows(%ld)="
,
index
);
str_len
+=
to_string
(
ROWEXPR2STR
(
eval_ctx
,
exprs
),
buffer
+
str_len
,
buf_len
-
str_len
-
1
);
if
(
str_len
>=
0
&&
str_len
<
buf_len
)
{
...
...
@@ -1129,6 +1128,7 @@ inline const char *get_vectorized_row_str(ObEvalCtx &eval_ctx,
}
else
{
buffer
[
0
]
=
'\0'
;
}
mgr
.
update_position
(
str_len
+
1
);
}
mgr
.
try_clear_list
();
mgr
.
dec_level
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录