Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4b6cae11
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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,发现更多精彩内容 >>
提交
4b6cae11
编写于
5月 09, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: code optimization
上级
50235b71
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
20 deletion
+21
-20
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+21
-20
未找到文件。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
4b6cae11
...
...
@@ -879,14 +879,14 @@ 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
);
if
(
node
!=
NULL
)
{
rmem
=
(
STSRow
*
)
SL_GET_NODE_DATA
(
node
);
#if 0 // TODO: skiplist refactor
#if 0
// TODO: skiplist refactor
if (TD_ROW_VER(rmem) > maxVer) {
rmem = NULL;
}
...
...
@@ -898,7 +898,7 @@ static STSRow* getSRowInTableMem(STableCheckInfo* pCheckInfo, int32_t order, int
SSkipListNode
*
node
=
tSkipListIterGet
(
pCheckInfo
->
iiter
);
if
(
node
!=
NULL
)
{
rimem
=
(
STSRow
*
)
SL_GET_NODE_DATA
(
node
);
#if 0 // TODO: skiplist refactor
#if 0
// TODO: skiplist refactor
if (TD_ROW_VER(rimem) > maxVer) {
rimem = NULL;
}
...
...
@@ -1677,7 +1677,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
colIdOfRow2
=
tdKvRowColIdAt
(
row2
,
k
);
}
if
(
colIdOfRow1
<
colIdOfRow2
)
{
// the most probability
if
(
colIdOfRow1
<
colIdOfRow2
)
{
// the most probability
if
(
colIdOfRow1
<
pColInfo
->
info
.
colId
)
{
++
j
;
continue
;
...
...
@@ -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,8 +2018,9 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
rv2
=
TD_ROW_SVER
(
row2
);
}
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
if
(
cur
->
win
.
skey
==
TSKEY_INITIAL_VAL
)
{
cur
->
win
.
skey
=
key
;
}
...
...
@@ -2062,7 +2063,7 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
}
#endif
if
(
TD_SUPPORT_UPDATE
(
pCfg
->
update
))
{
if
(
lastKeyAppend
!=
key
)
{
if
(
lastKeyAppend
!=
key
)
{
lastKeyAppend
=
key
;
++
curRow
;
}
...
...
@@ -2076,8 +2077,9 @@ 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
,
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
if
(
cur
->
win
.
skey
==
TSKEY_INITIAL_VAL
)
{
cur
->
win
.
skey
=
key
;
...
...
@@ -2436,7 +2438,7 @@ static int32_t getFirstFileDataBlock(STsdbReadHandle* pTsdbReadHandle, bool* exi
int32_t
numOfTables
=
(
int32_t
)
taosArrayGetSize
(
pTsdbReadHandle
->
pTableCheckInfo
);
STsdbKeepCfg
*
pCfg
=
REPO_KEEP_CFG
(
pTsdbReadHandle
->
pTsdb
);
STimeWindow
win
=
TSWINDOW_INITIALIZER
;
STimeWindow
win
=
TSWINDOW_INITIALIZER
;
while
(
true
)
{
tsdbRLockFS
(
REPO_FS
(
pTsdbReadHandle
->
pTsdb
));
...
...
@@ -2742,7 +2744,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
)
{
...
...
@@ -2767,8 +2768,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
);
...
...
@@ -2777,7 +2778,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
}
while
(
moveToNextRowInMem
(
pCheckInfo
));
taosMemoryFreeClear
(
pSchema
);
// free the STSChema
taosMemoryFreeClear
(
pSchema
);
// free the STSChema
assert
(
numOfRows
<=
maxRowsToRead
);
...
...
@@ -2905,8 +2906,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
...
...
@@ -3475,7 +3476,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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录