Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3283fe93
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
3283fe93
编写于
6月 06, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more progress
上级
5be50635
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
59 deletion
+33
-59
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+14
-11
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+16
-45
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+3
-3
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
3283fe93
...
...
@@ -58,7 +58,7 @@ void tsdbTbDataIterOpen(STbData *pTbData, TSDBKEY *pFrom, int8_t backward, ST
bool
tsdbTbDataIterNext
(
STbDataIter
*
pIter
);
bool
tsdbTbDataIterGet
(
STbDataIter
*
pIter
,
TSDBROW
*
pRow
);
int
tsdbLoadDataFromCache
(
STsdb
*
pTsdb
,
STable
*
pTable
,
S
SkipListIterato
r
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
int
tsdbLoadDataFromCache
(
STsdb
*
pTsdb
,
STable
*
pTable
,
S
TbDataIte
r
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
TKEY
*
filterKeys
,
int
nFilterKeys
,
bool
keepDup
,
SMergeInfo
*
pMergeInfo
);
// tsdbMemTable2.c ==============================================================================================
...
...
@@ -322,16 +322,24 @@ static void *taosTZfree(void *ptr);
static
size_t
taosTSizeof
(
void
*
ptr
);
static
void
taosTMemset
(
void
*
ptr
,
int
c
);
static
FORCE_INLINE
STSRow
*
tsdbNextIterRow
(
SSkipListIterator
*
pIter
)
{
struct
TSDBROW
{
int64_t
version
;
STSRow
*
pTSRow
;
};
static
FORCE_INLINE
STSRow
*
tsdbNextIterRow
(
STbDataIter
*
pIter
)
{
TSDBROW
row
;
if
(
pIter
==
NULL
)
return
NULL
;
SSkipListNode
*
node
=
tSkipListIterGet
(
pIter
);
if
(
node
==
NULL
)
return
NULL
;
if
(
tsdbTbDataIterGet
(
pIter
,
&
row
))
{
return
row
.
pTSRow
;
}
return
(
STSRow
*
)
SL_GET_NODE_DATA
(
node
)
;
return
NULL
;
}
static
FORCE_INLINE
TSKEY
tsdbNextIterKey
(
S
SkipListIterato
r
*
pIter
)
{
static
FORCE_INLINE
TSKEY
tsdbNextIterKey
(
S
TbDataIte
r
*
pIter
)
{
STSRow
*
row
=
tsdbNextIterRow
(
pIter
);
if
(
row
==
NULL
)
return
TSDB_DATA_TIMESTAMP_NULL
;
...
...
@@ -675,11 +683,6 @@ struct SFSIter {
#define TSDB_FS_ITER_FORWARD TSDB_ORDER_ASC
#define TSDB_FS_ITER_BACKWARD TSDB_ORDER_DESC
struct
TSDBROW
{
int64_t
version
;
STSRow
*
pTSRow
;
};
struct
TABLEID
{
tb_uid_t
suid
;
tb_uid_t
uid
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
3283fe93
...
...
@@ -18,8 +18,8 @@
#define TSDB_MAX_SUBBLOCKS 8
typedef
struct
{
STable
*
pTable
;
S
SkipListIterato
r
*
pIter
;
STable
*
pTable
;
S
TbDataIte
r
*
pIter
;
}
SCommitIter
;
typedef
struct
{
...
...
@@ -457,7 +457,9 @@ static int32_t tsdbCreateCommitIters(SCommitH *pCommith) {
int32_t
code
=
0
;
STsdb
*
pRepo
=
TSDB_COMMIT_REPO
(
pCommith
);
SMemTable
*
pMem
=
pRepo
->
imem
;
STbData
*
pTbData
;
SCommitIter
*
pCommitIter
;
STSchema
*
pTSchema
=
NULL
;
pCommith
->
niters
=
taosArrayGetSize
(
pMem
->
aTbData
);
pCommith
->
iters
=
(
SCommitIter
*
)
taosMemoryCalloc
(
pCommith
->
niters
,
sizeof
(
SCommitIter
));
...
...
@@ -467,46 +469,12 @@ static int32_t tsdbCreateCommitIters(SCommitH *pCommith) {
}
for
(
int32_t
iIter
=
0
;
iIter
<
pCommith
->
niters
;
iIter
++
)
{
pCommitIter
=
(
SCommitIter
*
)
taosArrayGetP
(
pMem
->
aTbData
,
iIter
);
// TODO
// pCommitIter->pIter =
}
return
code
;
_err:
return
code
;
#if 0
SSkipListIterator *pSlIter;
SSkipListNode *pNode;
STbData *pTbData;
STSchema *pTSchema = NULL;
pTbData
=
(
STbData
*
)
taosArrayGetP
(
pMem
->
aTbData
,
iIter
);
pCommitIter
=
&
pCommith
->
iters
[
iIter
];
pCommith->niters = SL_SIZE(pMem->pSlIdx);
pCommith->iters = (SCommitIter *)taosMemoryCalloc(pCommith->niters, sizeof(SCommitIter));
if (pCommith->iters == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
return -1;
}
// Loop to create iters for each skiplist
pSlIter = tSkipListCreateIter(pMem->pSlIdx);
if (pSlIter == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
return -1;
}
for (int i = 0; i < pCommith->niters; i++) {
tSkipListIterNext(pSlIter);
pNode = tSkipListIterGet(pSlIter);
pTbData = (STbData *)pNode->pData;
pCommitIter = pCommith->iters + i;
pTSchema
=
metaGetTbTSchema
(
REPO_META
(
pRepo
),
pTbData
->
uid
,
-
1
);
if
(
pTSchema
)
{
pCommitIter->pIter = tSkipListCreateIter(pTbData->pData);
tSkipListIterNext(pCommitIter->pIter);
tsdbTbDataIterCreate
(
pTbData
,
NULL
,
0
,
&
pCommitIter
->
pIter
);
pCommitIter
->
pTable
=
(
STable
*
)
taosMemoryMalloc
(
sizeof
(
STable
));
pCommitIter
->
pTable
->
uid
=
pTbData
->
uid
;
...
...
@@ -515,15 +483,18 @@ _err:
pCommitIter
->
pTable
->
pCacheSchema
=
NULL
;
}
}
tSkipListDestroyIter(pSlIter);
#endif
return
code
;
_err:
return
code
;
}
static
void
tsdbDestroyCommitIters
(
SCommitH
*
pCommith
)
{
if
(
pCommith
->
iters
==
NULL
)
return
;
for
(
int
i
=
1
;
i
<
pCommith
->
niters
;
i
++
)
{
t
SkipListDestroyIter
(
pCommith
->
iters
[
i
].
pIter
);
t
sdbTbDataIterDestroy
(
pCommith
->
iters
[
i
].
pIter
);
if
(
pCommith
->
iters
[
i
].
pTable
)
{
tdFreeSchema
(
pCommith
->
iters
[
i
].
pTable
->
pSchema
);
tdFreeSchema
(
pCommith
->
iters
[
i
].
pTable
->
pCacheSchema
);
...
...
@@ -1333,7 +1304,7 @@ static int tsdbMergeMemData(SCommitH *pCommith, SCommitIter *pIter, int bidx) {
keyLimit
=
pBlock
[
1
].
minKey
.
ts
-
1
;
}
S
SkipListIterato
r
titer
=
*
(
pIter
->
pIter
);
S
TbDataIte
r
titer
=
*
(
pIter
->
pIter
);
if
(
tsdbLoadBlockDataCols
(
&
(
pCommith
->
readh
),
pBlock
,
NULL
,
&
colId
,
1
,
false
)
<
0
)
return
-
1
;
tsdbLoadDataFromCache
(
TSDB_COMMIT_REPO
(
pCommith
),
pIter
->
pTable
,
&
titer
,
keyLimit
,
INT32_MAX
,
NULL
,
...
...
@@ -1542,7 +1513,7 @@ static void tsdbLoadAndMergeFromCache(STsdb *pTsdb, SDataCols *pDataCols, int *i
lastKey
=
key2
;
}
t
SkipList
IterNext
(
pCommitIter
->
pIter
);
t
sdbTbData
IterNext
(
pCommitIter
->
pIter
);
}
else
{
if
(
lastKey
!=
key1
)
{
if
(
lastKey
!=
TSKEY_INITIAL_VAL
)
{
...
...
@@ -1574,7 +1545,7 @@ static void tsdbLoadAndMergeFromCache(STsdb *pTsdb, SDataCols *pDataCols, int *i
tdAppendSTSRowToDataCol
(
row
,
pSchema
,
pTarget
,
true
);
}
++
(
*
iter
);
t
SkipList
IterNext
(
pCommitIter
->
pIter
);
t
sdbTbData
IterNext
(
pCommitIter
->
pIter
);
}
if
(
pTarget
->
numOfRows
>=
(
maxRows
-
1
))
break
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
3283fe93
...
...
@@ -321,7 +321,7 @@ bool tsdbTbDataIterGet(STbDataIter *pIter, TSDBROW *pRow) {
*
* The function tries to procceed AS MUCH AS POSSIBLE.
*/
int
tsdbLoadDataFromCache
(
STsdb
*
pTsdb
,
STable
*
pTable
,
S
SkipListIterato
r
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
int
tsdbLoadDataFromCache
(
STsdb
*
pTsdb
,
STable
*
pTable
,
S
TbDataIte
r
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
TKEY
*
filterKeys
,
int
nFilterKeys
,
bool
keepDup
,
SMergeInfo
*
pMergeInfo
)
{
ASSERT
(
maxRowsToRead
>
0
&&
nFilterKeys
>=
0
);
if
(
pIter
==
NULL
)
return
0
;
...
...
@@ -404,7 +404,7 @@ int tsdbLoadDataFromCache(STsdb *pTsdb, STable *pTable, SSkipListIterator *pIter
}
}
t
SkipList
IterNext
(
pIter
);
t
sdbTbData
IterNext
(
pIter
);
row
=
tsdbNextIterRow
(
pIter
);
if
(
row
==
NULL
||
TD_ROW_KEY
(
row
)
>
maxKey
)
{
rowKey
=
INT64_MAX
;
...
...
@@ -444,7 +444,7 @@ int tsdbLoadDataFromCache(STsdb *pTsdb, STable *pTable, SSkipListIterator *pIter
}
}
t
SkipList
IterNext
(
pIter
);
t
sdbTbData
IterNext
(
pIter
);
row
=
tsdbNextIterRow
(
pIter
);
if
(
row
==
NULL
||
TD_ROW_KEY
(
row
)
>
maxKey
)
{
rowKey
=
INT64_MAX
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录