Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e4b7318c
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看板
提交
e4b7318c
编写于
5月 27, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
44258669
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
53 deletion
+41
-53
include/util/tarray2.h
include/util/tarray2.h
+4
-3
source/dnode/vnode/src/tsdb/dev/inc/tsdbDef.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbDef.h
+4
-6
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
+8
-9
source/dnode/vnode/src/tsdb/dev/tsdbSttFReaderWriter.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFReaderWriter.c
+25
-25
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
+0
-10
未找到文件。
include/util/tarray2.h
浏览文件 @
e4b7318c
...
...
@@ -47,6 +47,7 @@ typedef void (*TArray2Cb)(void *);
#define TARRAY2_GET_PTR(a, i) ((a)->data + i)
#define TARRAY2_FIRST(a) ((a)->data[0])
#define TARRAY2_LAST(a) ((a)->data[(a)->size - 1])
#define TARRAY2_DATA_LEN(a) ((a)->size * sizeof(typeof((a)->data[0])))
static
FORCE_INLINE
int32_t
tarray2_make_room
(
//
void
*
arg
,
// array
...
...
@@ -114,9 +115,9 @@ static FORCE_INLINE int32_t tarray2_make_room( //
__ret; \
})
#define TARRAY2_INSERT_P(a, idx, ep) TARRAY2_INSERT(a, idx, *(ep))
#define TARRAY2_APPEND(a, e) TARRAY2_INSERT(a, (a)->size, e)
#define TARRAY2_APPEND_P(a, ep) TARRAY2_APPEND(a, *(ep))
#define TARRAY2_INSERT_P
TR
(a, idx, ep) TARRAY2_INSERT(a, idx, *(ep))
#define TARRAY2_APPEND(a, e)
TARRAY2_INSERT(a, (a)->size, e)
#define TARRAY2_APPEND_P
TR
(a, ep) TARRAY2_APPEND(a, *(ep))
// return (TYPE *)
#define TARRAY2_SEARCH(a, ep, cmp, flag) \
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbDef.h
浏览文件 @
e4b7318c
...
...
@@ -23,7 +23,10 @@
extern
"C"
{
#endif
typedef
struct
SFDataPtr
SFDataPtr
;
typedef
struct
SFDataPtr
{
int64_t
offset
;
int64_t
size
;
}
SFDataPtr
;
extern
int32_t
tsdbOpenFile
(
const
char
*
path
,
int32_t
szPage
,
int32_t
flag
,
STsdbFD
**
ppFD
);
extern
void
tsdbCloseFile
(
STsdbFD
**
ppFD
);
...
...
@@ -31,11 +34,6 @@ extern int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, const uint8_t *pBuf,
extern
int32_t
tsdbReadFile
(
STsdbFD
*
pFD
,
int64_t
offset
,
uint8_t
*
pBuf
,
int64_t
size
);
extern
int32_t
tsdbFsyncFile
(
STsdbFD
*
pFD
);
struct
SFDataPtr
{
int64_t
offset
;
int64_t
size
;
};
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
浏览文件 @
e4b7318c
...
...
@@ -38,11 +38,11 @@ typedef union {
typedef
union
{
TARRAY2
(
int64_t
)
aData
[
5
];
struct
{
TARRAY2
(
int64_t
)
aS
uid
[
1
];
TARRAY2
(
int64_t
)
aU
id
[
1
];
TARRAY2
(
int64_t
)
aVer
[
1
];
TARRAY2
(
int64_t
)
aS
key
[
1
];
TARRAY2
(
int64_t
)
aE
key
[
1
];
TARRAY2
(
int64_t
)
s
uid
[
1
];
TARRAY2
(
int64_t
)
u
id
[
1
];
TARRAY2
(
int64_t
)
version
[
1
];
TARRAY2
(
int64_t
)
s
key
[
1
];
TARRAY2
(
int64_t
)
e
key
[
1
];
};
}
SDelBlock
;
...
...
@@ -55,7 +55,7 @@ typedef struct SDelBlk {
SFDataPtr
dp
;
}
SDelBlk
;
#define DEL_BLOCK_SIZE(db) TARRAY2_SIZE((db)->
aS
uid)
#define DEL_BLOCK_SIZE(db) TARRAY2_SIZE((db)->
s
uid)
int32_t
tDelBlockInit
(
SDelBlock
*
delBlock
);
int32_t
tDelBlockFree
(
SDelBlock
*
delBlock
);
...
...
@@ -97,11 +97,12 @@ typedef union {
typedef
struct
STbStatisBlk
{
int32_t
numRec
;
int32_t
size
[
9
];
TABLEID
minTid
;
TABLEID
maxTid
;
int64_t
minVer
;
int64_t
maxVer
;
SFDataPtr
dp
;
SFDataPtr
dp
[
1
]
;
}
STbStatisBlk
;
#define STATIS_BLOCK_SIZE(db) TARRAY2_SIZE((db)->suid)
...
...
@@ -110,8 +111,6 @@ int32_t tStatisBlockInit(STbStatisBlock *statisBlock);
int32_t
tStatisBlockFree
(
STbStatisBlock
*
statisBlock
);
int32_t
tStatisBlockClear
(
STbStatisBlock
*
statisBlock
);
int32_t
tStatisBlockPut
(
STbStatisBlock
*
statisBlock
,
const
STbStatisRecord
*
statisRecord
);
int32_t
tStatisBlockEncode
(
STbStatisBlock
*
statisBlock
,
void
*
buf
,
int32_t
size
);
int32_t
tStatisBlockDecode
(
const
void
*
buf
,
STbStatisBlock
*
statisBlock
);
// other apis
int32_t
tsdbUpdateSkmTb
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
SSkmInfo
*
pSkmTb
);
...
...
source/dnode/vnode/src/tsdb/dev/tsdbSttFReaderWriter.c
浏览文件 @
e4b7318c
...
...
@@ -305,7 +305,7 @@ static int32_t tsdbSttFileDoWriteTSDataBlock(SSttFileWriter *writer) {
}
tBlockDataClear
(
writer
->
bData
);
code
=
TARRAY2_APPEND_P
(
writer
->
sttBlkArray
,
sttBlk
);
code
=
TARRAY2_APPEND_P
TR
(
writer
->
sttBlkArray
,
sttBlk
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
...
...
@@ -326,31 +326,31 @@ static int32_t tsdbSttFileDoWriteStatisBlock(SSttFileWriter *writer) {
.
numRec
=
STATIS_BLOCK_SIZE
(
writer
->
sData
),
.
minTid
=
{.
suid
=
TARRAY2_FIRST
(
writer
->
sData
->
suid
),
.
uid
=
TARRAY2_FIRST
(
writer
->
sData
->
uid
)},
.
maxTid
=
{.
suid
=
TARRAY2_LAST
(
writer
->
sData
->
suid
),
.
uid
=
TARRAY2_LAST
(
writer
->
sData
->
uid
)},
// .minVer = TARRAY2_FIRST(writer->sData->a
Ver),
// .maxVer = TARRAY2_FIRST(writer->sData->a
Ver),
.
minVer
=
TARRAY2_FIRST
(
writer
->
sData
->
min
Ver
),
.
maxVer
=
TARRAY2_FIRST
(
writer
->
sData
->
max
Ver
),
}};
// statisBlk->minVer = statisBlk->maxVer = statisBlk->maxVer = writer->sData->aData[2][0];
// for (int32_t iRow = 1; iRow < writer->sData->nRow; iRow++) {
// if (statisBlk->minVer > writer->sData->aData[2][iRow]) statisBlk->minVer = writer->sData->aData[2][iRow];
// if (statisBlk->maxVer < writer->sData->aData[2][iRow]) statisBlk->maxVer = writer->sData->aData[2][iRow];
// }
for
(
int32_t
i
=
1
;
i
<
STATIS_BLOCK_SIZE
(
writer
->
sData
);
i
++
)
{
statisBlk
->
minVer
=
TMIN
(
statisBlk
->
minVer
,
TARRAY2_GET
(
writer
->
sData
->
minVer
,
i
));
statisBlk
->
maxVer
=
TMAX
(
statisBlk
->
maxVer
,
TARRAY2_GET
(
writer
->
sData
->
maxVer
,
i
));
}
// statisBlk->dp.
offset = writer->file->size;
// statisBlk->dp.
size = 0;
statisBlk
->
dp
->
offset
=
writer
->
file
->
size
;
statisBlk
->
dp
->
size
=
0
;
// // TODO: add compression here
// int64_t tsize = sizeof(int64_t) * writer->sData->nRow;
// for (int32_t i = 0; i < ARRAY_SIZE(writer->sData->aData); i++) {
// code = tsdbWriteFile(writer->fd, writer->file->size, (const uint8_t *)writer->sData->aData[i], tsize);
// TSDB_CHECK_CODE(code, lino, _exit);
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
writer
->
sData
->
aData
);
i
++
)
{
int32_t
size
;
code
=
tsdbCmprData
((
uint8_t
*
)
TARRAY2_DATA
(
&
writer
->
sData
->
aData
[
i
]),
TARRAY2_DATA_LEN
(
&
writer
->
sData
->
aData
[
i
]),
TSDB_DATA_TYPE_BIGINT
,
TWO_STAGE_COMP
,
&
writer
->
config
->
aBuf
[
0
],
0
,
&
size
,
&
writer
->
config
->
aBuf
[
1
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
statisBlk
->
size
[
i
]
=
size
;
statisBlk
->
dp
->
size
+=
size
;
}
// statisBlk->dp.size += tsize;
// writer->file->size += tsize;
// }
tStatisBlockClear
(
writer
->
sData
);
code
=
TARRAY2_APPEND_P
(
writer
->
statisBlkArray
,
statisBlk
);
code
=
TARRAY2_APPEND_P
TR
(
writer
->
statisBlkArray
,
statisBlk
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
...
...
@@ -394,7 +394,7 @@ static int32_t tsdbSttFileDoWriteDelBlock(SSttFileWriter *writer) {
}
tDelBlockDestroy(writer->dData);
code = TARRAY2_APPEND_P(writer->delBlkArray, delBlk);
code = TARRAY2_APPEND_P
TR
(writer->delBlkArray, delBlk);
TSDB_CHECK_CODE(code, lino, _exit);
_exit:
...
...
@@ -723,13 +723,13 @@ int32_t tsdbSttFWriteTSDataBlock(SSttFileWriter *writer, SBlockData *bdata) {
int32_t
code
=
0
;
int32_t
lino
=
0
;
SRowInfo
row
Info
;
row
Info
.
suid
=
bdata
->
suid
;
SRowInfo
row
[
1
]
;
row
->
suid
=
bdata
->
suid
;
for
(
int32_t
i
=
0
;
i
<
bdata
->
nRow
;
i
++
)
{
row
Info
.
uid
=
bdata
->
uid
?
bdata
->
uid
:
bdata
->
aUid
[
i
];
row
Info
.
row
=
tsdbRowFromBlockData
(
bdata
,
i
);
row
->
uid
=
bdata
->
uid
?
bdata
->
uid
:
bdata
->
aUid
[
i
];
row
->
row
=
tsdbRowFromBlockData
(
bdata
,
i
);
code
=
tsdbSttFWriteTSData
(
writer
,
&
rowInfo
);
code
=
tsdbSttFWriteTSData
(
writer
,
row
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
浏览文件 @
e4b7318c
...
...
@@ -85,16 +85,6 @@ int32_t tStatisBlockPut(STbStatisBlock *statisBlock, const STbStatisRecord *stat
return
0
;
}
int32_t
tStatisBlockEncode
(
STbStatisBlock
*
statisBlock
,
void
*
buf
,
int32_t
size
)
{
// TODO
return
0
;
}
int32_t
tStatisBlockDecode
(
const
void
*
buf
,
STbStatisBlock
*
statisBlock
)
{
// TODO
return
0
;
}
// other apis ----------
int32_t
tsdbUpdateSkmTb
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
SSkmInfo
*
pSkmTb
)
{
if
(
tbid
->
suid
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录