Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
af1724fb
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,发现更多精彩内容 >>
提交
af1724fb
编写于
6月 20, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more refact
上级
21ea4e3a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
16 deletion
+36
-16
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+9
-9
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+5
-5
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+2
-2
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+20
-0
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
af1724fb
...
...
@@ -59,7 +59,6 @@ typedef struct STsdbIndexFile STsdbIndexFile;
typedef
struct
STsdbDataFile
STsdbDataFile
;
typedef
struct
STsdbLastFile
STsdbLastFile
;
typedef
struct
STsdbSmaFile
STsdbSmaFile
;
typedef
struct
STsdbSmalFile
STsdbSmalFile
;
typedef
struct
SDFileSet
SDFileSet
;
typedef
struct
SDataFWriter
SDataFWriter
;
typedef
struct
SDataFReader
SDataFReader
;
...
...
@@ -84,13 +83,11 @@ int32_t tTABLEIDCmprFn(const void *p1, const void *p2);
// TSDBKEY
int32_t
tsdbKeyCmprFn
(
const
void
*
p1
,
const
void
*
p2
);
// KEYINFO
#define KEYINFO_INIT_VAL \
((KEYINFO){.maxKey.ts = TSKEY_MIN, \
.maxKey.version = 0, \
.minKey.ts = TSKEY_MAX, \
.minKey.version = INT64_MAX, \
.minVerion = INT64_MAX, \
.maxVersion = 0})
#define tKEYINFOInit() \
((KEYINFO){.maxKey = {.ts = TSKEY_MIN, .version = 0}, \
.minKey = {.ts = TSKEY_MAX, .version = -1}, \
.minVerion = INT64_MAX, \
.maxKey = -1})
int32_t
tPutKEYINFO
(
uint8_t
*
p
,
KEYINFO
*
pKeyInfo
);
int32_t
tGetKEYINFO
(
uint8_t
*
p
,
KEYINFO
*
pKeyInfo
);
// SColdata
...
...
@@ -99,7 +96,9 @@ int32_t tColDataCmprFn(const void *p1, const void *p2);
int32_t
tPutBlockIdx
(
uint8_t
*
p
,
void
*
ph
);
int32_t
tGetBlockIdx
(
uint8_t
*
p
,
void
*
ph
);
// SBlock
#define BLOCK_INIT_VAL ((SBlock){})
#define tBlockInit() ((SBlock){.info = tKEYINFOInit()})
void
tBlockReset
(
SBlock
*
pBlock
);
void
tBlockClear
(
SBlock
*
pBlock
);
int32_t
tPutBlock
(
uint8_t
*
p
,
void
*
ph
);
int32_t
tGetBlock
(
uint8_t
*
p
,
void
*
ph
);
int32_t
tBlockCmprFn
(
const
void
*
p1
,
const
void
*
p2
);
...
...
@@ -121,6 +120,7 @@ int32_t tGetDelData(uint8_t *p, void *ph);
int32_t
tsdbRealloc
(
uint8_t
**
ppBuf
,
int64_t
size
);
void
tsdbFree
(
uint8_t
*
pBuf
);
// SMapData
#define tMapDataInit() ((SMapData){0})
void
tMapDataReset
(
SMapData
*
pMapData
);
void
tMapDataClear
(
SMapData
*
pMapData
);
int32_t
tMapDataPutItem
(
SMapData
*
pMapData
,
void
*
pItem
,
int32_t
(
*
tPutItemFn
)(
uint8_t
*
,
void
*
));
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
af1724fb
...
...
@@ -349,7 +349,7 @@ static int32_t tsdbCommitMemoryData(SCommitter *pCommitter, SBlockIdx *pBlockIdx
bool
toDataOnly
)
{
int32_t
code
=
0
;
TSDBROW
*
pRow
;
SBlock
block
;
// TODO
SBlock
block
=
tBlockInit
();
while
(
true
)
{
pRow
=
tsdbTbDataIterGet
(
pIter
);
...
...
@@ -382,7 +382,7 @@ static int32_t tsdbCommitMemoryData(SCommitter *pCommitter, SBlockIdx *pBlockIdx
code
=
tMapDataPutItem
(
&
pCommitter
->
nBlock
,
&
block
,
tPutBlock
);
if
(
code
)
goto
_err
;
block
=
BLOCK_INIT_VAL
;
tBlockReset
(
&
block
)
;
tsdbBlockDataClear
(
&
pCommitter
->
bDataN
);
}
...
...
@@ -427,7 +427,7 @@ static int32_t tsdbMergeCommitImpl(SCommitter *pCommitter, SBlockIdx *pBlockIdx,
int32_t
nRow
=
0
;
int32_t
c
;
TSDBROW
*
pRow
;
SBlock
block
=
BLOCK_INIT_VAL
;
SBlock
block
=
tBlockInit
()
;
TSDBKEY
key1
;
TSDBKEY
key2
;
...
...
@@ -461,7 +461,7 @@ static int32_t tsdbMergeCommitImpl(SCommitter *pCommitter, SBlockIdx *pBlockIdx,
if
(
code
)
goto
_err
;
}
block
=
BLOCK_INIT_VAL
;
tBlockReset
(
&
block
)
;
tsdbBlockDataClear
(
&
pCommitter
->
bDataN
);
return
code
;
...
...
@@ -474,7 +474,7 @@ _err:
static
int32_t
tsdbMergeCommit
(
SCommitter
*
pCommitter
,
SBlockIdx
*
pBlockIdx
,
STbDataIter
*
pIter
,
SBlock
*
pBlock
)
{
int32_t
code
=
0
;
TSDBROW
*
pRow
;
SBlock
block
=
BLOCK_INIT_VAL
;
SBlock
block
=
tBlockInit
()
;
SBlockData
bDataN
;
TSDBKEY
key
;
int32_t
c
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
af1724fb
...
...
@@ -42,7 +42,7 @@ int32_t tsdbMemTableCreate(STsdb *pTsdb, SMemTable **ppMemTable) {
taosInitRWLatch
(
&
pMemTable
->
latch
);
pMemTable
->
pTsdb
=
pTsdb
;
pMemTable
->
nRef
=
1
;
pMemTable
->
info
=
KEYINFO_INIT_VAL
;
pMemTable
->
info
=
tKEYINFOInit
()
;
pMemTable
->
nRow
=
0
;
pMemTable
->
nDel
=
0
;
pMemTable
->
aTbData
=
taosArrayInit
(
128
,
sizeof
(
STbData
*
));
...
...
@@ -318,7 +318,7 @@ static int32_t tsdbGetOrCreateTbData(SMemTable *pMemTable, tb_uid_t suid, tb_uid
}
pTbData
->
suid
=
suid
;
pTbData
->
uid
=
uid
;
pTbData
->
info
=
KEYINFO_INIT_VAL
;
pTbData
->
info
=
tKEYINFOInit
()
;
pTbData
->
pHead
=
NULL
;
pTbData
->
pTail
=
NULL
;
pTbData
->
sl
.
seed
=
taosRand
();
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
af1724fb
...
...
@@ -275,6 +275,26 @@ int32_t tGetBlockIdx(uint8_t *p, void *ph) {
}
// SBlock ======================================================
void
tBlockReset
(
SBlock
*
pBlock
)
{
pBlock
->
info
=
tKEYINFOInit
();
pBlock
->
nRow
=
0
;
pBlock
->
last
=
-
1
;
pBlock
->
cmprAlg
=
-
1
;
for
(
int8_t
iSubBlock
=
0
;
iSubBlock
<
pBlock
->
nSubBlock
;
iSubBlock
++
)
{
pBlock
->
aSubBlock
[
iSubBlock
].
offset
=
-
1
;
pBlock
->
aSubBlock
[
iSubBlock
].
ksize
=
-
1
;
pBlock
->
aSubBlock
[
iSubBlock
].
bsize
=
-
1
;
tMapDataReset
(
&
pBlock
->
aSubBlock
->
mBlockCol
);
}
pBlock
->
nSubBlock
=
0
;
}
void
tBlockClear
(
SBlock
*
pBlock
)
{
for
(
int8_t
iSubBlock
=
0
;
iSubBlock
<
TSDB_MAX_SUBBLOCKS
;
iSubBlock
++
)
{
tMapDataClear
(
&
pBlock
->
aSubBlock
->
mBlockCol
);
}
}
int32_t
tPutBlock
(
uint8_t
*
p
,
void
*
ph
)
{
int32_t
n
=
0
;
SBlock
*
pBlock
=
(
SBlock
*
)
ph
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录