Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
793502c6
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看板
未验证
提交
793502c6
编写于
4月 22, 2020
作者:
S
slguan
提交者:
GitHub
4月 22, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1676 from taosdata/feature/2.0tsdb
Feature/2.0tsdb
上级
31a90129
4db9f918
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
51 addition
and
4 deletion
+51
-4
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+4
-3
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+1
-0
src/tsdb/tests/tsdbTests.cpp
src/tsdb/tests/tsdbTests.cpp
+46
-1
未找到文件。
src/tsdb/src/tsdbMain.c
浏览文件 @
793502c6
...
...
@@ -283,6 +283,8 @@ int32_t tsdbConfigRepo(TsdbRepoT *repo, STsdbCfg *pCfg) {
int32_t
tsdbTriggerCommit
(
TsdbRepoT
*
repo
)
{
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
if
(
pRepo
->
appH
.
walCallBack
)
pRepo
->
appH
.
walCallBack
(
pRepo
->
appH
.
appH
);
tsdbLockRepo
(
repo
);
if
(
pRepo
->
commit
)
{
tsdbUnLockRepo
(
repo
);
...
...
@@ -387,7 +389,7 @@ int tsdbInitTableCfg(STableCfg *config, ETableType type, int64_t uid, int32_t ti
config
->
superUid
=
TSDB_INVALID_SUPER_TABLE_ID
;
config
->
tableId
.
uid
=
uid
;
config
->
tableId
.
tid
=
tid
;
config
->
name
=
strdup
(
"test1"
)
;
config
->
name
=
NULL
;
return
0
;
}
...
...
@@ -854,8 +856,6 @@ static void *tsdbCommitData(void *arg) {
SRWHelper
whelper
=
{
0
};
if
(
pCache
->
imem
==
NULL
)
return
NULL
;
if
(
pRepo
->
appH
.
walCallBack
)
pRepo
->
appH
.
walCallBack
(
pRepo
->
appH
.
appH
);
// Create the iterator to read from cache
SSkipListIterator
**
iters
=
tsdbCreateTableIters
(
pMeta
,
pCfg
->
maxTables
);
if
(
iters
==
NULL
)
{
...
...
@@ -880,6 +880,7 @@ static void *tsdbCommitData(void *arg) {
_exit:
tdFreeDataCols
(
pDataCols
);
tsdbDestroyTableIters
(
iters
,
pCfg
->
maxTables
);
tsdbDestroyHelper
(
&
whelper
);
tsdbLockRepo
(
arg
);
tdListMove
(
pCache
->
imem
->
list
,
pCache
->
pool
.
memPool
);
...
...
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
793502c6
...
...
@@ -403,6 +403,7 @@ int tsdbWriteCompInfo(SRWHelper *pHelper) {
}
else
{
pHelper
->
pCompInfo
->
delimiter
=
TSDB_FILE_DELIMITER
;
pHelper
->
pCompInfo
->
uid
=
pHelper
->
tableInfo
.
uid
;
pHelper
->
pCompInfo
->
checksum
=
0
;
ASSERT
((
pIdx
->
len
-
sizeof
(
SCompInfo
)
-
sizeof
(
TSCKSUM
))
%
sizeof
(
SCompBlock
)
==
0
);
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pHelper
->
pCompInfo
,
pIdx
->
len
);
pIdx
->
offset
=
lseek
(
pHelper
->
files
.
nHeadF
.
fd
,
0
,
SEEK_END
);
...
...
src/tsdb/tests/tsdbTests.cpp
浏览文件 @
793502c6
...
...
@@ -4,6 +4,7 @@
#include "tdataformat.h"
#include "tsdbMain.h"
#include "tskiplist.h"
static
double
getCurTime
()
{
struct
timeval
tv
;
...
...
@@ -141,6 +142,7 @@ TEST(TsdbTest, createRepo) {
STableCfg
tCfg
;
ASSERT_EQ
(
tsdbInitTableCfg
(
&
tCfg
,
TSDB_SUPER_TABLE
,
987607499877672L
,
0
),
-
1
);
ASSERT_EQ
(
tsdbInitTableCfg
(
&
tCfg
,
TSDB_NORMAL_TABLE
,
987607499877672L
,
0
),
0
);
tsdbTableSetName
(
&
tCfg
,
"test"
,
false
);
int
nCols
=
5
;
STSchema
*
schema
=
tdNewSchema
(
nCols
);
...
...
@@ -167,7 +169,7 @@ TEST(TsdbTest, createRepo) {
.
sversion
=
tCfg
.
sversion
,
.
startTime
=
1584081000000
,
.
interval
=
1000
,
.
totalRows
=
5
000000
,
.
totalRows
=
10
000000
,
.
rowsPerSubmit
=
1
,
.
pSchema
=
schema
};
...
...
@@ -263,3 +265,46 @@ TEST(TsdbTest, DISABLED_createFileGroup) {
int
k
=
0
;
}
static
char
*
getTKey
(
const
void
*
data
)
{
return
(
char
*
)
data
;
}
static
void
insertSkipList
(
bool
isAscend
)
{
TSKEY
start_time
=
1587393453000
;
TSKEY
interval
=
1000
;
SSkipList
*
pList
=
tSkipListCreate
(
5
,
TSDB_DATA_TYPE_TIMESTAMP
,
sizeof
(
TSKEY
),
0
,
0
,
1
,
getTKey
);
ASSERT_NE
(
pList
,
nullptr
);
for
(
size_t
i
=
0
;
i
<
20000000
;
i
++
)
{
TSKEY
time
=
isAscend
?
(
start_time
+
i
*
interval
)
:
(
start_time
-
i
*
interval
);
int32_t
level
=
0
;
int32_t
headSize
=
0
;
tSkipListNewNodeInfo
(
pList
,
&
level
,
&
headSize
);
SSkipListNode
*
pNode
=
(
SSkipListNode
*
)
malloc
(
headSize
+
sizeof
(
TSKEY
));
ASSERT_NE
(
pNode
,
nullptr
);
pNode
->
level
=
level
;
*
(
TSKEY
*
)((
char
*
)
pNode
+
headSize
)
=
time
;
tSkipListPut
(
pList
,
pNode
);
}
tSkipListDestroy
(
pList
);
}
TEST
(
TsdbTest
,
DISABLED_testSkipList
)
{
// TEST(TsdbTest, testSkipList) {
double
stime
=
getCurTime
();
insertSkipList
(
true
);
double
etime
=
getCurTime
();
printf
(
"Time used to insert 100000000 records takes %f seconds
\n
"
,
etime
-
stime
);
stime
=
getCurTime
();
insertSkipList
(
false
);
etime
=
getCurTime
();
printf
(
"Time used to insert 100000000 records takes %f seconds
\n
"
,
etime
-
stime
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录