Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
45e412f2
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看板
未验证
提交
45e412f2
编写于
3月 24, 2020
作者:
H
haojun Liao
提交者:
GitHub
3月 24, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1409 from taosdata/feature/2.0tsdb
Feature/2.0tsdb
上级
88f44b1a
eed1d76b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
10 deletion
+27
-10
src/vnode/tsdb/src/tsdbCache.c
src/vnode/tsdb/src/tsdbCache.c
+12
-7
src/vnode/tsdb/src/tsdbMain.c
src/vnode/tsdb/src/tsdbMain.c
+1
-1
src/vnode/tsdb/tests/tsdbTests.cpp
src/vnode/tsdb/tests/tsdbTests.cpp
+14
-2
未找到文件。
src/vnode/tsdb/src/tsdbCache.c
浏览文件 @
45e412f2
...
...
@@ -17,8 +17,9 @@
#include "tsdb.h"
#include "tsdbCache.h"
static
int
tsdbAllocBlockFromPool
(
STsdbCache
*
pCache
);
static
void
tsdbFreeBlockList
(
SCacheMem
*
mem
);
static
int
tsdbAllocBlockFromPool
(
STsdbCache
*
pCache
);
static
void
tsdbFreeBlockList
(
SList
*
list
);
static
void
tsdbFreeCacheMem
(
SCacheMem
*
mem
);
STsdbCache
*
tsdbInitCache
(
int
maxBytes
,
int
cacheBlockSize
,
tsdb_repo_t
*
pRepo
)
{
STsdbCache
*
pCache
=
(
STsdbCache
*
)
calloc
(
1
,
sizeof
(
STsdbCache
));
...
...
@@ -60,8 +61,8 @@ _err:
}
void
tsdbFreeCache
(
STsdbCache
*
pCache
)
{
tsdbFree
BlockList
(
pCache
->
imem
);
tsdbFree
BlockList
(
pCache
->
mem
);
tsdbFree
CacheMem
(
pCache
->
imem
);
tsdbFree
CacheMem
(
pCache
->
mem
);
tsdbFreeBlockList
(
pCache
->
pool
.
memPool
);
free
(
pCache
);
}
...
...
@@ -90,9 +91,7 @@ void *tsdbAllocFromCache(STsdbCache *pCache, int bytes, TSKEY key) {
return
ptr
;
}
static
void
tsdbFreeBlockList
(
SCacheMem
*
mem
)
{
if
(
mem
==
NULL
)
return
;
SList
*
list
=
mem
->
list
;
static
void
tsdbFreeBlockList
(
SList
*
list
)
{
SListNode
*
node
=
NULL
;
STsdbCacheBlock
*
pBlock
=
NULL
;
while
((
node
=
tdListPopHead
(
list
))
!=
NULL
)
{
...
...
@@ -101,6 +100,12 @@ static void tsdbFreeBlockList(SCacheMem *mem) {
listNodeFree
(
node
);
}
tdListFree
(
list
);
}
static
void
tsdbFreeCacheMem
(
SCacheMem
*
mem
)
{
if
(
mem
==
NULL
)
return
;
SList
*
list
=
mem
->
list
;
tsdbFreeBlockList
(
list
);
free
(
mem
);
}
...
...
src/vnode/tsdb/src/tsdbMain.c
浏览文件 @
45e412f2
...
...
@@ -712,7 +712,7 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
tSkipListRandNodeInfo
(
pTable
->
mem
->
pData
,
&
level
,
&
headSize
);
TSKEY
key
=
dataRowKey
(
row
);
printf
(
"insert:%lld, size:%d
\n
"
,
key
,
pTable
->
mem
->
numOfPoints
);
//
printf("insert:%lld, size:%d\n", key, pTable->mem->numOfPoints);
// Copy row into the memory
SSkipListNode
*
pNode
=
tsdbAllocFromCache
(
pRepo
->
tsdbCache
,
headSize
+
dataRowLen
(
row
),
key
);
...
...
src/vnode/tsdb/tests/tsdbTests.cpp
浏览文件 @
45e412f2
...
...
@@ -79,7 +79,7 @@ TEST(TsdbTest, createRepo) {
// // 3. Loop to write some simple data
int
nRows
=
10000000
;
int
rowsPerSubmit
=
10
0
;
int
rowsPerSubmit
=
10
;
int64_t
start_time
=
1584081000000
;
SSubmitMsg
*
pMsg
=
(
SSubmitMsg
*
)
malloc
(
sizeof
(
SSubmitMsg
)
+
sizeof
(
SSubmitBlk
)
+
tdMaxRowBytesFromSchema
(
schema
)
*
rowsPerSubmit
);
...
...
@@ -88,7 +88,8 @@ TEST(TsdbTest, createRepo) {
for
(
int
k
=
0
;
k
<
nRows
/
rowsPerSubmit
;
k
++
)
{
SSubmitBlk
*
pBlock
=
pMsg
->
blocks
;
pBlock
->
tableId
=
{.
uid
=
987607499877672L
,
.
tid
=
0
};
pBlock
->
uid
=
987607499877672L
;
pBlock
->
tid
=
0
;
pBlock
->
sversion
=
0
;
pBlock
->
len
=
0
;
for
(
int
i
=
0
;
i
<
rowsPerSubmit
;
i
++
)
{
...
...
@@ -107,7 +108,18 @@ TEST(TsdbTest, createRepo) {
}
pBlock
->
len
+=
dataRowLen
(
row
);
}
pBlock
->
len
=
htonl
(
pBlock
->
len
);
pBlock
->
numOfRows
=
htonl
(
pBlock
->
numOfRows
);
pBlock
->
uid
=
htobe64
(
pBlock
->
uid
);
pBlock
->
tid
=
htonl
(
pBlock
->
tid
);
pBlock
->
sversion
=
htonl
(
pBlock
->
sversion
);
pBlock
->
padding
=
htonl
(
pBlock
->
padding
);
pMsg
->
length
=
pMsg
->
length
+
sizeof
(
SSubmitBlk
)
+
pBlock
->
len
;
pMsg
->
length
=
htonl
(
pMsg
->
length
);
pMsg
->
numOfBlocks
=
htonl
(
pMsg
->
numOfBlocks
);
pMsg
->
compressed
=
htonl
(
pMsg
->
numOfBlocks
);
tsdbInsertData
(
pRepo
,
pMsg
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录