Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
987708ac
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
987708ac
编写于
3月 22, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-34
上级
a9cf4bd3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
6 deletion
+26
-6
src/common/src/dataformat.c
src/common/src/dataformat.c
+1
-1
src/vnode/tsdb/src/tsdbMain.c
src/vnode/tsdb/src/tsdbMain.c
+18
-2
src/vnode/tsdb/src/tsdbMeta.c
src/vnode/tsdb/src/tsdbMeta.c
+4
-0
src/vnode/tsdb/tests/tsdbTests.cpp
src/vnode/tsdb/tests/tsdbTests.cpp
+3
-3
未找到文件。
src/common/src/dataformat.c
浏览文件 @
987708ac
...
...
@@ -150,7 +150,7 @@ void tdFreeSchema(STSchema *pSchema) {
*/
void
tdUpdateSchema
(
STSchema
*
pSchema
)
{
STColumn
*
pCol
=
NULL
;
int32_t
offset
=
0
;
int32_t
offset
=
TD_DATA_ROW_HEAD_SIZE
;
for
(
int
i
=
0
;
i
<
schemaNCols
(
pSchema
);
i
++
)
{
pCol
=
schemaColAt
(
pSchema
,
i
);
colSetOffset
(
pCol
,
offset
);
...
...
src/vnode/tsdb/src/tsdbMain.c
浏览文件 @
987708ac
...
...
@@ -718,7 +718,7 @@ static int32_t tsdbInsertDataToTable(tsdb_repo_t *repo, SSubmitBlk *pBlock) {
return
0
;
}
static
int
tsdbReadRowsFromCache
(
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
void
*
dst
)
{
static
int
tsdbReadRowsFromCache
(
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCol
**
cols
,
STSchema
*
pSchema
)
{
int
numOfRows
=
0
;
do
{
SSkipListNode
*
node
=
tSkipListIterGet
(
pIter
);
...
...
@@ -727,6 +727,11 @@ static int tsdbReadRowsFromCache(SSkipListIterator *pIter, TSKEY maxKey, int max
SDataRow
row
=
SL_GET_NODE_DATA
(
node
);
if
(
dataRowKey
(
row
)
>
maxKey
)
break
;
// Convert row data to column data
// for (int i = 0; i < schemaNCols(pSchema); i++) {
// STColumn *pCol = schemaColAt(pSchema, i);
// memcpy(cols[i]->data + TYPE_BYTES[colType(pCol)] * numOfRows, dataRowAt(row, pCol->offset),
// TYPE_BYTES[colType(pCol)]);
// }
numOfRows
++
;
if
(
numOfRows
>
maxRowsToRead
)
break
;
...
...
@@ -754,6 +759,8 @@ static void *tsdbCommitToFile(void *arg) {
int
maxCols
=
pMeta
->
maxCols
;
int
maxBytes
=
pMeta
->
maxRowBytes
;
SDataCol
**
cols
=
(
SDataCol
**
)
malloc
(
sizeof
(
SDataCol
*
)
*
maxCols
);
void
*
buf
=
malloc
((
maxBytes
+
sizeof
(
SDataCol
))
*
pCfg
->
maxRowsPerFileBlock
);
for
(
int
fid
=
sfid
;
fid
<=
efid
;
fid
++
)
{
TSKEY
minKey
=
0
,
maxKey
=
0
;
...
...
@@ -771,9 +778,16 @@ static void *tsdbCommitToFile(void *arg) {
}
}
// Init row data part
cols
[
0
]
=
(
SDataCol
*
)
buf
;
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
);
}
// Loop the iterator
int
rowsRead
=
0
;
while
((
rowsRead
=
tsdbReadRowsFromCache
(
iters
[
tid
],
maxKey
,
pCfg
->
maxRowsPerFileBlock
,
NULL
))
>
0
)
{
while
((
rowsRead
=
tsdbReadRowsFromCache
(
iters
[
tid
],
maxKey
,
pCfg
->
maxRowsPerFileBlock
,
cols
,
pTable
->
schema
))
>
0
)
{
int
k
=
0
;
}
}
...
...
@@ -784,6 +798,8 @@ static void *tsdbCommitToFile(void *arg) {
if
(
iters
[
tid
]
!=
NULL
)
tSkipListDestroyIter
(
iters
[
tid
]);
}
free
(
buf
);
free
(
cols
);
free
(
iters
);
return
NULL
;
...
...
src/vnode/tsdb/src/tsdbMeta.c
浏览文件 @
987708ac
...
...
@@ -236,6 +236,10 @@ int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) {
table
->
type
=
TSDB_NORMAL_TABLE
;
table
->
superUid
=
-
1
;
table
->
schema
=
tdDupSchema
(
pCfg
->
schema
);
if
(
schemaNCols
(
table
->
schema
)
>
pMeta
->
maxCols
)
pMeta
->
maxCols
=
schemaNCols
(
table
->
schema
);
tdUpdateSchema
(
table
->
schema
);
int
bytes
=
tdMaxRowBytesFromSchema
(
table
->
schema
);
if
(
bytes
>
pMeta
->
maxRowBytes
)
pMeta
->
maxRowBytes
=
bytes
;
}
// Register to meta
...
...
src/vnode/tsdb/tests/tsdbTests.cpp
浏览文件 @
987708ac
...
...
@@ -6,7 +6,7 @@
#include "tsdbFile.h"
#include "tsdbMeta.h"
TEST
(
TsdbTest
,
tableEncodeDecode
)
{
TEST
(
TsdbTest
,
DISABLED_
tableEncodeDecode
)
{
STable
*
pTable
=
(
STable
*
)
malloc
(
sizeof
(
STable
));
pTable
->
type
=
TSDB_NORMAL_TABLE
;
...
...
@@ -106,12 +106,12 @@ TEST(TsdbTest, createRepo) {
}
TEST
(
TsdbTest
,
openRepo
)
{
TEST
(
TsdbTest
,
DISABLED_
openRepo
)
{
tsdb_repo_t
*
pRepo
=
tsdbOpenRepo
(
"/home/ubuntu/work/ttest/vnode0"
);
ASSERT_NE
(
pRepo
,
nullptr
);
}
TEST
(
TsdbTest
,
createFileGroup
)
{
TEST
(
TsdbTest
,
DISABLED_
createFileGroup
)
{
SFileGroup
fGroup
;
ASSERT_EQ
(
tsdbCreateFileGroup
(
"/home/ubuntu/work/ttest/vnode0/data"
,
1820
,
&
fGroup
,
1000
),
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录