Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2ff00f23
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2ff00f23
编写于
6月 10, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more work
上级
17efc22b
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
198 addition
and
46 deletion
+198
-46
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+68
-28
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+64
-4
source/dnode/vnode/src/tsdb/tsdbFS.c
source/dnode/vnode/src/tsdb/tsdbFS.c
+7
-7
source/dnode/vnode/src/tsdb/tsdbFile.c
source/dnode/vnode/src/tsdb/tsdbFile.c
+3
-1
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+56
-6
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
2ff00f23
...
...
@@ -57,7 +57,7 @@ bool tsdbTbDataIterNext(STbDataIter *pIter);
bool
tsdbTbDataIterGet
(
STbDataIter
*
pIter
,
TSDBROW
*
pRow
);
// tsdbFile.c ==============================================================================================
typedef
struct
S
TsdbTombstoneFile
STsdbTombstone
File
;
typedef
struct
S
DelFile
SDel
File
;
typedef
struct
STsdbCacheFile
STsdbCacheFile
;
typedef
struct
STsdbIndexFile
STsdbIndexFile
;
typedef
struct
STsdbDataFile
STsdbDataFile
;
...
...
@@ -74,7 +74,25 @@ int32_t tsdbFSClose(STsdbFS *pFS);
int32_t
tsdbFSStart
(
STsdbFS
*
pFS
);
int32_t
tsdbFSEnd
(
STsdbFS
*
pFS
,
int8_t
rollback
);
// tsdbReaderWritter.c ==============================================================================================
// tsdbReaderWriter.c ==============================================================================================
typedef
struct
SDelData
SDelData
;
typedef
struct
SDelIdx
SDelIdx
;
// SDelFWriter
typedef
struct
SDelFWriter
SDelFWriter
;
int32_t
tsdbDelFWriterOpen
(
SDelFWriter
**
ppWriter
,
SDelFile
*
pFile
);
int32_t
tsdbDelFWriterClose
(
SDelFWriter
*
pWriter
);
int32_t
tsdbWriteDelData
(
SDelFWriter
*
pWriter
,
SDelData
*
pDelData
,
uint8_t
**
ppBuf
);
int32_t
tsdbWriteDelIdx
(
SDelFWriter
*
pWriter
,
SDelIdx
*
pDelIdx
,
uint8_t
**
ppBuf
);
// SDelFReader
typedef
struct
SDelFReader
SDelFReader
;
int32_t
tsdbDelFReaderOpen
(
SDelFReader
*
pReader
,
SDelFile
*
pFile
);
int32_t
tsdbDelFReaderClose
(
SDelFReader
*
pReader
);
int32_t
tsdbReadDelData
(
SDelFReader
*
pReader
,
SDelData
*
pDelData
,
uint8_t
**
ppBuf
);
int32_t
tsdbReadDelIdx
(
SDelFReader
*
pReader
,
SDelIdx
*
pDelIdx
,
uint8_t
**
ppBuf
);
// tsdbCommit.c ==============================================================================================
...
...
@@ -169,8 +187,6 @@ typedef struct SReadH SReadH;
typedef
struct
SDFileSetReader
SDFileSetReader
;
typedef
struct
SDFileSetWriter
SDFileSetWriter
;
typedef
struct
STombstoneFileWriter
STombstoneFileWriter
;
typedef
struct
STombstoneFileReader
STombstoneFileReader
;
// SDFileSetWriter
int32_t
tsdbDFileSetWriterOpen
(
SDFileSetWriter
*
pWriter
,
STsdb
*
pTsdb
,
SDFileSet
*
pSet
);
...
...
@@ -186,13 +202,9 @@ int32_t tsdbLoadSBlockIdx(SDFileSetReader *pReader, SArray *pArray);
int32_t
tsdbLoadSBlockInfo
(
SDFileSetReader
*
pReader
,
SBlockIdx
*
pBlockIdx
,
SBlockInfo
*
pBlockInfo
);
int32_t
tsdbLoadSBlockStatis
(
SDFileSetReader
*
pReader
,
SBlock
*
pBlock
,
SBlockStatis
*
pBlockStatis
);
// STombstoneFileWriter
int32_t
tsdbTomstoneFileWriterOpen
(
STombstoneFileWriter
*
pWriter
,
STsdb
*
pTsdb
);
int32_t
tsdbTomstoneFileWriterClose
(
STombstoneFileWriter
*
pWriter
);
// SDelFWriter
// STombstoneFileReader
int32_t
tsdbTomstoneFileReaderOpen
(
STombstoneFileReader
*
pReader
,
STsdb
*
pTsdb
);
int32_t
tsdbTomstoneFileReaderClose
(
STombstoneFileReader
*
pReader
);
// SDelFReader
// tsdbUtil.c ==============================================================================================
int32_t
tTABLEIDCmprFn
(
const
void
*
p1
,
const
void
*
p2
);
...
...
@@ -303,7 +315,7 @@ struct SMemTable {
TSDBKEY
maxKey
;
int64_t
nRow
;
int64_t
nDelOp
;
SArray
*
aTbData
;
// SArray<STbData>
SArray
*
aTbData
;
// SArray<STbData
*
>
};
// struct STsdbFSMeta {
...
...
@@ -727,6 +739,12 @@ struct TABLEID {
tb_uid_t
uid
;
};
struct
STbDataIter
{
STbData
*
pTbData
;
int8_t
backward
;
SMemSkipListNode
*
pNode
;
};
struct
SDelOp
{
int64_t
version
;
TSKEY
sKey
;
// included
...
...
@@ -735,17 +753,39 @@ struct SDelOp {
};
typedef
struct
{
tb_uid_t
suid
;
tb_uid_t
uid
;
int64_t
version
;
TSKEY
sKey
;
TSKEY
eKey
;
}
SDel
Info
;
}
SDel
DataItem
;
struct
STbDataIter
{
STbData
*
pTbData
;
int8_t
backward
;
SMemSkipListNode
*
pNode
;
struct
SDelData
{
uint32_t
delimiter
;
tb_uid_t
suid
;
tb_uid_t
uid
;
int8_t
flags
;
int64_t
nItem
;
uint8_t
*
pOffset
;
uint32_t
nData
;
uint8_t
*
pData
;
};
typedef
struct
{
tb_uid_t
suid
;
tb_uid_t
uid
;
TSKEY
minKey
;
TSKEY
maxKey
;
int64_t
maxVersion
;
int64_t
minVersion
;
int64_t
offset
;
int64_t
size
;
}
SDelIdxItem
;
struct
SDelIdx
{
uint32_t
delimiter
;
int8_t
flags
;
int64_t
nItem
;
uint8_t
*
pOffset
;
uint8_t
*
pDelIdxItem
;
};
#endif
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
2ff00f23
...
...
@@ -19,6 +19,9 @@ typedef struct SCommitter SCommitter;
struct
SCommitter
{
STsdb
*
pTsdb
;
uint8_t
*
pBuf1
;
uint8_t
*
pBuf2
;
/* commit data */
int32_t
minutes
;
int8_t
precision
;
TSKEY
nextCommitKey
;
...
...
@@ -33,6 +36,14 @@ struct SCommitter {
// commit table data
STbData
*
pTbData
;
SBlockIdx
*
pBlockIdx
;
/* commit del */
SDelFReader
*
pTombstoneReader
;
SDelFWriter
*
pTombstoneWritter
;
SDelIdx
delIdxO
;
SDelIdx
delIdxN
;
SDelData
delDataO
;
SDelData
delDataN
;
/* commit cache */
};
static
int32_t
tsdbStartCommit
(
STsdb
*
pTsdb
,
SCommitter
*
pCommitter
);
...
...
@@ -160,13 +171,62 @@ static int32_t tsdbCommitDelStart(SCommitter *pCommitter) {
static
int32_t
tsdbCommitDelImpl
(
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
// TODO
STsdb
*
pTsdb
=
pCommitter
->
pTsdb
;
SMemTable
*
pMemTable
=
pTsdb
->
imem
;
int32_t
iTbData
=
0
;
int32_t
nTbData
=
taosArrayGetSize
(
pMemTable
->
aTbData
);
int32_t
iDelIdx
=
0
;
int32_t
nDelIdx
;
// TODO
int32_t
c
;
STbData
*
pTbData
=
NULL
;
SDelIdx
*
pDelIdx
=
NULL
;
while
(
iTbData
<
nTbData
||
iDelIdx
<
nDelIdx
)
{
if
(
iTbData
<
nTbData
)
{
pTbData
=
(
STbData
*
)
taosArrayGetP
(
pMemTable
->
aTbData
,
iTbData
);
}
else
{
pTbData
=
NULL
;
}
if
(
iDelIdx
<
nDelIdx
)
{
// pDelIdx = ; // TODO
}
else
{
pDelIdx
=
NULL
;
}
if
(
pTbData
&&
pDelIdx
)
{
c
=
tTABLEIDCmprFn
(
pTbData
,
pDelIdx
);
if
(
c
==
0
)
{
iTbData
++
;
iDelIdx
++
;
}
else
if
(
c
<
0
)
{
iTbData
++
;
pDelIdx
=
NULL
;
}
else
{
iDelIdx
++
;
pTbData
=
NULL
;
}
}
else
{
if
(
pTbData
)
{
iTbData
++
;
}
else
{
iDelIdx
++
;
}
}
// TODO: commit with the pTbData and pDelIdx
}
return
code
;
}
static
int32_t
tsdbCommitDelEnd
(
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
// TODO
ASSERT
(
pCommitter
->
delIdxN
.
nItem
>
0
);
return
code
;
_err:
return
code
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbFS.c
浏览文件 @
2ff00f23
...
...
@@ -20,7 +20,7 @@ struct STsdbFS {
TdThreadRwlock
lock
;
int64_t
minVersion
;
int64_t
maxVersion
;
S
TsdbTombstoneFile
*
pTombstoneF
;
S
DelFile
*
pTombstoneF
;
STsdbCacheFile
*
pCacheF
;
SArray
*
pArray
;
};
...
...
source/dnode/vnode/src/tsdb/tsdbFile.c
浏览文件 @
2ff00f23
...
...
@@ -18,11 +18,13 @@
static
const
char
*
tsdbFileSuffix
[]
=
{
".tombstone"
,
".cache"
,
".index"
,
".data"
,
".last"
,
".sma"
,
""
};
// .tombstone
struct
S
TsdbTombstone
File
{
struct
S
Del
File
{
TSKEY
minKey
;
TSKEY
maxKey
;
int64_t
minVersion
;
int64_t
maxVersion
;
int64_t
size
;
int64_t
offset
;
};
struct
STsdbIndexFile
{
...
...
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
2ff00f23
...
...
@@ -73,12 +73,62 @@ int32_t tsdbLoadSBlockStatis(SDFileSetReader *pReader, SBlock *pBlock, SBlockSta
return
code
;
}
// STombstoneFileWriter ====================================================
struct
STombstoneFileWriter
{
STsdb
*
pTsdb
;
// SDelFWriter ====================================================
struct
SDelFWriter
{
SDelFile
*
pFile
;
TdFilePtr
pWriteH
;
};
// STombstoneFileReader ====================================================
struct
STombstoneFileReader
{
STsdb
*
pTsdb
;
int32_t
tsdbDelFWriterOpen
(
SDelFWriter
**
ppWriter
,
SDelFile
*
pFile
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
tsdbDelFWriterClose
(
SDelFWriter
*
pWriter
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
tsdbWriteDelData
(
SDelFWriter
*
pWriter
,
SDelData
*
pDelData
,
uint8_t
**
ppBuf
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
tsdbWriteDelIdx
(
SDelFWriter
*
pWriter
,
SDelIdx
*
pDelIdx
,
uint8_t
**
ppBuf
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
// SDelFReader ====================================================
struct
SDelFReader
{
SDelFile
*
pFile
;
TdFilePtr
pReadH
;
};
int32_t
tsdbDelFReaderOpen
(
SDelFReader
*
pReader
,
SDelFile
*
pFile
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
tsdbDelFReaderClose
(
SDelFReader
*
pReader
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
tsdbReadDelData
(
SDelFReader
*
pReader
,
SDelData
*
pDelData
,
uint8_t
**
ppBuf
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
tsdbReadDelIdx
(
SDelFReader
*
pReader
,
SDelIdx
*
pDelIdx
,
uint8_t
**
ppBuf
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录