Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6e23c8cd
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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,发现更多精彩内容 >>
提交
6e23c8cd
编写于
11月 23, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
cc0c3771
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
53 addition
and
14 deletion
+53
-14
include/common/tdataformat.h
include/common/tdataformat.h
+3
-1
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+37
-3
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+11
-8
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+2
-2
未找到文件。
include/common/tdataformat.h
浏览文件 @
6e23c8cd
...
@@ -71,7 +71,7 @@ int32_t tBufferPut(SBuffer *pBuffer, const void *pData, int64_t nData);
...
@@ -71,7 +71,7 @@ int32_t tBufferPut(SBuffer *pBuffer, const void *pData, int64_t nData);
int32_t
tBufferReserve
(
SBuffer
*
pBuffer
,
int64_t
nData
,
void
**
ppData
);
int32_t
tBufferReserve
(
SBuffer
*
pBuffer
,
int64_t
nData
,
void
**
ppData
);
// STSchema ================================
// STSchema ================================
void
t
TSchemaDestroy
(
STSchema
*
pTSchema
);
void
t
DestroyTSchema
(
STSchema
*
pTSchema
);
// SColVal ================================
// SColVal ================================
#define CV_FLAG_VALUE ((int8_t)0x0)
#define CV_FLAG_VALUE ((int8_t)0x0)
...
@@ -243,6 +243,8 @@ void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version)
...
@@ -243,6 +243,8 @@ void tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version)
int32_t
tdAddColToSchema
(
STSchemaBuilder
*
pBuilder
,
int8_t
type
,
int8_t
flags
,
col_id_t
colId
,
col_bytes_t
bytes
);
int32_t
tdAddColToSchema
(
STSchemaBuilder
*
pBuilder
,
int8_t
type
,
int8_t
flags
,
col_id_t
colId
,
col_bytes_t
bytes
);
STSchema
*
tdGetSchemaFromBuilder
(
STSchemaBuilder
*
pBuilder
);
STSchema
*
tdGetSchemaFromBuilder
(
STSchemaBuilder
*
pBuilder
);
STSchema
*
tBuildTSchema
(
SSchema
*
aSchema
,
int32_t
numOfCols
,
int32_t
version
);
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
...
...
source/common/src/tdataformat.c
浏览文件 @
6e23c8cd
...
@@ -709,9 +709,6 @@ _exit:
...
@@ -709,9 +709,6 @@ _exit:
}
}
// STSchema ========================================
// STSchema ========================================
void
tTSchemaDestroy
(
STSchema
*
pTSchema
)
{
if
(
pTSchema
)
taosMemoryFree
(
pTSchema
);
}
// STag ========================================
// STag ========================================
static
int
tTagValCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
static
int
tTagValCmprFn
(
const
void
*
p1
,
const
void
*
p2
)
{
...
@@ -1179,6 +1176,43 @@ STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder) {
...
@@ -1179,6 +1176,43 @@ STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder) {
#endif
#endif
STSchema
*
tBuildTSchema
(
SSchema
*
aSchema
,
int32_t
numOfCols
,
int32_t
version
)
{
STSchema
*
pTSchema
=
taosMemoryCalloc
(
1
,
sizeof
(
STSchema
)
+
sizeof
(
STColumn
)
*
numOfCols
);
if
(
pTSchema
==
NULL
)
return
NULL
;
pTSchema
->
numOfCols
=
numOfCols
;
pTSchema
->
version
=
version
;
// timestamp column
ASSERT
(
aSchema
[
0
].
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
ASSERT
(
aSchema
[
0
].
colId
==
PRIMARYKEY_TIMESTAMP_COL_ID
);
pTSchema
->
columns
[
0
].
colId
=
aSchema
[
0
].
colId
;
pTSchema
->
columns
[
0
].
type
=
aSchema
[
0
].
type
;
pTSchema
->
columns
[
0
].
flags
=
aSchema
[
0
].
flags
;
pTSchema
->
columns
[
0
].
bytes
=
aSchema
[
0
].
bytes
;
pTSchema
->
columns
[
0
].
offset
=
-
1
;
// other columns
for
(
int32_t
iCol
=
1
;
iCol
<
numOfCols
;
iCol
++
)
{
SSchema
*
pSchema
=
&
aSchema
[
iCol
];
STColumn
*
pTColumn
=
&
pTSchema
->
columns
[
iCol
];
pTColumn
->
colId
=
pSchema
->
colId
;
pTColumn
->
type
=
pSchema
->
type
;
pTColumn
->
flags
=
pSchema
->
flags
;
pTColumn
->
bytes
=
pSchema
->
bytes
;
pTColumn
->
offset
=
pTSchema
->
flen
;
pTSchema
->
flen
+=
TYPE_BYTES
[
pTColumn
->
type
];
}
return
pTSchema
;
}
void
tDestroyTSchema
(
STSchema
*
pTSchema
)
{
if
(
pTSchema
)
taosMemoryFree
(
pTSchema
);
}
// SColData ========================================
// SColData ========================================
void
tColDataDestroy
(
void
*
ph
)
{
void
tColDataDestroy
(
void
*
ph
)
{
SColData
*
pColData
=
(
SColData
*
)
ph
;
SColData
*
pColData
=
(
SColData
*
)
ph
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
6e23c8cd
...
@@ -341,7 +341,7 @@ int32_t tsdbUpdateTableSchema(SMeta *pMeta, int64_t suid, int64_t uid, SSkmInfo
...
@@ -341,7 +341,7 @@ int32_t tsdbUpdateTableSchema(SMeta *pMeta, int64_t suid, int64_t uid, SSkmInfo
pSkmInfo
->
suid
=
suid
;
pSkmInfo
->
suid
=
suid
;
pSkmInfo
->
uid
=
uid
;
pSkmInfo
->
uid
=
uid
;
t
TSchemaDestroy
(
pSkmInfo
->
pTSchema
);
t
DestroyTSchema
(
pSkmInfo
->
pTSchema
);
code
=
metaGetTbTSchemaEx
(
pMeta
,
suid
,
uid
,
-
1
,
&
pSkmInfo
->
pTSchema
);
code
=
metaGetTbTSchemaEx
(
pMeta
,
suid
,
uid
,
-
1
,
&
pSkmInfo
->
pTSchema
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
@@ -365,7 +365,7 @@ static int32_t tsdbCommitterUpdateRowSchema(SCommitter *pCommitter, int64_t suid
...
@@ -365,7 +365,7 @@ static int32_t tsdbCommitterUpdateRowSchema(SCommitter *pCommitter, int64_t suid
pCommitter
->
skmRow
.
suid
=
suid
;
pCommitter
->
skmRow
.
suid
=
suid
;
pCommitter
->
skmRow
.
uid
=
uid
;
pCommitter
->
skmRow
.
uid
=
uid
;
t
TSchemaDestroy
(
pCommitter
->
skmRow
.
pTSchema
);
t
DestroyTSchema
(
pCommitter
->
skmRow
.
pTSchema
);
code
=
metaGetTbTSchemaEx
(
pCommitter
->
pTsdb
->
pVnode
->
pMeta
,
suid
,
uid
,
sver
,
&
pCommitter
->
skmRow
.
pTSchema
);
code
=
metaGetTbTSchemaEx
(
pCommitter
->
pTsdb
->
pVnode
->
pMeta
,
suid
,
uid
,
sver
,
&
pCommitter
->
skmRow
.
pTSchema
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
@@ -498,7 +498,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
...
@@ -498,7 +498,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
#if 0
#if 0
ASSERT(pCommitter->minKey <= pCommitter->nextKey && pCommitter->maxKey >= pCommitter->nextKey);
ASSERT(pCommitter->minKey <= pCommitter->nextKey && pCommitter->maxKey >= pCommitter->nextKey);
#endif
#endif
pCommitter
->
nextKey
=
TSKEY_MAX
;
pCommitter
->
nextKey
=
TSKEY_MAX
;
// Reader
// Reader
...
@@ -623,7 +623,8 @@ int32_t tsdbWriteDataBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SMapDa
...
@@ -623,7 +623,8 @@ int32_t tsdbWriteDataBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SMapDa
_exit:
_exit:
if
(
code
)
{
if
(
code
)
{
tsdbError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
tsdbError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
}
return
code
;
return
code
;
}
}
...
@@ -666,7 +667,8 @@ int32_t tsdbWriteSttBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SArray
...
@@ -666,7 +667,8 @@ int32_t tsdbWriteSttBlock(SDataFWriter *pWriter, SBlockData *pBlockData, SArray
_exit:
_exit:
if
(
code
)
{
if
(
code
)
{
tsdbError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
tsdbError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
}
return
code
;
return
code
;
}
}
...
@@ -706,7 +708,8 @@ static int32_t tsdbCommitSttBlk(SDataFWriter *pWriter, SDiskDataBuilder *pBuilde
...
@@ -706,7 +708,8 @@ static int32_t tsdbCommitSttBlk(SDataFWriter *pWriter, SDiskDataBuilder *pBuilde
_exit:
_exit:
if
(
code
)
{
if
(
code
)
{
tsdbError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
tsdbError
(
"vgId:%d, %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
}
return
code
;
return
code
;
}
}
...
@@ -919,8 +922,8 @@ static void tsdbCommitDataEnd(SCommitter *pCommitter) {
...
@@ -919,8 +922,8 @@ static void tsdbCommitDataEnd(SCommitter *pCommitter) {
#else
#else
tBlockDataDestroy
(
&
pCommitter
->
dWriter
.
bDatal
,
1
);
tBlockDataDestroy
(
&
pCommitter
->
dWriter
.
bDatal
,
1
);
#endif
#endif
t
TSchemaDestroy
(
pCommitter
->
skmTable
.
pTSchema
);
t
DestroyTSchema
(
pCommitter
->
skmTable
.
pTSchema
);
t
TSchemaDestroy
(
pCommitter
->
skmRow
.
pTSchema
);
t
DestroyTSchema
(
pCommitter
->
skmRow
.
pTSchema
);
}
}
static
int32_t
tsdbCommitData
(
SCommitter
*
pCommitter
)
{
static
int32_t
tsdbCommitData
(
SCommitter
*
pCommitter
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
浏览文件 @
6e23c8cd
...
@@ -555,7 +555,7 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
...
@@ -555,7 +555,7 @@ int32_t tsdbSnapReaderClose(STsdbSnapReader** ppReader) {
}
}
tBlockDataDestroy
(
&
pReader
->
bData
,
1
);
tBlockDataDestroy
(
&
pReader
->
bData
,
1
);
t
TSchemaDestroy
(
pReader
->
skmTable
.
pTSchema
);
t
DestroyTSchema
(
pReader
->
skmTable
.
pTSchema
);
// del
// del
if
(
pReader
->
pDelFReader
)
tsdbDelFReaderClose
(
&
pReader
->
pDelFReader
);
if
(
pReader
->
pDelFReader
)
tsdbDelFReaderClose
(
&
pReader
->
pDelFReader
);
...
@@ -1416,7 +1416,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
...
@@ -1416,7 +1416,7 @@ int32_t tsdbSnapWriterClose(STsdbSnapWriter** ppWriter, int8_t rollback) {
taosArrayDestroy
(
pWriter
->
dReader
.
aBlockIdx
);
taosArrayDestroy
(
pWriter
->
dReader
.
aBlockIdx
);
tBlockDataDestroy
(
&
pWriter
->
bData
,
1
);
tBlockDataDestroy
(
&
pWriter
->
bData
,
1
);
t
TSchemaDestroy
(
pWriter
->
skmTable
.
pTSchema
);
t
DestroyTSchema
(
pWriter
->
skmTable
.
pTSchema
);
for
(
int32_t
iBuf
=
0
;
iBuf
<
sizeof
(
pWriter
->
aBuf
)
/
sizeof
(
uint8_t
*
);
iBuf
++
)
{
for
(
int32_t
iBuf
=
0
;
iBuf
<
sizeof
(
pWriter
->
aBuf
)
/
sizeof
(
uint8_t
*
);
iBuf
++
)
{
tFree
(
pWriter
->
aBuf
[
iBuf
]);
tFree
(
pWriter
->
aBuf
[
iBuf
]);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录