Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ce9afbae
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ce9afbae
编写于
9月 21, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
8ffc7e9f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
101 addition
and
4 deletion
+101
-4
include/util/tcompression.h
include/util/tcompression.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbDiskData.c
source/dnode/vnode/src/tsdb/tsdbDiskData.c
+99
-2
source/util/src/tcompression.c
source/util/src/tcompression.c
+1
-1
未找到文件。
include/util/tcompression.h
浏览文件 @
ce9afbae
...
...
@@ -131,7 +131,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
);
int32_t
tCompGen
(
SCompressor
*
pCmprsor
,
const
uint8_t
**
ppData
,
int
64
_t
*
nData
);
int32_t
tCompGen
(
SCompressor
*
pCmprsor
,
const
uint8_t
**
ppData
,
int
32
_t
*
nData
);
int32_t
tCompress
(
SCompressor
*
pCmprsor
,
const
void
*
pData
,
int64_t
nData
);
#ifdef __cplusplus
...
...
source/dnode/vnode/src/tsdb/tsdbDiskData.c
浏览文件 @
ce9afbae
...
...
@@ -349,6 +349,7 @@ struct SDiskData {
SCompressor
*
pKeyC
;
int32_t
nDiskCol
;
SArray
*
aDiskCol
;
uint8_t
*
aBuf
[
2
];
};
int32_t
tDiskDataInit
(
SDiskData
*
pDiskData
,
STSchema
*
pTSchema
,
TABLEID
*
pId
,
uint8_t
cmprAlg
)
{
...
...
@@ -425,6 +426,9 @@ int32_t tDiskDataDestroy(SDiskData *pDiskData) {
}
taosArrayDestroy
(
pDiskData
->
aDiskCol
);
}
for
(
int32_t
iBuf
=
0
;
iBuf
<
sizeof
(
pDiskData
->
aBuf
)
/
sizeof
(
pDiskData
->
aBuf
[
0
]);
iBuf
++
)
{
tFree
(
pDiskData
->
aBuf
[
iBuf
]);
}
return
code
;
}
...
...
@@ -435,8 +439,17 @@ int32_t tDiskDataAddRow(SDiskData *pDiskData, TSDBROW *pRow, STSchema *pTSchema,
ASSERT
(
pId
->
suid
==
pDiskData
->
suid
);
// uid
code
=
tCompress
(
pDiskData
->
pUidC
,
&
pId
->
uid
,
sizeof
(
int64_t
));
if
(
code
)
goto
_exit
;
if
(
pDiskData
->
uid
&&
pDiskData
->
uid
!=
pId
->
uid
)
{
for
(
int32_t
iRow
=
0
;
iRow
<
pDiskData
->
nRow
;
iRow
++
)
{
code
=
tCompress
(
pDiskData
->
pUidC
,
&
pDiskData
->
uid
,
sizeof
(
int64_t
));
if
(
code
)
goto
_exit
;
}
pDiskData
->
uid
=
0
;
}
if
(
pDiskData
->
uid
==
0
)
{
code
=
tCompress
(
pDiskData
->
pUidC
,
&
pId
->
uid
,
sizeof
(
int64_t
));
if
(
code
)
goto
_exit
;
}
// version
int64_t
version
=
TSDBROW_VERSION
(
pRow
);
...
...
@@ -474,3 +487,87 @@ int32_t tDiskDataAddRow(SDiskData *pDiskData, TSDBROW *pRow, STSchema *pTSchema,
_exit:
return
code
;
}
int32_t
tDiskDataToBinary
(
SDiskData
*
pDiskData
,
const
uint8_t
**
ppData
,
int32_t
*
nData
)
{
int32_t
code
=
0
;
ASSERT
(
pDiskData
->
nRow
);
SDiskDataHdr
hdr
=
{.
delimiter
=
TSDB_FILE_DLMT
,
.
fmtVer
=
0
,
.
suid
=
pDiskData
->
suid
,
.
uid
=
pDiskData
->
uid
,
.
szUid
=
0
,
.
szVer
=
0
,
.
szKey
=
0
,
.
szBlkCol
=
0
,
.
nRow
=
pDiskData
->
nRow
,
.
cmprAlg
=
pDiskData
->
cmprAlg
};
// UID
const
uint8_t
*
pUid
=
NULL
;
if
(
pDiskData
->
uid
==
0
)
{
code
=
tCompGen
(
pDiskData
->
pUidC
,
&
pUid
,
&
hdr
.
szUid
);
if
(
code
)
return
code
;
}
// VERSION
const
uint8_t
*
pVer
=
NULL
;
code
=
tCompGen
(
pDiskData
->
pVerC
,
&
pVer
,
&
hdr
.
szVer
);
if
(
code
)
return
code
;
// TSKEY
const
uint8_t
*
pKey
=
NULL
;
code
=
tCompGen
(
pDiskData
->
pKeyC
,
&
pKey
,
&
hdr
.
szKey
);
if
(
code
)
return
code
;
int32_t
offset
=
0
;
for
(
int32_t
iDiskCol
=
0
;
iDiskCol
<
pDiskData
->
nDiskCol
;
iDiskCol
++
)
{
SDiskCol
*
pDiskCol
=
(
SDiskCol
*
)
taosArrayGet
(
pDiskData
->
aDiskCol
,
iDiskCol
);
if
(
pDiskCol
->
flag
==
HAS_NONE
)
continue
;
// code = tDiskColToBinary(pDiskCol, );
// if (code) return code;
SBlockCol
bCol
=
{.
cid
=
pDiskCol
->
cid
,
.
type
=
pDiskCol
->
type
,
// .smaOn = ,
.
flag
=
pDiskCol
->
flag
,
// .szOrigin =
// .szBitmap =
// .szOffset =
// .szValue =
.
offset
=
offset
};
hdr
.
szBlkCol
+=
tPutBlockCol
(
NULL
,
&
bCol
);
offset
=
offset
+
bCol
.
szBitmap
+
bCol
.
szOffset
+
bCol
.
szValue
;
}
*
nData
=
tPutDiskDataHdr
(
NULL
,
&
hdr
)
+
hdr
.
szUid
+
hdr
.
szVer
+
hdr
.
szKey
+
hdr
.
szBlkCol
+
offset
;
code
=
tRealloc
(
&
pDiskData
->
aBuf
[
0
],
*
nData
);
if
(
code
)
return
code
;
*
ppData
=
pDiskData
->
aBuf
[
0
];
int32_t
n
=
0
;
n
+=
tPutDiskDataHdr
(
pDiskData
->
aBuf
[
0
]
+
n
,
&
hdr
);
if
(
hdr
.
szUid
)
{
memcpy
(
pDiskData
->
aBuf
[
0
]
+
n
,
pUid
,
hdr
.
szUid
);
n
+=
hdr
.
szUid
;
}
memcpy
(
pDiskData
->
aBuf
[
0
]
+
n
,
pVer
,
hdr
.
szVer
);
n
+=
hdr
.
szVer
;
memcpy
(
pDiskData
->
aBuf
[
0
]
+
n
,
pKey
,
hdr
.
szKey
);
n
+=
hdr
.
szKey
;
for
(
int32_t
iDiskCol
=
0
;
iDiskCol
<
pDiskData
->
nDiskCol
;
iDiskCol
++
)
{
SDiskCol
*
pDiskCol
=
(
SDiskCol
*
)
taosArrayGet
(
pDiskData
->
aDiskCol
,
iDiskCol
);
n
+=
tPutBlockCol
(
pDiskData
->
aBuf
[
0
]
+
n
,
NULL
/*pDiskCol->bCol (todo) */
);
}
for
(
int32_t
iDiskCol
=
0
;
iDiskCol
<
pDiskData
->
nDiskCol
;
iDiskCol
++
)
{
SDiskCol
*
pDiskCol
=
(
SDiskCol
*
)
taosArrayGet
(
pDiskData
->
aDiskCol
,
iDiskCol
);
// memcpy(pDiskData->aBuf[0] + n, NULL, );
// n += 0;
}
return
code
;
}
source/util/src/tcompression.c
浏览文件 @
ce9afbae
...
...
@@ -1574,7 +1574,7 @@ int32_t tCompressorReset(SCompressor *pCmprsor, int8_t type, int8_t cmprAlg) {
return
code
;
}
int32_t
tCompGen
(
SCompressor
*
pCmprsor
,
const
uint8_t
**
ppData
,
int
64
_t
*
nData
)
{
int32_t
tCompGen
(
SCompressor
*
pCmprsor
,
const
uint8_t
**
ppData
,
int
32
_t
*
nData
)
{
int32_t
code
=
0
;
if
(
pCmprsor
->
nVal
==
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录