Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c59b5285
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
提交
c59b5285
编写于
6月 05, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more refact
上级
5a859105
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
47 deletion
+44
-47
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+2
-2
source/dnode/vnode/src/tsdb/tsdbCommit2.c
source/dnode/vnode/src/tsdb/tsdbCommit2.c
+41
-44
source/dnode/vnode/src/tsdb/tsdbFile.c
source/dnode/vnode/src/tsdb/tsdbFile.c
+1
-1
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
c59b5285
...
...
@@ -263,12 +263,12 @@ struct TSDBKEY {
};
typedef
struct
{
uint64_t
suid
;
uint64_t
uid
;
uint32_t
len
;
uint32_t
offset
;
uint32_t
hasLast
:
2
;
uint32_t
numOfBlocks
:
30
;
uint64_t
suid
;
uint64_t
uid
;
TSDBKEY
maxKey
;
}
SBlockIdx
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit2.c
浏览文件 @
c59b5285
...
...
@@ -20,6 +20,9 @@ typedef struct {
int32_t
minutes
;
int8_t
precision
;
TSKEY
nCommitKey
;
int32_t
fid
;
TSKEY
minKey
;
TSKEY
maxKey
;
SReadH
readh
;
SDFileSet
wSet
;
SArray
*
aBlkIdx
;
...
...
@@ -180,11 +183,11 @@ static int32_t tsdbCommitTable(SCommitH *pCHandle, SMemData *pMemData, SBlockIdx
// commit table impl
if
(
pMemData
&&
pBlockIdx
)
{
//
merge
//
TODO
}
else
if
(
pMemData
)
{
//
new one
//
TODO
}
else
{
//
save old ones
//
TODO
}
// commit table end
...
...
@@ -224,9 +227,13 @@ static int32_t tsdbWriteBlockIdx(SDFile *pFile, SArray *pArray, uint8_t **ppBuf)
return
code
;
}
static
int32_t
tsdbCommitFileStart
(
SCommitH
*
pCHandle
,
int32_t
fid
)
{
int32_t
code
=
0
;
// TODO
static
int32_t
tsdbCommitFileStart
(
SCommitH
*
pCHandle
)
{
int32_t
code
=
0
;
STsdb
*
pTsdb
=
pCHandle
->
pMemTable
->
pTsdb
;
SDFileSet
*
pSet
=
NULL
;
taosArrayClear
(
pCHandle
->
aBlkIdx
);
return
code
;
}
...
...
@@ -236,61 +243,50 @@ static int32_t tsdbCommitFileEnd(SCommitH *pCHandle) {
return
code
;
}
static
int32_t
tsdbCommitFile
(
SCommitH
*
pCHandle
,
int32_t
fid
)
{
int32_t
code
=
0
;
SMemDataIter
iter
=
{
0
};
TSDBROW
*
pRow
=
NULL
;
int8_t
hasData
=
0
;
TSKEY
fidSKey
;
TSKEY
fidEKey
;
int32_t
iMemData
;
int32_t
nMemData
;
int32_t
iBlockIdx
;
int32_t
nBlockIdx
;
pCHandle
->
nCommitKey
=
TSKEY_MAX
;
// create or open the file to commit(todo)
code
=
tsdbCommitFileStart
(
pCHandle
,
fid
);
static
int32_t
tsdbCommitFile
(
SCommitH
*
pCHandle
)
{
int32_t
code
=
0
;
SMemData
*
pMemData
;
SBlockIdx
*
pBlockIdx
;
int32_t
iMemData
;
int32_t
nMemData
;
int32_t
iBlockIdx
;
int32_t
nBlockIdx
;
// commit file start
code
=
tsdbCommitFileStart
(
pCHandle
);
if
(
code
)
{
goto
_err
;
}
//
loop to commit each table data
//
commit file impl
iMemData
=
0
;
nMemData
=
taosArrayGetSize
(
pCHandle
->
pMemTable
->
aMemData
);
iBlockIdx
=
0
;
nBlockIdx
=
0
;
nBlockIdx
=
0
;
// todo
for
(;;)
{
if
(
iBlockIdx
>=
nBlockIdx
&&
iMemData
>=
nMemData
)
{
// code = tsdbWriteBlockIdx();
// if (code) {
// goto _err;
// }
break
;
}
if
(
iMemData
>=
nMemData
&&
iBlockIdx
>=
nBlockIdx
)
break
;
SMemData
*
pMemData
=
NULL
;
SBlockIdx
*
pBlockIdx
=
NULL
;
pMemData
=
NULL
;
pBlockIdx
=
NULL
;
if
(
iMemData
<
nMemData
)
{
pMemData
=
(
SMemData
*
)
taosArrayGetP
(
pCHandle
->
pMemTable
->
aMemData
,
i
BlockIdx
);
pMemData
=
(
SMemData
*
)
taosArrayGetP
(
pCHandle
->
pMemTable
->
aMemData
,
i
MemData
);
}
if
(
iBlockIdx
<
nBlockIdx
)
{
// pBlockIdx
// pBlockIdx
= ;
}
if
(
pMemData
&&
pBlockIdx
)
{
int32_t
c
=
tsdbTableIdCmprFn
(
&
(
TABLEID
){.
suid
=
pMemData
->
suid
,
.
uid
=
pMemData
->
uid
},
&
(
TABLEID
){.
suid
=
pBlockIdx
->
suid
,
.
uid
=
pBlockIdx
->
uid
});
if
(
c
==
0
)
{
int32_t
c
=
tsdbTableIdCmprFn
(
pMemData
,
pBlockIdx
);
if
(
c
<
0
)
{
iMemData
++
;
iBlockIdx
++
;
}
else
if
(
c
<
0
)
{
pBlockIdx
=
NULL
;
}
else
if
(
c
==
0
)
{
iMemData
++
;
iBlockIdx
++
;
}
else
{
pMemData
=
NULL
;
iBlockIdx
++
;
pMemData
=
NULL
;
}
}
else
{
if
(
pMemData
)
{
...
...
@@ -306,7 +302,7 @@ static int32_t tsdbCommitFile(SCommitH *pCHandle, int32_t fid) {
}
}
// c
lose file
// c
ommit file end
code
=
tsdbCommitFileEnd
(
pCHandle
);
if
(
code
)
{
goto
_err
;
...
...
@@ -328,8 +324,9 @@ static int32_t tsdbCommitData(SCommitH *pCHandle) {
for
(;;)
{
if
(
pCHandle
->
nCommitKey
==
TSKEY_MAX
)
break
;
fid
=
TSDB_KEY_FID
(
pCHandle
->
nCommitKey
,
pCHandle
->
minutes
,
pCHandle
->
precision
);
code
=
tsdbCommitFile
(
pCHandle
,
fid
);
pCHandle
->
fid
=
TSDB_KEY_FID
(
pCHandle
->
nCommitKey
,
pCHandle
->
minutes
,
pCHandle
->
precision
);
tsdbGetFidKeyRange
(
pCHandle
->
minutes
,
pCHandle
->
precision
,
pCHandle
->
fid
,
&
pCHandle
->
minKey
,
&
pCHandle
->
maxKey
);
code
=
tsdbCommitFile
(
pCHandle
);
if
(
code
)
{
goto
_err
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbFile.c
浏览文件 @
c59b5285
...
...
@@ -25,7 +25,7 @@ static const char *TSDB_FNAME_SUFFIX[] = {
"meta"
,
// TSDB_FILE_META
};
static
void
tsdbGetFilename
(
int
vid
,
int
fid
,
uint32_t
ver
,
TSDB_FILE_T
ftype
,
const
char
*
dname
,
char
*
fname
);
static
void
tsdbGetFilename
(
int
vid
,
int
fid
,
uint32_t
ver
,
TSDB_FILE_T
ftype
,
const
char
*
dname
,
char
*
fname
);
// static int tsdbRollBackMFile(SMFile *pMFile);
static
int
tsdbEncodeDFInfo
(
void
**
buf
,
SDFInfo
*
pInfo
);
static
void
*
tsdbDecodeDFInfo
(
void
*
buf
,
SDFInfo
*
pInfo
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录