Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b72865e5
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b72865e5
编写于
5月 09, 2022
作者:
C
Cary Xu
提交者:
GitHub
5月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12254 from taosdata/feature/TD-14481-3.0
fix: merge data of mem and file
上级
e93376de
35c2f9e4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
33 addition
and
26 deletion
+33
-26
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+33
-26
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
b72865e5
...
...
@@ -879,8 +879,8 @@ static TSKEY extractFirstTraverseKey(STableCheckInfo* pCheckInfo, int32_t order,
}
}
static
STSRow
*
getSRowInTableMem
(
STableCheckInfo
*
pCheckInfo
,
int32_t
order
,
int32_t
update
,
STSRow
**
extraRow
,
TDRowVerT
maxVer
)
{
static
STSRow
*
getSRowInTableMem
(
STableCheckInfo
*
pCheckInfo
,
int32_t
order
,
int32_t
update
,
STSRow
**
extraRow
,
TDRowVerT
maxVer
)
{
STSRow
*
rmem
=
NULL
,
*
rimem
=
NULL
;
if
(
pCheckInfo
->
iter
)
{
SSkipListNode
*
node
=
tSkipListIterGet
(
pCheckInfo
->
iter
);
...
...
@@ -1720,7 +1720,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
++
(
*
curRow
);
}
++
nResult
;
}
else
if
(
update
){
}
else
if
(
update
)
{
mergeOption
=
2
;
}
else
{
mergeOption
=
0
;
...
...
@@ -1741,7 +1741,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
++
(
*
curRow
);
}
++
nResult
;
}
else
if
(
update
)
{
}
else
if
(
update
)
{
mergeOption
=
2
;
}
else
{
mergeOption
=
0
;
...
...
@@ -2018,9 +2018,9 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
rv2
=
TD_ROW_SVER
(
row2
);
}
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
// numOfRows += 1;
if
(
cur
->
win
.
skey
==
TSKEY_INITIAL_VAL
)
{
cur
->
win
.
skey
=
key
;
}
...
...
@@ -2028,7 +2028,6 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
cur
->
win
.
ekey
=
key
;
cur
->
lastKey
=
key
+
step
;
cur
->
mixBlock
=
true
;
moveToNextRowInMem
(
pCheckInfo
);
}
else
if
(
key
==
tsArray
[
pos
])
{
// data in buffer has the same timestamp of data in file block, ignore it
#if 0
...
...
@@ -2064,7 +2063,11 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
}
#endif
if
(
TD_SUPPORT_UPDATE
(
pCfg
->
update
))
{
doCopyRowsFromFileBlock
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
curRow
,
pos
,
pos
);
if
(
lastKeyAppend
!=
key
)
{
lastKeyAppend
=
key
;
++
curRow
;
}
numOfRows
=
doCopyRowsFromFileBlock
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
curRow
,
pos
,
pos
);
if
(
rv1
!=
TD_ROW_SVER
(
row1
))
{
// pSchema1 = tsdbGetTableSchemaByVersion(pTable, memRowVersion(row1));
...
...
@@ -2074,10 +2077,10 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
// pSchema2 = tsdbGetTableSchemaByVersion(pTable, memRowVersion(row2));
rv2
=
TD_ROW_SVER
(
row2
);
}
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
// ++numOfRows;
if
(
cur
->
win
.
skey
==
TSKEY_INITIAL_VAL
)
{
cur
->
win
.
skey
=
key
;
}
...
...
@@ -2117,15 +2120,20 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
int32_t
qstart
=
0
,
qend
=
0
;
getQualifiedRowsPos
(
pTsdbReadHandle
,
pos
,
end
,
numOfRows
,
&
qstart
,
&
qend
);
lastKeyAppend
=
tsArray
[
qend
];
numOfRows
=
doCopyRowsFromFileBlock
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
numOfRows
,
qstart
,
qend
);
if
((
lastKeyAppend
!=
TSKEY_INITIAL_VAL
)
&&
(
lastKeyAppend
!=
(
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
)
?
tsArray
[
qstart
]
:
tsArray
[
qend
])))
{
++
curRow
;
}
numOfRows
=
doCopyRowsFromFileBlock
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
curRow
,
qstart
,
qend
);
pos
+=
(
qend
-
qstart
+
1
)
*
step
;
if
(
numOfRows
>
0
)
{
if
(
numOfRows
>
0
)
{
curRow
=
numOfRows
-
1
;
}
cur
->
win
.
ekey
=
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
)
?
tsArray
[
qend
]
:
tsArray
[
qstart
];
cur
->
lastKey
=
cur
->
win
.
ekey
+
step
;
lastKeyAppend
=
cur
->
win
.
ekey
;
}
}
while
(
numOfRows
<
pTsdbReadHandle
->
outputCapacity
);
...
...
@@ -2735,7 +2743,6 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
STSchema
*
pSchema
=
NULL
;
TSKEY
lastRowKey
=
TSKEY_INITIAL_VAL
;
do
{
STSRow
*
row
=
getSRowInTableMem
(
pCheckInfo
,
pTsdbReadHandle
->
order
,
pCfg
->
update
,
NULL
,
TD_VER_MAX
);
if
(
row
==
NULL
)
{
...
...
@@ -2760,8 +2767,8 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
pSchema
=
metaGetTbTSchema
(
REPO_META
(
pTsdbReadHandle
->
pTsdb
),
pCheckInfo
->
tableId
,
0
);
rv
=
TD_ROW_SVER
(
row
);
}
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
maxRowsToRead
,
&
curRows
,
row
,
NULL
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema
,
NULL
,
pCfg
->
update
,
&
lastRowKey
);
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
maxRowsToRead
,
&
curRows
,
row
,
NULL
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema
,
NULL
,
pCfg
->
update
,
&
lastRowKey
);
if
(
numOfRows
>=
maxRowsToRead
)
{
moveToNextRowInMem
(
pCheckInfo
);
...
...
@@ -2898,8 +2905,8 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
// if (ret != TSDB_CODE_SUCCESS) {
// return false;
// }
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
pRow
,
NULL
,
numOfCols
,
pCheckInfo
->
tableId
,
NULL
,
NULL
,
true
,
&
lastRowKey
);
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
pRow
,
NULL
,
numOfCols
,
pCheckInfo
->
tableId
,
NULL
,
NULL
,
true
,
&
lastRowKey
);
taosMemoryFreeClear
(
pRow
);
// update the last key value
...
...
@@ -3468,7 +3475,7 @@ void tsdbRetrieveDataBlockInfo(tsdbReaderT* pTsdbReadHandle, SDataBlockInfo* pDa
pDataBlockInfo
->
rows
=
cur
->
rows
;
pDataBlockInfo
->
window
=
cur
->
win
;
// ASSERT(pDataBlockInfo->numOfCols >= (int32_t)(QH_GET_NUM_OF_COLS(pHandle));
// ASSERT(pDataBlockInfo->numOfCols >= (int32_t)(QH_GET_NUM_OF_COLS(pHandle));
}
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录