Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bb28e3a5
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bb28e3a5
编写于
8月 19, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-6233]<enhance>: make column compression threshold user configurable
上级
49925ccc
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
21 addition
and
17 deletion
+21
-17
src/client/src/tscServer.c
src/client/src/tscServer.c
+5
-2
src/common/src/tglobal.c
src/common/src/tglobal.c
+9
-10
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-3
src/query/src/queryMain.c
src/query/src/queryMain.c
+6
-2
未找到文件。
src/client/src/tscServer.c
浏览文件 @
bb28e3a5
...
...
@@ -2678,7 +2678,7 @@ int tscProcessQueryRsp(SSqlObj *pSql) {
return
0
;
}
static
void
decompressQueryColData
(
SSql
Res
*
pRes
,
SQueryInfo
*
pQueryInfo
,
char
**
data
,
int8_t
compressed
,
in
t
compLen
)
{
static
void
decompressQueryColData
(
SSql
Obj
*
pSql
,
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
,
char
**
data
,
int8_t
compressed
,
int32_
t
compLen
)
{
int32_t
decompLen
=
0
;
int32_t
numOfCols
=
pQueryInfo
->
fieldsInfo
.
numOfOutput
;
int32_t
*
compSizes
;
...
...
@@ -2715,6 +2715,9 @@ static void decompressQueryColData(SSqlRes *pRes, SQueryInfo* pQueryInfo, char *
pData
=
*
data
+
compLen
+
numOfCols
*
sizeof
(
int32_t
);
}
tscDebug
(
"0x%"
PRIx64
" decompress col data, compressed size:%d, decompressed size:%d"
,
pSql
->
self
,
(
int32_t
)(
compLen
+
numOfCols
*
sizeof
(
int32_t
)),
decompLen
);
int32_t
tailLen
=
pRes
->
rspLen
-
sizeof
(
SRetrieveTableRsp
)
-
decompLen
;
memmove
(
*
data
+
decompLen
,
pData
,
tailLen
);
memmove
(
*
data
,
outputBuf
,
decompLen
);
...
...
@@ -2749,7 +2752,7 @@ int tscProcessRetrieveRspFromNode(SSqlObj *pSql) {
//Decompress col data if compressed from server
if
(
pRetrieve
->
compressed
)
{
int32_t
compLen
=
htonl
(
pRetrieve
->
compLen
);
decompressQueryColData
(
pRes
,
pQueryInfo
,
&
pRes
->
data
,
pRetrieve
->
compressed
,
compLen
);
decompressQueryColData
(
p
Sql
,
p
Res
,
pQueryInfo
,
&
pRes
->
data
,
pRetrieve
->
compressed
,
compLen
);
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
...
...
src/common/src/tglobal.c
浏览文件 @
bb28e3a5
...
...
@@ -76,12 +76,11 @@ int32_t tsMaxBinaryDisplayWidth = 30;
int32_t
tsCompressMsgSize
=
-
1
;
/* denote if server needs to compress the retrieved column data before adding to the rpc response message body.
* 0: disable column data compression
* 1: enable column data compression
* This option is default to disabled. Once enabled, compression will be conducted if any column has size more
* than QUERY_COMP_THRESHOLD. Otherwise, no further compression is needed.
* 0: all data are compressed
* -1: all data are not compressed
* other values: if the any retrieved column size is greater than the tsCompressColData, all data will be compressed.
*/
int32_t
tsCompressColData
=
0
;
int32_t
tsCompressColData
=
-
1
;
// client
int32_t
tsMaxSQLStringLen
=
TSDB_MAX_ALLOWED_SQL_LEN
;
...
...
@@ -1006,10 +1005,10 @@ static void doInitGlobalConfig(void) {
cfg
.
option
=
"compressColData"
;
cfg
.
ptr
=
&
tsCompressColData
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT
8
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
1
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT
32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_
CLIENT
|
TSDB_CFG_CTYPE_B_
SHOW
;
cfg
.
minValue
=
-
1
;
cfg
.
maxValue
=
1
00000000
.
0
f
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
...
...
src/query/inc/qExecutor.h
浏览文件 @
bb28e3a5
...
...
@@ -43,9 +43,7 @@ typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int
#define GET_NUM_OF_RESULTS(_r) (((_r)->outputBuf) == NULL? 0:((_r)->outputBuf)->info.rows)
//TODO: may need to fine tune this threshold
#define QUERY_COMP_THRESHOLD (1024 * 512)
#define NEEDTO_COMPRESS_QUERY(size) ((size) > QUERY_COMP_THRESHOLD ? 1 : 0)
#define NEEDTO_COMPRESS_QUERY(size) ((size) > tsCompressColData? 1 : 0)
enum
{
// when query starts to execute, this status will set
...
...
src/query/src/queryMain.c
浏览文件 @
bb28e3a5
...
...
@@ -357,7 +357,7 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
}
(
*
pRsp
)
->
precision
=
htons
(
pQueryAttr
->
precision
);
(
*
pRsp
)
->
compressed
=
(
int8_t
)(
tsCompressColData
&&
checkNeedToCompressQueryCol
(
pQInfo
));
(
*
pRsp
)
->
compressed
=
(
int8_t
)(
(
tsCompressColData
!=
-
1
)
&&
checkNeedToCompressQueryCol
(
pQInfo
));
if
(
GET_NUM_OF_RESULTS
(
&
(
pQInfo
->
runtimeEnv
))
>
0
&&
pQInfo
->
code
==
TSDB_CODE_SUCCESS
)
{
doDumpQueryResult
(
pQInfo
,
(
*
pRsp
)
->
data
,
(
*
pRsp
)
->
compressed
,
&
compLen
);
...
...
@@ -367,8 +367,12 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
if
((
*
pRsp
)
->
compressed
&&
compLen
!=
0
)
{
int32_t
numOfCols
=
pQueryAttr
->
pExpr2
?
pQueryAttr
->
numOfExpr2
:
pQueryAttr
->
numOfOutput
;
*
contLen
=
*
contLen
-
pQueryAttr
->
resultRowSize
*
s
+
compLen
+
numOfCols
*
sizeof
(
int32_t
);
int32_t
origSize
=
pQueryAttr
->
resultRowSize
*
s
;
int32_t
compSize
=
compLen
+
numOfCols
*
sizeof
(
int32_t
);
*
contLen
=
*
contLen
-
origSize
+
compSize
;
*
pRsp
=
(
SRetrieveTableRsp
*
)
rpcReallocCont
(
*
pRsp
,
*
contLen
);
qDebug
(
"QInfo:0x%"
PRIx64
" compress col data, uncompressed size:%d, compressed size:%d, ratio:%.2f
\n
"
,
pQInfo
->
qId
,
origSize
,
compSize
,
(
float
)
origSize
/
(
float
)
compSize
);
}
(
*
pRsp
)
->
compLen
=
htonl
(
compLen
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录