Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2b14e552
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
提交
2b14e552
编写于
3月 28, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-34
上级
5470057d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
44 addition
and
64 deletion
+44
-64
src/common/src/dataformat.c
src/common/src/dataformat.c
+12
-1
src/vnode/tsdb/inc/tsdbFile.h
src/vnode/tsdb/inc/tsdbFile.h
+0
-2
src/vnode/tsdb/src/tsdbFile.c
src/vnode/tsdb/src/tsdbFile.c
+0
-59
src/vnode/tsdb/src/tsdbMain.c
src/vnode/tsdb/src/tsdbMain.c
+32
-2
未找到文件。
src/common/src/dataformat.c
浏览文件 @
2b14e552
...
...
@@ -355,7 +355,18 @@ void tdAppendDataRowToDataCol(SDataRow row, SDataCols *pCols) {
}
// Pop pointsToPop points from the SDataCols
void
tdPopDataColsPoints
(
SDataCols
*
pCols
,
int
pointsToPop
)
{
int
pointsLeft
=
pCols
->
numOfPoints
-
pointsToPop
;
for
(
int
iCol
=
0
;
iCol
<
pCols
->
numOfCols
;
iCol
++
)
{
SDataCol
*
p_col
=
pCols
->
cols
+
iCol
;
if
(
p_col
->
len
>
0
)
{
p_col
->
len
=
TYPE_BYTES
[
p_col
->
type
]
*
pointsLeft
;
if
(
pointsLeft
>
0
)
{
memmove
((
void
*
)(
p_col
->
pData
),
(
void
*
)((
char
*
)(
p_col
->
pData
)
+
TYPE_BYTES
[
p_col
->
type
]
*
pointsToPop
),
p_col
->
len
);
}
}
}
pCols
->
numOfPoints
=
pointsLeft
;
}
/**
...
...
src/vnode/tsdb/inc/tsdbFile.h
浏览文件 @
2b14e552
...
...
@@ -148,8 +148,6 @@ int tsdbLoadDataBlock(SFile *pFile, SCompBlock *pStartBlock, int numOfBlocks, SD
// TODO: need an API to merge all sub-block data into one
int
tsdbWriteBlockToFile
(
SFileGroup
*
pGroup
,
SCompInfo
*
pCompInfo
,
SCompIdx
*
pIdx
,
int
isMerge
,
SCompBlock
*
pBlock
,
SDataCols
*
pCols
);
void
tsdbGetKeyRangeOfFileId
(
int32_t
daysPerFile
,
int8_t
precision
,
int32_t
fileId
,
TSKEY
*
minKey
,
TSKEY
*
maxKey
);
#ifdef __cplusplus
}
...
...
src/vnode/tsdb/src/tsdbFile.c
浏览文件 @
2b14e552
...
...
@@ -196,65 +196,6 @@ int tsdbLoadColData(SFile *pFile, SCompCol *pCol, int64_t blockBaseOffset, void
return
0
;
}
static
int
tsdbWriteBlockToFileImpl
(
SFile
*
pFile
,
// File to write
SDataCols
*
pCols
,
// Data column buffer
int
numOfPointsToWrie
,
// Number of points to write to the file
SCompBlock
*
pBlock
// SCompBlock to hold block information to return
)
{
// pBlock->last = 0;
// pBlock->offset = lseek(pFile->fd, 0, SEEK_END);
// // pBlock->algorithm = ;
// pBlock->numOfPoints = pCols->numOfPoints;
// // pBlock->sversion = ;
// // pBlock->len = ;
// pBlock->numOfSubBlocks = 1;
// pBlock->keyFirst = dataColsKeyFirst(pCols);
// pBlock->keyLast = dataColsKeyLast(pCols);
// for (int i = 0; i < pCols->numOfCols; i++) {
// // TODO: if all col value is NULL, do not save it
// pBlock->numOfCols++;
// pCompData->numOfCols++;
// SCompCol *pCompCol = pCompData->cols + i;
// pCompCol->colId = pCols->cols[i].colId;
// pCompCol->type = pCols->cols[i].type;
// // pCompCol->len = ;
// // pCompCol->offset = ;
// }
return
0
;
}
int
tsdbWriteBlockToFile
(
SFileGroup
*
pGroup
,
SCompInfo
*
pCompInfo
,
SCompIdx
*
pIdx
,
int
isMerge
,
SCompBlock
*
pBlock
,
SDataCols
*
pCols
)
{
memset
((
void
*
)
pBlock
,
0
,
sizeof
(
SCompBlock
));
SFile
*
pFile
=
NULL
;
SCompData
*
pCompData
=
(
SCompData
*
)
malloc
(
sizeof
(
SCompData
)
+
sizeof
(
SCompCol
)
*
pCols
->
numOfCols
);
if
(
pCompData
==
NULL
)
return
-
1
;
pCompData
->
delimiter
=
TSDB_FILE_DELIMITER
;
// pCompData->uid = ;
if
(
isMerge
)
{
TSKEY
keyFirst
=
dataColsKeyFirst
(
pCols
);
// 1. Binary search the block the data can merged into
if
(
1
/* the data should only merged into last file */
)
{
}
else
{
}
}
else
{
// Write directly to the file without merge
if
(
1
/*pCols->numOfPoints < pCfg->minRowsPerFileBlock*/
)
{
// TODO: write the data to the last file
}
else
{
// TODO: wirte the data to the data file
}
}
// TODO: need to update pIdx
if
(
pCompData
)
free
(
pCompData
);
return
0
;
}
static
int
compFGroupKey
(
const
void
*
key
,
const
void
*
fgroup
)
{
int
fid
=
*
(
int
*
)
key
;
SFileGroup
*
pFGroup
=
(
SFileGroup
*
)
fgroup
;
...
...
src/vnode/tsdb/src/tsdbMain.c
浏览文件 @
2b14e552
...
...
@@ -967,9 +967,26 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
tsdbReadRowsFromCache
(
pIter
,
maxKey
,
maxRowsToRead
,
pCols
);
if
(
pCols
->
numOfPoints
==
0
)
break
;
// TODO
int
pointsWritten
=
0
;
/* tsdbWriteBlockToFile(); */
int
pointsWritten
=
0
;
// { // TODO : try to write the block data to file
// if (!isCompBlockLoaded) { // Just append
// if (pCols->numOfPoints > pCfg->minRowsPerFileBlock) { // write directly to .data file
// lseek(pGroup->files[TSDB_FILE_TYPE_DATA], 0, SEEK_END);
// } else {
// if (isNewLastFile) { // write directly to .l file
// } else { // write directly to .last file
// }
// }
// } else { // Need to append
// // SCompBlock *pTBlock = NULL;
// }
// }
pointsWritten
=
pCols
->
numOfPoints
;
tdPopDataColsPoints
(
pCols
,
pointsWritten
);
maxRowsToRead
=
pCfg
->
maxRowsPerFileBlock
*
4
/
5
-
pCols
->
numOfPoints
;
}
// Write the SCompBlock part
...
...
@@ -1022,4 +1039,17 @@ static int tsdbHasDataToCommit(SSkipListIterator **iters, int nIters, TSKEY minK
if
(
tsdbHasDataInRange
(
pIter
,
minKey
,
maxKey
))
return
1
;
}
return
0
;
}
static
int
tsdbWriteBlockToFile
(
STsdbRepo
*
pRepo
,
SCompIdx
*
pIdx
,
SCompInfo
*
pCompInfo
,
SDataCols
*
pCols
,
SCompBlock
*
pCompBlock
)
{
STsdbCfg
*
pCfg
=
&
(
pRepo
->
config
);
memset
((
void
*
)
pCompBlock
,
0
,
sizeof
(
SCompBlock
));
if
(
pCompInfo
==
NULL
)
{
// Just need to append to file
}
else
{
// Need to merge
}
return
0
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录