Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
377517ee
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看板
提交
377517ee
编写于
3月 24, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-34
上级
e0863b4c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
37 deletion
+38
-37
src/vnode/tsdb/src/tsdbMain.c
src/vnode/tsdb/src/tsdbMain.c
+37
-36
src/vnode/tsdb/tests/tsdbTests.cpp
src/vnode/tsdb/tests/tsdbTests.cpp
+1
-1
未找到文件。
src/vnode/tsdb/src/tsdbMain.c
浏览文件 @
377517ee
...
@@ -818,6 +818,7 @@ static SSkipListIterator **tsdbCreateTableIters(STsdbMeta *pMeta, int maxTables)
...
@@ -818,6 +818,7 @@ static SSkipListIterator **tsdbCreateTableIters(STsdbMeta *pMeta, int maxTables)
// Commit to file
// Commit to file
static
void
*
tsdbCommitToFile
(
void
*
arg
)
{
static
void
*
tsdbCommitToFile
(
void
*
arg
)
{
// TODO
// TODO
printf
(
"Starting to commit....
\n
"
);
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
arg
;
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
arg
;
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
STsdbCache
*
pCache
=
pRepo
->
tsdbCache
;
STsdbCache
*
pCache
=
pRepo
->
tsdbCache
;
...
@@ -836,42 +837,42 @@ static void *tsdbCommitToFile(void *arg) {
...
@@ -836,42 +837,42 @@ static void *tsdbCommitToFile(void *arg) {
SDataCol
**
cols
=
(
SDataCol
**
)
malloc
(
sizeof
(
SDataCol
*
)
*
maxCols
);
SDataCol
**
cols
=
(
SDataCol
**
)
malloc
(
sizeof
(
SDataCol
*
)
*
maxCols
);
void
*
buf
=
malloc
((
maxBytes
+
sizeof
(
SDataCol
))
*
pCfg
->
maxRowsPerFileBlock
);
void
*
buf
=
malloc
((
maxBytes
+
sizeof
(
SDataCol
))
*
pCfg
->
maxRowsPerFileBlock
);
//
int sfid = tsdbGetKeyFileId(pCache->imem->keyFirst, pCfg->daysPerFile, pCfg->precision);
int
sfid
=
tsdbGetKeyFileId
(
pCache
->
imem
->
keyFirst
,
pCfg
->
daysPerFile
,
pCfg
->
precision
);
//
int efid = tsdbGetKeyFileId(pCache->imem->keyLast, pCfg->daysPerFile, pCfg->precision);
int
efid
=
tsdbGetKeyFileId
(
pCache
->
imem
->
keyLast
,
pCfg
->
daysPerFile
,
pCfg
->
precision
);
//
for (int fid = sfid; fid <= efid; fid++) {
for
(
int
fid
=
sfid
;
fid
<=
efid
;
fid
++
)
{
//
TSKEY minKey = 0, maxKey = 0;
TSKEY
minKey
=
0
,
maxKey
=
0
;
//
tsdbGetKeyRangeOfFileId(pCfg->daysPerFile, pCfg->precision, fid, &minKey, &maxKey);
tsdbGetKeyRangeOfFileId
(
pCfg
->
daysPerFile
,
pCfg
->
precision
,
fid
,
&
minKey
,
&
maxKey
);
//
// tsdbOpenFileForWrite(pRepo, fid);
// tsdbOpenFileForWrite(pRepo, fid);
//
for (int tid = 0; tid < pCfg->maxTables; tid++) {
for
(
int
tid
=
0
;
tid
<
pCfg
->
maxTables
;
tid
++
)
{
//
STable *pTable = pMeta->tables[tid];
STable
*
pTable
=
pMeta
->
tables
[
tid
];
//
if (pTable == NULL || pTable->imem == NULL) continue;
if
(
pTable
==
NULL
||
pTable
->
imem
==
NULL
)
continue
;
//
if (iters[tid] == NULL) { // create table iterator
if
(
iters
[
tid
]
==
NULL
)
{
// create table iterator
//
iters[tid] = tSkipListCreateIter(pTable->imem->pData);
iters
[
tid
]
=
tSkipListCreateIter
(
pTable
->
imem
->
pData
);
//
// TODO: deal with the error
// TODO: deal with the error
//
if (iters[tid] == NULL) break;
if
(
iters
[
tid
]
==
NULL
)
break
;
//
if (!tSkipListIterNext(iters[tid])) {
if
(
!
tSkipListIterNext
(
iters
[
tid
]))
{
//
// assert(0);
// assert(0);
//
}
}
//
}
}
//
// Init row data part
// Init row data part
//
cols[0] = (SDataCol *)buf;
cols
[
0
]
=
(
SDataCol
*
)
buf
;
//
for (int col = 1; col < schemaNCols(pTable->schema); col++) {
for
(
int
col
=
1
;
col
<
schemaNCols
(
pTable
->
schema
);
col
++
)
{
//
cols[col] = (SDataCol *)((char *)(cols[col - 1]) + sizeof(SDataCol) + colBytes(schemaColAt(pTable->schema, col-1)) * pCfg->maxRowsPerFileBlock);
cols
[
col
]
=
(
SDataCol
*
)((
char
*
)(
cols
[
col
-
1
])
+
sizeof
(
SDataCol
)
+
colBytes
(
schemaColAt
(
pTable
->
schema
,
col
-
1
))
*
pCfg
->
maxRowsPerFileBlock
);
//
}
}
//
// Loop the iterator
// Loop the iterator
//
int rowsRead = 0;
int
rowsRead
=
0
;
//
while ((rowsRead = tsdbReadRowsFromCache(iters[tid], maxKey, pCfg->maxRowsPerFileBlock, cols, pTable->schema)) >
while
((
rowsRead
=
tsdbReadRowsFromCache
(
iters
[
tid
],
maxKey
,
pCfg
->
maxRowsPerFileBlock
,
cols
,
pTable
->
schema
))
>
//
0) {
0
)
{
//
// printf("rowsRead:%d-----------\n", rowsRead);
// printf("rowsRead:%d-----------\n", rowsRead);
//
int k = 0;
int
k
=
0
;
//
}
}
//
}
}
//
}
}
tsdbDestroyTableIters
(
iters
,
pCfg
->
maxTables
);
tsdbDestroyTableIters
(
iters
,
pCfg
->
maxTables
);
...
...
src/vnode/tsdb/tests/tsdbTests.cpp
浏览文件 @
377517ee
...
@@ -142,7 +142,7 @@ TEST(TsdbTest, DISABLED_openRepo) {
...
@@ -142,7 +142,7 @@ TEST(TsdbTest, DISABLED_openRepo) {
TEST
(
TsdbTest
,
DISABLED_createFileGroup
)
{
TEST
(
TsdbTest
,
DISABLED_createFileGroup
)
{
SFileGroup
fGroup
;
SFileGroup
fGroup
;
ASSERT_EQ
(
tsdbCreateFileGroup
(
"/home/ubuntu/work/ttest/vnode0/data"
,
1820
,
&
fGroup
,
1000
),
0
);
//
ASSERT_EQ(tsdbCreateFileGroup("/home/ubuntu/work/ttest/vnode0/data", 1820, &fGroup, 1000), 0);
int
k
=
0
;
int
k
=
0
;
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录