Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4b6cae11
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
提交
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,
...
@@ -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
,
static
STSRow
*
getSRowInTableMem
(
STableCheckInfo
*
pCheckInfo
,
int32_t
order
,
int32_t
update
,
STSRow
**
extraRow
,
TDRowVerT
maxVer
)
{
TDRowVerT
maxVer
)
{
STSRow
*
rmem
=
NULL
,
*
rimem
=
NULL
;
STSRow
*
rmem
=
NULL
,
*
rimem
=
NULL
;
if
(
pCheckInfo
->
iter
)
{
if
(
pCheckInfo
->
iter
)
{
SSkipListNode
*
node
=
tSkipListIterGet
(
pCheckInfo
->
iter
);
SSkipListNode
*
node
=
tSkipListIterGet
(
pCheckInfo
->
iter
);
if
(
node
!=
NULL
)
{
if
(
node
!=
NULL
)
{
rmem
=
(
STSRow
*
)
SL_GET_NODE_DATA
(
node
);
rmem
=
(
STSRow
*
)
SL_GET_NODE_DATA
(
node
);
#if 0 // TODO: skiplist refactor
#if 0
// TODO: skiplist refactor
if (TD_ROW_VER(rmem) > maxVer) {
if (TD_ROW_VER(rmem) > maxVer) {
rmem = NULL;
rmem = NULL;
}
}
...
@@ -898,7 +898,7 @@ static STSRow* getSRowInTableMem(STableCheckInfo* pCheckInfo, int32_t order, int
...
@@ -898,7 +898,7 @@ static STSRow* getSRowInTableMem(STableCheckInfo* pCheckInfo, int32_t order, int
SSkipListNode
*
node
=
tSkipListIterGet
(
pCheckInfo
->
iiter
);
SSkipListNode
*
node
=
tSkipListIterGet
(
pCheckInfo
->
iiter
);
if
(
node
!=
NULL
)
{
if
(
node
!=
NULL
)
{
rimem
=
(
STSRow
*
)
SL_GET_NODE_DATA
(
node
);
rimem
=
(
STSRow
*
)
SL_GET_NODE_DATA
(
node
);
#if 0 // TODO: skiplist refactor
#if 0
// TODO: skiplist refactor
if (TD_ROW_VER(rimem) > maxVer) {
if (TD_ROW_VER(rimem) > maxVer) {
rimem = NULL;
rimem = NULL;
}
}
...
@@ -1677,7 +1677,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
...
@@ -1677,7 +1677,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
colIdOfRow2
=
tdKvRowColIdAt
(
row2
,
k
);
colIdOfRow2
=
tdKvRowColIdAt
(
row2
,
k
);
}
}
if
(
colIdOfRow1
<
colIdOfRow2
)
{
// the most probability
if
(
colIdOfRow1
<
colIdOfRow2
)
{
// the most probability
if
(
colIdOfRow1
<
pColInfo
->
info
.
colId
)
{
if
(
colIdOfRow1
<
pColInfo
->
info
.
colId
)
{
++
j
;
++
j
;
continue
;
continue
;
...
@@ -1720,7 +1720,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
...
@@ -1720,7 +1720,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
++
(
*
curRow
);
++
(
*
curRow
);
}
}
++
nResult
;
++
nResult
;
}
else
if
(
update
){
}
else
if
(
update
)
{
mergeOption
=
2
;
mergeOption
=
2
;
}
else
{
}
else
{
mergeOption
=
0
;
mergeOption
=
0
;
...
@@ -1741,7 +1741,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
...
@@ -1741,7 +1741,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
++
(
*
curRow
);
++
(
*
curRow
);
}
}
++
nResult
;
++
nResult
;
}
else
if
(
update
)
{
}
else
if
(
update
)
{
mergeOption
=
2
;
mergeOption
=
2
;
}
else
{
}
else
{
mergeOption
=
0
;
mergeOption
=
0
;
...
@@ -2018,8 +2018,9 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
...
@@ -2018,8 +2018,9 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
rv2
=
TD_ROW_SVER
(
row2
);
rv2
=
TD_ROW_SVER
(
row2
);
}
}
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
numOfRows
+=
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
if
(
cur
->
win
.
skey
==
TSKEY_INITIAL_VAL
)
{
if
(
cur
->
win
.
skey
==
TSKEY_INITIAL_VAL
)
{
cur
->
win
.
skey
=
key
;
cur
->
win
.
skey
=
key
;
}
}
...
@@ -2062,7 +2063,7 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
...
@@ -2062,7 +2063,7 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
}
}
#endif
#endif
if
(
TD_SUPPORT_UPDATE
(
pCfg
->
update
))
{
if
(
TD_SUPPORT_UPDATE
(
pCfg
->
update
))
{
if
(
lastKeyAppend
!=
key
)
{
if
(
lastKeyAppend
!=
key
)
{
lastKeyAppend
=
key
;
lastKeyAppend
=
key
;
++
curRow
;
++
curRow
;
}
}
...
@@ -2076,8 +2077,9 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
...
@@ -2076,8 +2077,9 @@ static void doMergeTwoLevelData(STsdbReadHandle* pTsdbReadHandle, STableCheckInf
// pSchema2 = tsdbGetTableSchemaByVersion(pTable, memRowVersion(row2));
// pSchema2 = tsdbGetTableSchemaByVersion(pTable, memRowVersion(row2));
rv2
=
TD_ROW_SVER
(
row2
);
rv2
=
TD_ROW_SVER
(
row2
);
}
}
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
numOfRows
+=
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
row1
,
row2
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema1
,
pSchema2
,
pCfg
->
update
,
&
lastKeyAppend
);
if
(
cur
->
win
.
skey
==
TSKEY_INITIAL_VAL
)
{
if
(
cur
->
win
.
skey
==
TSKEY_INITIAL_VAL
)
{
cur
->
win
.
skey
=
key
;
cur
->
win
.
skey
=
key
;
...
@@ -2436,7 +2438,7 @@ static int32_t getFirstFileDataBlock(STsdbReadHandle* pTsdbReadHandle, bool* exi
...
@@ -2436,7 +2438,7 @@ static int32_t getFirstFileDataBlock(STsdbReadHandle* pTsdbReadHandle, bool* exi
int32_t
numOfTables
=
(
int32_t
)
taosArrayGetSize
(
pTsdbReadHandle
->
pTableCheckInfo
);
int32_t
numOfTables
=
(
int32_t
)
taosArrayGetSize
(
pTsdbReadHandle
->
pTableCheckInfo
);
STsdbKeepCfg
*
pCfg
=
REPO_KEEP_CFG
(
pTsdbReadHandle
->
pTsdb
);
STsdbKeepCfg
*
pCfg
=
REPO_KEEP_CFG
(
pTsdbReadHandle
->
pTsdb
);
STimeWindow
win
=
TSWINDOW_INITIALIZER
;
STimeWindow
win
=
TSWINDOW_INITIALIZER
;
while
(
true
)
{
while
(
true
)
{
tsdbRLockFS
(
REPO_FS
(
pTsdbReadHandle
->
pTsdb
));
tsdbRLockFS
(
REPO_FS
(
pTsdbReadHandle
->
pTsdb
));
...
@@ -2742,7 +2744,6 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
...
@@ -2742,7 +2744,6 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
STSchema
*
pSchema
=
NULL
;
STSchema
*
pSchema
=
NULL
;
TSKEY
lastRowKey
=
TSKEY_INITIAL_VAL
;
TSKEY
lastRowKey
=
TSKEY_INITIAL_VAL
;
do
{
do
{
STSRow
*
row
=
getSRowInTableMem
(
pCheckInfo
,
pTsdbReadHandle
->
order
,
pCfg
->
update
,
NULL
,
TD_VER_MAX
);
STSRow
*
row
=
getSRowInTableMem
(
pCheckInfo
,
pTsdbReadHandle
->
order
,
pCfg
->
update
,
NULL
,
TD_VER_MAX
);
if
(
row
==
NULL
)
{
if
(
row
==
NULL
)
{
...
@@ -2767,8 +2768,8 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
...
@@ -2767,8 +2768,8 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
pSchema
=
metaGetTbTSchema
(
REPO_META
(
pTsdbReadHandle
->
pTsdb
),
pCheckInfo
->
tableId
,
0
);
pSchema
=
metaGetTbTSchema
(
REPO_META
(
pTsdbReadHandle
->
pTsdb
),
pCheckInfo
->
tableId
,
0
);
rv
=
TD_ROW_SVER
(
row
);
rv
=
TD_ROW_SVER
(
row
);
}
}
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
maxRowsToRead
,
&
curRows
,
row
,
NULL
,
numOfCols
,
pCheckInfo
->
tableId
,
pSchema
,
numOfRows
+=
mergeTwoRowFromMem
(
pTsdbReadHandle
,
maxRowsToRead
,
&
curRows
,
row
,
NULL
,
numOfCols
,
pCheckInfo
->
tableId
,
NULL
,
pCfg
->
update
,
&
lastRowKey
);
pSchema
,
NULL
,
pCfg
->
update
,
&
lastRowKey
);
if
(
numOfRows
>=
maxRowsToRead
)
{
if
(
numOfRows
>=
maxRowsToRead
)
{
moveToNextRowInMem
(
pCheckInfo
);
moveToNextRowInMem
(
pCheckInfo
);
...
@@ -2777,7 +2778,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
...
@@ -2777,7 +2778,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
}
while
(
moveToNextRowInMem
(
pCheckInfo
));
}
while
(
moveToNextRowInMem
(
pCheckInfo
));
taosMemoryFreeClear
(
pSchema
);
// free the STSChema
taosMemoryFreeClear
(
pSchema
);
// free the STSChema
assert
(
numOfRows
<=
maxRowsToRead
);
assert
(
numOfRows
<=
maxRowsToRead
);
...
@@ -2905,8 +2906,8 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
...
@@ -2905,8 +2906,8 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
// if (ret != TSDB_CODE_SUCCESS) {
// if (ret != TSDB_CODE_SUCCESS) {
// return false;
// return false;
// }
// }
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
pRow
,
NULL
,
numOfCols
,
pCheckInfo
->
tableId
,
mergeTwoRowFromMem
(
pTsdbReadHandle
,
pTsdbReadHandle
->
outputCapacity
,
&
curRow
,
pRow
,
NULL
,
numOfCols
,
NULL
,
NULL
,
true
,
&
lastRowKey
);
pCheckInfo
->
tableId
,
NULL
,
NULL
,
true
,
&
lastRowKey
);
taosMemoryFreeClear
(
pRow
);
taosMemoryFreeClear
(
pRow
);
// update the last key value
// update the last key value
...
@@ -3475,7 +3476,7 @@ void tsdbRetrieveDataBlockInfo(tsdbReaderT* pTsdbReadHandle, SDataBlockInfo* pDa
...
@@ -3475,7 +3476,7 @@ void tsdbRetrieveDataBlockInfo(tsdbReaderT* pTsdbReadHandle, SDataBlockInfo* pDa
pDataBlockInfo
->
rows
=
cur
->
rows
;
pDataBlockInfo
->
rows
=
cur
->
rows
;
pDataBlockInfo
->
window
=
cur
->
win
;
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录