Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_50753323
TDengine
提交
8795d190
T
TDengine
项目概览
qq_50753323
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8795d190
编写于
9月 04, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225]
上级
10af6ae3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
19 deletion
+18
-19
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+16
-17
src/util/src/tcache.c
src/util/src/tcache.c
+2
-2
未找到文件。
src/tsdb/src/tsdbRead.c
浏览文件 @
8795d190
...
...
@@ -734,10 +734,10 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* p
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
copyData
FromFileBlock
(
STsdbQueryHandle
*
pQueryHandle
,
int32_t
capacity
,
int32_t
numOfRows
,
int32_t
start
,
int32_t
end
);
static
int32_t
doCopyRows
FromFileBlock
(
STsdbQueryHandle
*
pQueryHandle
,
int32_t
capacity
,
int32_t
numOfRows
,
int32_t
start
,
int32_t
end
);
static
void
moveDataToFront
(
STsdbQueryHandle
*
pQueryHandle
,
int32_t
numOfRows
,
int32_t
numOfCols
);
static
void
doCheckGeneratedBlockRange
(
STsdbQueryHandle
*
pQueryHandle
);
static
void
copyRowsFromFileBlock
(
STsdbQueryHandle
*
pQueryHandle
,
STableCheckInfo
*
pCheckInfo
,
SDataBlockInfo
*
pBlockInfo
,
int32_t
endPos
);
static
void
copy
AllRemain
RowsFromFileBlock
(
STsdbQueryHandle
*
pQueryHandle
,
STableCheckInfo
*
pCheckInfo
,
SDataBlockInfo
*
pBlockInfo
,
int32_t
endPos
);
static
int32_t
handleDataMergeIfNeeded
(
STsdbQueryHandle
*
pQueryHandle
,
SCompBlock
*
pBlock
,
STableCheckInfo
*
pCheckInfo
){
SQueryFilePos
*
cur
=
&
pQueryHandle
->
cur
;
...
...
@@ -801,7 +801,7 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SCompBloc
cur
->
lastKey
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
(
binfo
.
window
.
ekey
+
1
)
:
(
binfo
.
window
.
skey
-
1
);
}
else
{
// partially copy to dest buffer
int32_t
endPos
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
(
binfo
.
rows
-
1
)
:
0
;
copyRowsFromFileBlock
(
pQueryHandle
,
pCheckInfo
,
&
binfo
,
endPos
);
copy
AllRemain
RowsFromFileBlock
(
pQueryHandle
,
pCheckInfo
,
&
binfo
,
endPos
);
cur
->
mixBlock
=
true
;
}
...
...
@@ -929,7 +929,7 @@ static int doBinarySearchKey(char* pValue, int num, TSKEY key, int order) {
return
midPos
;
}
int32_t
copyData
FromFileBlock
(
STsdbQueryHandle
*
pQueryHandle
,
int32_t
capacity
,
int32_t
numOfRows
,
int32_t
start
,
int32_t
end
)
{
int32_t
doCopyRows
FromFileBlock
(
STsdbQueryHandle
*
pQueryHandle
,
int32_t
capacity
,
int32_t
numOfRows
,
int32_t
start
,
int32_t
end
)
{
char
*
pData
=
NULL
;
int32_t
step
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
1
:
-
1
;
...
...
@@ -1154,7 +1154,7 @@ static void doCheckGeneratedBlockRange(STsdbQueryHandle* pQueryHandle) {
}
}
static
void
copyRowsFromFileBlock
(
STsdbQueryHandle
*
pQueryHandle
,
STableCheckInfo
*
pCheckInfo
,
SDataBlockInfo
*
pBlockInfo
,
int32_t
endPos
)
{
static
void
copy
AllRemain
RowsFromFileBlock
(
STsdbQueryHandle
*
pQueryHandle
,
STableCheckInfo
*
pCheckInfo
,
SDataBlockInfo
*
pBlockInfo
,
int32_t
endPos
)
{
SQueryFilePos
*
cur
=
&
pQueryHandle
->
cur
;
SDataCols
*
pCols
=
pQueryHandle
->
rhelper
.
pDataCols
[
0
];
...
...
@@ -1173,21 +1173,20 @@ static void copyRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf
SWAP
(
start
,
end
,
int32_t
);
}
int32_t
numOfRows
=
copyDataFromFileBlock
(
pQueryHandle
,
pQueryHandle
->
outputCapacity
,
0
,
start
,
end
);
assert
(
pQueryHandle
->
outputCapacity
>=
(
end
-
start
+
1
));
int32_t
numOfRows
=
doCopyRowsFromFileBlock
(
pQueryHandle
,
pQueryHandle
->
outputCapacity
,
0
,
start
,
end
);
// the time window should always be ascending order: skey <= ekey
cur
->
win
=
(
STimeWindow
)
{.
skey
=
tsArray
[
start
],
.
ekey
=
tsArray
[
end
]};
cur
->
mixBlock
=
(
start
==
0
&&
end
==
pBlockInfo
->
rows
-
1
);
cur
->
mixBlock
=
(
start
>
0
&&
end
<
pBlockInfo
->
rows
-
1
);
cur
->
lastKey
=
tsArray
[
endPos
]
+
step
;
pos
+=
endPos
+
step
;
cur
->
blockCompleted
=
(((
pos
>=
endPos
||
cur
->
lastKey
>
pQueryHandle
->
window
.
ekey
)
&&
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
||
((
pos
<=
endPos
||
cur
->
lastKey
<
pQueryHandle
->
window
.
ekey
)
&&
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)));
cur
->
blockCompleted
=
true
;
// if the buffer is not full in case of descending order query, move the data in the front of the buffer
moveDataToFront
(
pQueryHandle
,
numOfRows
,
numOfCols
);
// The value of pos may be -1 or pBlockInfo->rows, and it is invalid in both cases.
pos
=
endPos
+
step
;
updateInfoAfterMerge
(
pQueryHandle
,
pCheckInfo
,
numOfRows
,
pos
);
doCheckGeneratedBlockRange
(
pQueryHandle
);
...
...
@@ -1245,7 +1244,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
// no data in buffer, load data from file directly
if
(
pCheckInfo
->
iiter
==
NULL
&&
pCheckInfo
->
iter
==
NULL
)
{
copyRowsFromFileBlock
(
pQueryHandle
,
pCheckInfo
,
&
blockInfo
,
endPos
);
copy
AllRemain
RowsFromFileBlock
(
pQueryHandle
,
pCheckInfo
,
&
blockInfo
,
endPos
);
return
;
}
else
if
(
pCheckInfo
->
iter
!=
NULL
||
pCheckInfo
->
iiter
!=
NULL
)
{
SSkipListNode
*
node
=
NULL
;
...
...
@@ -1297,7 +1296,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
int32_t
qstart
=
0
,
qend
=
0
;
getQualifiedRowsPos
(
pQueryHandle
,
pos
,
end
,
numOfRows
,
&
qstart
,
&
qend
);
numOfRows
=
copyData
FromFileBlock
(
pQueryHandle
,
pQueryHandle
->
outputCapacity
,
numOfRows
,
qstart
,
qend
);
numOfRows
=
doCopyRows
FromFileBlock
(
pQueryHandle
,
pQueryHandle
->
outputCapacity
,
numOfRows
,
qstart
,
qend
);
pos
+=
(
qend
-
qstart
+
1
)
*
step
;
cur
->
win
.
ekey
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
tsArray
[
qend
]
:
tsArray
[
qstart
];
...
...
@@ -1321,7 +1320,7 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
int32_t
start
=
-
1
,
end
=
-
1
;
getQualifiedRowsPos
(
pQueryHandle
,
pos
,
endPos
,
numOfRows
,
&
start
,
&
end
);
numOfRows
=
copyData
FromFileBlock
(
pQueryHandle
,
pQueryHandle
->
outputCapacity
,
numOfRows
,
start
,
end
);
numOfRows
=
doCopyRows
FromFileBlock
(
pQueryHandle
,
pQueryHandle
->
outputCapacity
,
numOfRows
,
start
,
end
);
pos
+=
(
end
-
start
+
1
)
*
step
;
cur
->
win
.
ekey
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
tsArray
[
end
]
:
tsArray
[
start
];
...
...
@@ -2192,7 +2191,7 @@ SArray* tsdbRetrieveDataBlock(TsdbQueryHandleT* pQueryHandle, SArray* pIdList) {
}
// todo refactor
int32_t
numOfRows
=
copyData
FromFileBlock
(
pHandle
,
pHandle
->
outputCapacity
,
0
,
0
,
pBlock
->
numOfRows
-
1
);
int32_t
numOfRows
=
doCopyRows
FromFileBlock
(
pHandle
,
pHandle
->
outputCapacity
,
0
,
0
,
pBlock
->
numOfRows
-
1
);
// if the buffer is not full in case of descending order query, move the data in the front of the buffer
if
(
!
ASCENDING_TRAVERSE
(
pHandle
->
order
)
&&
numOfRows
<
pHandle
->
outputCapacity
)
{
...
...
src/util/src/tcache.c
浏览文件 @
8795d190
...
...
@@ -532,7 +532,7 @@ void taosTrashCanEmpty(SCacheObj *pCacheObj, bool force) {
if
(
pCacheObj
->
numOfElemsInTrash
==
0
)
{
if
(
pCacheObj
->
pTrash
!=
NULL
)
{
uError
(
"cache:%s, key:inconsistency data in cache, numOfElem in trash:%d"
,
pCacheObj
->
name
,
pCacheObj
->
numOfElemsInTrash
);
uError
(
"cache:%s, key:inconsistency data in cache, numOfElem in trash
can
:%d"
,
pCacheObj
->
name
,
pCacheObj
->
numOfElemsInTrash
);
}
pCacheObj
->
pTrash
=
NULL
;
...
...
@@ -549,7 +549,7 @@ void taosTrashCanEmpty(SCacheObj *pCacheObj, bool force) {
}
if
(
force
||
(
T_REF_VAL_GET
(
pElem
->
pData
)
==
0
))
{
uError
(
"cache:%s, key:%p, %p removed from trashcan. numOfElem in trash:%d"
,
pCacheObj
->
name
,
pElem
->
pData
->
key
,
pElem
->
pData
->
data
,
uError
(
"cache:%s, key:%p, %p removed from trashcan. numOfElem in trash
can
:%d"
,
pCacheObj
->
name
,
pElem
->
pData
->
key
,
pElem
->
pData
->
data
,
pCacheObj
->
numOfElemsInTrash
-
1
);
STrashElem
*
p
=
pElem
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录