Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
f909434a
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看板
提交
f909434a
编写于
3月 10, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adjust code
上级
555c1507
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
35 deletion
+33
-35
src/vnode/CMakeLists.txt
src/vnode/CMakeLists.txt
+0
-3
src/vnode/tsdb/CMakeLists.txt
src/vnode/tsdb/CMakeLists.txt
+1
-1
src/vnode/tsdb/tests/tsdbTests.cpp
src/vnode/tsdb/tests/tsdbTests.cpp
+32
-31
未找到文件。
src/vnode/CMakeLists.txt
浏览文件 @
f909434a
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
PROJECT
(
TDengine
)
# ADD_SUBDIRECTORY(common)
ADD_SUBDIRECTORY
(
wal
)
ADD_SUBDIRECTORY
(
wal
)
ADD_SUBDIRECTORY
(
tsdb
)
ADD_SUBDIRECTORY
(
tsdb
)
# ENABLE_TESTING()
# ADD_SUBDIRECTORY(tests)
src/vnode/tsdb/CMakeLists.txt
浏览文件 @
f909434a
...
@@ -14,5 +14,5 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
...
@@ -14,5 +14,5 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
TARGET_LINK_LIBRARIES
(
tsdb common tutil
)
TARGET_LINK_LIBRARIES
(
tsdb common tutil
)
# Someone has no gtest directory, so comment it
# Someone has no gtest directory, so comment it
#
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY
(
tests
)
ENDIF
()
ENDIF
()
src/vnode/tsdb/tests/tsdbTests.cpp
浏览文件 @
f909434a
...
@@ -2,9 +2,10 @@
...
@@ -2,9 +2,10 @@
#include <stdlib.h>
#include <stdlib.h>
#include "tsdb.h"
#include "tsdb.h"
#include "dataformat.h"
#include "tsdbMeta.h"
#include "tsdbMeta.h"
TEST
(
TsdbTest
,
DISABLED_
createTable
)
{
TEST
(
TsdbTest
,
createTable
)
{
STsdbMeta
*
pMeta
=
tsdbCreateMeta
(
100
);
STsdbMeta
*
pMeta
=
tsdbCreateMeta
(
100
);
ASSERT_NE
(
pMeta
,
nullptr
);
ASSERT_NE
(
pMeta
,
nullptr
);
...
@@ -14,7 +15,7 @@ TEST(TsdbTest, DISABLED_createTable) {
...
@@ -14,7 +15,7 @@ TEST(TsdbTest, DISABLED_createTable) {
config
.
numOfCols
=
5
;
config
.
numOfCols
=
5
;
config
.
schema
=
tdNewSchema
(
config
.
numOfCols
);
config
.
schema
=
tdNewSchema
(
config
.
numOfCols
);
for
(
int
i
=
0
;
i
<
schemaNCols
(
config
.
schema
);
i
++
)
{
for
(
int
i
=
0
;
i
<
schemaNCols
(
config
.
schema
);
i
++
)
{
S
Column
*
pCol
=
tdNewCol
(
TD_DATA
TYPE_BIGINT
,
i
,
0
);
S
TColumn
*
pCol
=
tdNewCol
(
TSDB_DATA_
TYPE_BIGINT
,
i
,
0
);
tdColCpy
(
schemaColAt
(
config
.
schema
,
i
),
pCol
);
tdColCpy
(
schemaColAt
(
config
.
schema
,
i
),
pCol
);
tdFreeCol
(
pCol
);
tdFreeCol
(
pCol
);
}
}
...
@@ -40,11 +41,11 @@ TEST(TsdbTest, createRepo) {
...
@@ -40,11 +41,11 @@ TEST(TsdbTest, createRepo) {
config
.
tableId
.
uid
=
98868728187539L
;
config
.
tableId
.
uid
=
98868728187539L
;
config
.
numOfCols
=
5
;
config
.
numOfCols
=
5
;
config
.
schema
=
tdNewSchema
(
config
.
numOfCols
);
config
.
schema
=
tdNewSchema
(
config
.
numOfCols
);
S
Column
*
pCol
=
tdNewCol
(
TD_DATA
TYPE_TIMESTAMP
,
0
,
0
);
S
TColumn
*
pCol
=
tdNewCol
(
TSDB_DATA_
TYPE_TIMESTAMP
,
0
,
0
);
tdColCpy
(
schemaColAt
(
config
.
schema
,
0
),
pCol
);
tdColCpy
(
schemaColAt
(
config
.
schema
,
0
),
pCol
);
tdFreeCol
(
pCol
);
tdFreeCol
(
pCol
);
for
(
int
i
=
1
;
i
<
schemaNCols
(
config
.
schema
);
i
++
)
{
for
(
int
i
=
1
;
i
<
schemaNCols
(
config
.
schema
);
i
++
)
{
pCol
=
tdNewCol
(
T
D_DATA
TYPE_BIGINT
,
i
,
0
);
pCol
=
tdNewCol
(
T
SDB_DATA_
TYPE_BIGINT
,
i
,
0
);
tdColCpy
(
schemaColAt
(
config
.
schema
,
i
),
pCol
);
tdColCpy
(
schemaColAt
(
config
.
schema
,
i
),
pCol
);
tdFreeCol
(
pCol
);
tdFreeCol
(
pCol
);
}
}
...
@@ -52,41 +53,41 @@ TEST(TsdbTest, createRepo) {
...
@@ -52,41 +53,41 @@ TEST(TsdbTest, createRepo) {
tsdbCreateTable
(
pRepo
,
&
config
);
tsdbCreateTable
(
pRepo
,
&
config
);
// Write some data
// Write some data
int32_t
size
=
sizeof
(
SSubmitMsg
)
+
sizeof
(
SSubmitBlock
)
+
tdMaxRowDataBytes
(
config
.
schema
)
*
10
+
sizeof
(
int32_t
);
//
int32_t size = sizeof(SSubmitMsg) + sizeof(SSubmitBlock) + tdMaxRowDataBytes(config.schema) * 10 + sizeof(int32_t);
tdUpdateSchema
(
config
.
schema
);
//
tdUpdateSchema(config.schema);
SSubmitMsg
*
pMsg
=
(
SSubmitMsg
*
)
malloc
(
size
);
//
SSubmitMsg *pMsg = (SSubmitMsg *)malloc(size);
pMsg
->
numOfTables
=
1
;
// TODO: use api
//
pMsg->numOfTables = 1; // TODO: use api
SSubmitBlock
*
pBlock
=
(
SSubmitBlock
*
)
pMsg
->
data
;
//
SSubmitBlock *pBlock = (SSubmitBlock *)pMsg->data;
pBlock
->
tableId
=
{.
uid
=
98868728187539L
,
.
tid
=
0
};
//
pBlock->tableId = {.uid = 98868728187539L, .tid = 0};
pBlock
->
sversion
=
0
;
//
pBlock->sversion = 0;
pBlock
->
len
=
sizeof
(
SSubmitBlock
);
//
pBlock->len = sizeof(SSubmitBlock);
SDataRows
rows
=
pBlock
->
data
;
//
SDataRows rows = pBlock->data;
dataRowsInit
(
rows
);
//
dataRowsInit(rows);
SDataRow
row
=
tdNewDataRow
(
tdMaxRowDataBytes
(
config
.
schema
));
//
SDataRow row = tdNewDataRow(tdMaxRowDataBytes(config.schema));
int64_t
ttime
=
1583508800000
;
//
int64_t ttime = 1583508800000;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
// loop over rows
//
for (int i = 0; i < 10; i++) { // loop over rows
ttime
+=
(
10000
*
i
);
//
ttime += (10000 * i);
tdDataRowReset
(
row
);
//
tdDataRowReset(row);
for
(
int
j
=
0
;
j
<
schemaNCols
(
config
.
schema
);
j
++
)
{
//
for (int j = 0; j < schemaNCols(config.schema); j++) {
if
(
j
==
0
)
{
// set time stamp
//
if (j == 0) { // set time stamp
tdAppendColVal
(
row
,
(
void
*
)(
&
ttime
),
schemaColAt
(
config
.
schema
,
j
),
40
);
//
tdAppendColVal(row, (void *)(&ttime), schemaColAt(config.schema, j), 40);
}
else
{
// set other fields
//
} else { // set other fields
int32_t
val
=
10
;
//
int32_t val = 10;
tdAppendColVal
(
row
,
(
void
*
)(
&
val
),
schemaColAt
(
config
.
schema
,
j
),
40
);
//
tdAppendColVal(row, (void *)(&val), schemaColAt(config.schema, j), 40);
}
//
}
}
//
}
tdDataRowsAppendRow
(
rows
,
row
);
//
tdDataRowsAppendRow(rows, row);
}
//
}
tsdbInsertData
(
pRepo
,
pMsg
);
//
tsdbInsertData(pRepo, pMsg);
tdFreeDataRow
(
row
);
//
tdFreeDataRow(row);
tdFreeSchema
(
config
.
schema
);
tdFreeSchema
(
config
.
schema
);
tsdbDropRepo
(
pRepo
);
tsdbDropRepo
(
pRepo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录