Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
83e238d0
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
83e238d0
编写于
3月 31, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-34
上级
85ce67bb
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
24 addition
and
7 deletion
+24
-7
src/vnode/tsdb/src/tsdbFile.c
src/vnode/tsdb/src/tsdbFile.c
+2
-1
src/vnode/tsdb/src/tsdbMain.c
src/vnode/tsdb/src/tsdbMain.c
+1
-0
src/vnode/tsdb/src/tsdbMeta.c
src/vnode/tsdb/src/tsdbMeta.c
+1
-1
src/vnode/tsdb/tests/tsdbTests.cpp
src/vnode/tsdb/tests/tsdbTests.cpp
+20
-5
未找到文件。
src/vnode/tsdb/src/tsdbFile.c
浏览文件 @
83e238d0
...
@@ -183,9 +183,10 @@ int tsdbLoadDataBlock(SFile *pFile, SCompBlock *pStartBlock, int numOfBlocks, SD
...
@@ -183,9 +183,10 @@ int tsdbLoadDataBlock(SFile *pFile, SCompBlock *pStartBlock, int numOfBlocks, SD
SCompBlock
*
pBlock
=
pStartBlock
;
SCompBlock
*
pBlock
=
pStartBlock
;
for
(
int
i
=
0
;
i
<
numOfBlocks
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numOfBlocks
;
i
++
)
{
if
(
tsdbLoadCompCols
(
pFile
,
pBlock
,
(
void
*
)
pCompData
)
<
0
)
return
-
1
;
if
(
tsdbLoadCompCols
(
pFile
,
pBlock
,
(
void
*
)
pCompData
)
<
0
)
return
-
1
;
pCols
->
numOfPoints
+=
(
pCompData
->
cols
[
0
].
len
/
8
);
for
(
int
iCol
=
0
;
iCol
<
pBlock
->
numOfCols
;
iCol
++
)
{
for
(
int
iCol
=
0
;
iCol
<
pBlock
->
numOfCols
;
iCol
++
)
{
SCompCol
*
pCompCol
=
&
(
pCompData
->
cols
[
iCol
]);
SCompCol
*
pCompCol
=
&
(
pCompData
->
cols
[
iCol
]);
pCols
->
numOfPoints
+=
pBlock
->
numOfPoints
;
//
pCols->numOfPoints += pBlock->numOfPoints;
int
k
=
0
;
int
k
=
0
;
for
(;
k
<
pCols
->
numOfCols
;
k
++
)
{
for
(;
k
<
pCols
->
numOfCols
;
k
++
)
{
if
(
pCompCol
->
colId
==
pCols
->
cols
[
k
].
colId
)
break
;
if
(
pCompCol
->
colId
==
pCols
->
cols
[
k
].
colId
)
break
;
...
...
src/vnode/tsdb/src/tsdbMain.c
浏览文件 @
83e238d0
...
@@ -1031,6 +1031,7 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
...
@@ -1031,6 +1031,7 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
pTBlock
->
numOfPoints
=
pCols
->
numOfPoints
;
pTBlock
->
numOfPoints
=
pCols
->
numOfPoints
;
pTBlock
->
sversion
=
pTable
->
sversion
;
pTBlock
->
sversion
=
pTable
->
sversion
;
pTBlock
->
numOfSubBlocks
=
1
;
pTBlock
->
numOfSubBlocks
=
1
;
pTBlock
->
numOfCols
=
pCols
->
numOfCols
;
if
(
dataColsKeyLast
(
pCols
)
>
pIdx
->
maxKey
)
pIdx
->
maxKey
=
dataColsKeyLast
(
pCols
);
if
(
dataColsKeyLast
(
pCols
)
>
pIdx
->
maxKey
)
pIdx
->
maxKey
=
dataColsKeyLast
(
pCols
);
...
...
src/vnode/tsdb/src/tsdbMeta.c
浏览文件 @
83e238d0
...
@@ -74,7 +74,7 @@ STable *tsdbDecodeTable(void *cont, int contLen) {
...
@@ -74,7 +74,7 @@ STable *tsdbDecodeTable(void *cont, int contLen) {
T_READ_MEMBER
(
ptr
,
int8_t
,
pTable
->
type
);
T_READ_MEMBER
(
ptr
,
int8_t
,
pTable
->
type
);
T_READ_MEMBER
(
ptr
,
int64_t
,
pTable
->
tableId
.
uid
);
T_READ_MEMBER
(
ptr
,
int64_t
,
pTable
->
tableId
.
uid
);
T_READ_MEMBER
(
ptr
,
int32_t
,
pTable
->
tableId
.
tid
);
T_READ_MEMBER
(
ptr
,
int32_t
,
pTable
->
tableId
.
tid
);
T_READ_MEMBER
(
ptr
,
int
32
_t
,
pTable
->
superUid
);
T_READ_MEMBER
(
ptr
,
int
64
_t
,
pTable
->
superUid
);
T_READ_MEMBER
(
ptr
,
int32_t
,
pTable
->
sversion
);
T_READ_MEMBER
(
ptr
,
int32_t
,
pTable
->
sversion
);
if
(
pTable
->
type
==
TSDB_SUPER_TABLE
)
{
if
(
pTable
->
type
==
TSDB_SUPER_TABLE
)
{
...
...
src/vnode/tsdb/tests/tsdbTests.cpp
浏览文件 @
83e238d0
...
@@ -12,6 +12,7 @@ double getCurTime() {
...
@@ -12,6 +12,7 @@ double getCurTime() {
}
}
TEST
(
TsdbTest
,
DISABLED_tableEncodeDecode
)
{
TEST
(
TsdbTest
,
DISABLED_tableEncodeDecode
)
{
// TEST(TsdbTest, tableEncodeDecode) {
STable
*
pTable
=
(
STable
*
)
malloc
(
sizeof
(
STable
));
STable
*
pTable
=
(
STable
*
)
malloc
(
sizeof
(
STable
));
pTable
->
type
=
TSDB_NORMAL_TABLE
;
pTable
->
type
=
TSDB_NORMAL_TABLE
;
...
@@ -47,8 +48,8 @@ TEST(TsdbTest, DISABLED_tableEncodeDecode) {
...
@@ -47,8 +48,8 @@ TEST(TsdbTest, DISABLED_tableEncodeDecode) {
ASSERT_EQ
(
memcmp
(
pTable
->
schema
,
tTable
->
schema
,
sizeof
(
STSchema
)
+
sizeof
(
STColumn
)
*
nCols
),
0
);
ASSERT_EQ
(
memcmp
(
pTable
->
schema
,
tTable
->
schema
,
sizeof
(
STSchema
)
+
sizeof
(
STColumn
)
*
nCols
),
0
);
}
}
TEST
(
TsdbTest
,
DISABLED_createRepo
)
{
//
TEST(TsdbTest, DISABLED_createRepo) {
//
TEST(TsdbTest, createRepo) {
TEST
(
TsdbTest
,
createRepo
)
{
STsdbCfg
config
;
STsdbCfg
config
;
// 1. Create a tsdb repository
// 1. Create a tsdb repository
...
@@ -139,12 +140,12 @@ TEST(TsdbTest, DISABLED_createRepo) {
...
@@ -139,12 +140,12 @@ TEST(TsdbTest, DISABLED_createRepo) {
// TEST(TsdbTest, DISABLED_openRepo) {
// TEST(TsdbTest, DISABLED_openRepo) {
TEST
(
TsdbTest
,
openRepo
)
{
TEST
(
TsdbTest
,
openRepo
)
{
tsdb_repo_t
*
repo
=
tsdbOpenRepo
(
"/home/ubuntu/work/
build/test/data/vnode/vnode1/tsdb
"
);
tsdb_repo_t
*
repo
=
tsdbOpenRepo
(
"/home/ubuntu/work/
ttest/vnode0
"
);
ASSERT_NE
(
repo
,
nullptr
);
ASSERT_NE
(
repo
,
nullptr
);
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
SFileGroup
*
pGroup
=
tsdbSearchFGroup
(
pRepo
->
tsdbFileH
,
183
5
);
SFileGroup
*
pGroup
=
tsdbSearchFGroup
(
pRepo
->
tsdbFileH
,
183
3
);
for
(
int
type
=
TSDB_FILE_TYPE_HEAD
;
type
<
TSDB_FILE_TYPE_MAX
;
type
++
)
{
for
(
int
type
=
TSDB_FILE_TYPE_HEAD
;
type
<
TSDB_FILE_TYPE_MAX
;
type
++
)
{
tsdbOpenFile
(
&
pGroup
->
files
[
type
],
O_RDONLY
);
tsdbOpenFile
(
&
pGroup
->
files
[
type
],
O_RDONLY
);
...
@@ -155,7 +156,21 @@ TEST(TsdbTest, openRepo) {
...
@@ -155,7 +156,21 @@ TEST(TsdbTest, openRepo) {
SCompInfo
*
pCompInfo
=
(
SCompInfo
*
)
malloc
(
sizeof
(
SCompInfo
)
+
pIdx
[
1
].
len
);
SCompInfo
*
pCompInfo
=
(
SCompInfo
*
)
malloc
(
sizeof
(
SCompInfo
)
+
pIdx
[
1
].
len
);
tsdbLoadCompBlocks
(
pGroup
,
&
pIdx
[
1
],
(
void
*
)
pCompInfo
);
tsdbLoadCompBlocks
(
pGroup
,
&
pIdx
[
0
],
(
void
*
)
pCompInfo
);
int
blockIdx
=
0
;
SCompBlock
*
pBlock
=
&
(
pCompInfo
->
blocks
[
blockIdx
]);
SCompData
*
pCompData
=
(
SCompData
*
)
malloc
(
sizeof
(
SCompData
)
+
sizeof
(
SCompCol
)
*
pBlock
->
numOfCols
);
tsdbLoadCompCols
(
&
pGroup
->
files
[
TSDB_FILE_TYPE_DATA
],
pBlock
,
(
void
*
)
pCompData
);
STable
*
pTable
=
tsdbGetTableByUid
(
pRepo
->
tsdbMeta
,
pCompData
->
uid
);
SDataCols
*
pDataCols
=
tdNewDataCols
(
tdMaxRowBytesFromSchema
(
pTable
->
schema
),
5
,
10
);
tdInitDataCols
(
pDataCols
,
pTable
->
schema
);
tsdbLoadDataBlock
(
&
pGroup
->
files
[
TSDB_FILE_TYPE_DATA
],
pBlock
,
1
,
pDataCols
,
pCompData
);
int
k
=
0
;
int
k
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录