Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b4a43079
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
b4a43079
编写于
9月 21, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
1549819b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
101 addition
and
25 deletion
+101
-25
include/util/tcompression.h
include/util/tcompression.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbDiskData.c
source/dnode/vnode/src/tsdb/tsdbDiskData.c
+93
-15
source/util/src/tcompression.c
source/util/src/tcompression.c
+7
-9
未找到文件。
include/util/tcompression.h
浏览文件 @
b4a43079
...
...
@@ -130,7 +130,7 @@ typedef struct SCompressor SCompressor;
int32_t
tCompressorCreate
(
SCompressor
**
ppCmprsor
);
int32_t
tCompressorDestroy
(
SCompressor
*
pCmprsor
);
int32_t
tCompressorReset
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
,
int8_t
autoAlloc
);
int32_t
tCompressorReset
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
);
int32_t
tCompGen
(
SCompressor
*
pCmprsor
,
const
uint8_t
**
ppData
,
int64_t
*
nData
);
int32_t
tCompress
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int64_t
nData
);
...
...
source/dnode/vnode/src/tsdb/tsdbDiskData.c
浏览文件 @
b4a43079
...
...
@@ -22,6 +22,7 @@ struct SDiskCol {
int16_t
cid
;
int8_t
type
;
int8_t
flag
;
uint8_t
cmprAlg
;
int32_t
nVal
;
uint8_t
*
pBitMap
;
int32_t
offset
;
...
...
@@ -30,16 +31,41 @@ struct SDiskCol {
};
// SDiskCol ================================================
static
int32_t
tDiskCol
Rese
t
(
SDiskCol
*
pDiskCol
,
int16_t
cid
,
int8_t
type
,
uint8_t
cmprAlg
)
{
static
int32_t
tDiskCol
Ini
t
(
SDiskCol
*
pDiskCol
,
int16_t
cid
,
int8_t
type
,
uint8_t
cmprAlg
)
{
int32_t
code
=
0
;
pDiskCol
->
cid
=
cid
;
pDiskCol
->
type
=
type
;
pDiskCol
->
flag
=
0
;
pDiskCol
->
cmprAlg
=
cmprAlg
;
pDiskCol
->
nVal
=
0
;
pDiskCol
->
offset
=
0
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
if
(
pDiskCol
->
pOffC
==
NULL
)
{
code
=
tCompressorCreate
(
&
pDiskCol
->
pOffC
);
if
(
code
)
return
code
;
}
code
=
tCompressorReset
(
pDiskCol
->
pOffC
,
TSDB_DATA_TYPE_INT
,
cmprAlg
);
if
(
code
)
return
code
;
}
if
(
pDiskCol
->
pValC
==
NULL
)
{
code
=
tCompressorCreate
(
&
pDiskCol
->
pValC
);
if
(
code
)
return
code
;
}
code
=
tCompressorReset
(
pDiskCol
->
pValC
,
type
,
cmprAlg
);
if
(
code
)
return
code
;
return
code
;
}
static
int32_t
tDiskColClear
(
SDiskCol
*
pDiskCol
)
{
int32_t
code
=
0
;
tCompressorReset
(
pDiskCol
->
pOffC
,
TSDB_DATA_TYPE_INT
,
cmprAlg
,
1
);
tCompressorReset
(
pDiskCol
->
pValC
,
type
,
cmprAlg
,
1
);
tFree
(
pDiskCol
->
pBitMap
);
if
(
pDiskCol
->
pOffC
)
tCompressorDestroy
(
pDiskCol
->
pOffC
);
if
(
pDiskCol
->
pValC
)
tCompressorDestroy
(
pDiskCol
->
pValC
);
return
code
;
}
...
...
@@ -324,26 +350,78 @@ struct SDiskData {
SArray
*
aDiskCol
;
};
int32_t
tDiskData
Create
(
SDiskData
*
pDiskData
)
{
int32_t
tDiskData
Init
(
SDiskData
*
pDiskData
,
STSchema
*
pTSchema
,
TABLEID
*
pId
,
uint8_t
cmprAlg
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
tDiskDataDestroy
(
SDiskData
*
pDiskData
)
{
int32_t
code
=
0
;
// TODO
pDiskData
->
suid
=
pId
->
suid
;
pDiskData
->
uid
=
pId
->
uid
;
pDiskData
->
cmprAlg
=
cmprAlg
;
if
(
pDiskData
->
pUidC
==
NULL
)
{
code
=
tCompressorCreate
(
&
pDiskData
->
pUidC
);
if
(
code
)
return
code
;
}
code
=
tCompressorReset
(
pDiskData
->
pUidC
,
TSDB_DATA_TYPE_BIGINT
,
cmprAlg
);
if
(
code
)
return
code
;
if
(
pDiskData
->
pVerC
==
NULL
)
{
code
=
tCompressorCreate
(
&
pDiskData
->
pVerC
);
if
(
code
)
return
code
;
}
code
=
tCompressorReset
(
pDiskData
->
pVerC
,
TSDB_DATA_TYPE_BIGINT
,
cmprAlg
);
if
(
code
)
return
code
;
if
(
pDiskData
->
pKeyC
==
NULL
)
{
code
=
tCompressorCreate
(
&
pDiskData
->
pKeyC
);
if
(
code
)
return
code
;
}
code
=
tCompressorReset
(
pDiskData
->
pKeyC
,
TSDB_DATA_TYPE_TIMESTAMP
,
cmprAlg
);
if
(
code
)
return
code
;
if
(
pDiskData
->
aDiskCol
==
NULL
)
{
pDiskData
->
aDiskCol
=
taosArrayInit
(
pTSchema
->
numOfCols
-
1
,
sizeof
(
SDiskCol
));
if
(
pDiskData
->
aDiskCol
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
code
;
}
}
pDiskData
->
nDiskCol
=
0
;
for
(
int32_t
iCol
=
1
;
iCol
<
pTSchema
->
numOfCols
;
iCol
++
)
{
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
iCol
];
if
(
pDiskData
->
nDiskCol
>=
taosArrayGetSize
(
pDiskData
->
aDiskCol
))
{
SDiskCol
dc
=
(
SDiskCol
){
0
};
if
(
taosArrayPush
(
pDiskData
->
aDiskCol
,
&
dc
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
return
code
;
}
}
SDiskCol
*
pDiskCol
=
(
SDiskCol
*
)
taosArrayGet
(
pDiskData
->
aDiskCol
,
pDiskData
->
nDiskCol
);
code
=
tDiskColInit
(
pDiskCol
,
pTColumn
->
colId
,
pTColumn
->
type
,
cmprAlg
);
if
(
code
)
return
code
;
pDiskData
->
nDiskCol
++
;
}
return
code
;
}
int32_t
tDiskData
Reset
(
SDiskData
*
pDiskData
,
STSchema
*
pTSchema
,
TABLEID
*
pId
,
uint8_t
cmprAlg
)
{
int32_t
tDiskData
Destroy
(
SDiskData
*
pDiskData
)
{
int32_t
code
=
0
;
pDiskData
->
suid
=
pId
->
suid
;
pDiskData
->
uid
=
pId
->
uid
;
pDiskData
->
cmprAlg
=
cmprAlg
;
if
(
pDiskData
->
pUidC
)
tCompressorDestroy
(
pDiskData
->
pUidC
)
;
if
(
pDiskData
->
pVerC
)
tCompressorDestroy
(
pDiskData
->
pVerC
)
;
if
(
pDiskData
->
pKeyC
)
tCompressorDestroy
(
pDiskData
->
pKeyC
)
;
for
(
int32_t
iCol
=
1
;
iCol
<
pTSchema
->
numOfCols
;
iCol
++
)
{
if
(
pDiskData
->
aDiskCol
)
{
for
(
int32_t
iDiskCol
=
0
;
iDiskCol
<
taosArrayGetSize
(
pDiskData
->
aDiskCol
);
iDiskCol
++
)
{
SDiskCol
*
pDiskCol
=
(
SDiskCol
*
)
taosArrayGet
(
pDiskData
->
aDiskCol
,
iDiskCol
);
tDiskColClear
(
pDiskCol
);
}
taosArrayDestroy
(
pDiskData
->
aDiskCol
);
}
return
code
;
...
...
source/util/src/tcompression.c
浏览文件 @
b4a43079
...
...
@@ -1508,24 +1508,22 @@ _exit:
int32_t
tCompressorDestroy
(
SCompressor
*
pCmprsor
)
{
int32_t
code
=
0
;
if
(
pCmprsor
)
{
int32_t
nBuf
=
sizeof
(
pCmprsor
->
aBuf
)
/
sizeof
(
pCmprsor
->
aBuf
[
0
]);
for
(
int32_t
iBuf
=
0
;
iBuf
<
nBuf
;
iBuf
++
)
{
tFree
(
pCmprsor
->
aBuf
[
iBuf
]);
}
taosMemoryFree
(
pCmprsor
);
int32_t
nBuf
=
sizeof
(
pCmprsor
->
aBuf
)
/
sizeof
(
pCmprsor
->
aBuf
[
0
]);
for
(
int32_t
iBuf
=
0
;
iBuf
<
nBuf
;
iBuf
++
)
{
tFree
(
pCmprsor
->
aBuf
[
iBuf
]);
}
taosMemoryFree
(
pCmprsor
);
return
code
;
}
int32_t
tCompressorReset
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
,
int8_t
autoAlloc
)
{
int32_t
tCompressorReset
(
SCompressor
*
pCmprsor
,
int8_t
type
,
int8_t
cmprAlg
)
{
int32_t
code
=
0
;
pCmprsor
->
type
=
type
;
pCmprsor
->
cmprAlg
=
cmprAlg
;
pCmprsor
->
autoAlloc
=
autoAlloc
;
pCmprsor
->
autoAlloc
=
1
;
pCmprsor
->
nVal
=
0
;
switch
(
type
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录