Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
39dc3c42
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看板
提交
39dc3c42
编写于
8月 07, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1065]
上级
4545cfaa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
9 deletion
+12
-9
src/query/src/qResultbuf.c
src/query/src/qResultbuf.c
+12
-8
src/query/tests/resultBufferTest.cpp
src/query/tests/resultBufferTest.cpp
+0
-1
未找到文件。
src/query/src/qResultbuf.c
浏览文件 @
39dc3c42
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include "taoserror.h"
#include "taoserror.h"
#define GET_DATA_PAYLOAD(_p) ((_p)->pData + POINTER_BYTES)
#define GET_DATA_PAYLOAD(_p) ((_p)->pData + POINTER_BYTES)
#define NO_IN_MEM_AVAILABLE_PAGES(_b) (listNEles((_b)->lruList) >= (_b)->inMemPages)
int32_t
createDiskbasedResultBuffer
(
SDiskbasedResultBuf
**
pResultBuf
,
int32_t
rowSize
,
int32_t
pagesize
,
int32_t
createDiskbasedResultBuffer
(
SDiskbasedResultBuf
**
pResultBuf
,
int32_t
rowSize
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
const
void
*
handle
)
{
int32_t
inMemBufSize
,
const
void
*
handle
)
{
...
@@ -25,7 +26,7 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t ro
...
@@ -25,7 +26,7 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t ro
pResBuf
->
comp
=
true
;
pResBuf
->
comp
=
true
;
pResBuf
->
file
=
NULL
;
pResBuf
->
file
=
NULL
;
pResBuf
->
handle
=
handle
;
pResBuf
->
handle
=
handle
;
pResBuf
->
fileSize
=
0
;
pResBuf
->
fileSize
=
0
;
// at least more than 2 pages must be in memory
// at least more than 2 pages must be in memory
assert
(
inMemBufSize
>=
pagesize
*
2
);
assert
(
inMemBufSize
>=
pagesize
*
2
);
...
@@ -186,8 +187,6 @@ static char* loadPageFromDisk(SDiskbasedResultBuf* pResultBuf, SPageInfo* pg) {
...
@@ -186,8 +187,6 @@ static char* loadPageFromDisk(SDiskbasedResultBuf* pResultBuf, SPageInfo* pg) {
return
GET_DATA_PAYLOAD
(
pg
);
return
GET_DATA_PAYLOAD
(
pg
);
}
}
#define NO_IN_MEM_AVAILABLE_PAGES(_b) (listNEles((_b)->lruList) >= (_b)->inMemPages)
static
SIDList
addNewGroup
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
)
{
static
SIDList
addNewGroup
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
)
{
assert
(
taosHashGet
(
pResultBuf
->
groupSet
,
(
const
char
*
)
&
groupId
,
sizeof
(
int32_t
))
==
NULL
);
assert
(
taosHashGet
(
pResultBuf
->
groupSet
,
(
const
char
*
)
&
groupId
,
sizeof
(
int32_t
))
==
NULL
);
...
@@ -211,11 +210,12 @@ static SPageInfo* registerPage(SDiskbasedResultBuf* pResultBuf, int32_t groupId,
...
@@ -211,11 +210,12 @@ static SPageInfo* registerPage(SDiskbasedResultBuf* pResultBuf, int32_t groupId,
pResultBuf
->
numOfPages
+=
1
;
pResultBuf
->
numOfPages
+=
1
;
SPageInfo
*
ppi
=
malloc
(
sizeof
(
SPageInfo
));
//{ .info = PAGE_INFO_INITIALIZER, .pageId = pageId, .pn = NULL};
SPageInfo
*
ppi
=
malloc
(
sizeof
(
SPageInfo
));
//{ .info = PAGE_INFO_INITIALIZER, .pageId = pageId, .pn = NULL};
ppi
->
info
=
PAGE_INFO_INITIALIZER
;
ppi
->
pageId
=
pageId
;
ppi
->
pageId
=
pageId
;
ppi
->
pData
=
NULL
;
ppi
->
pData
=
NULL
;
ppi
->
pn
=
NULL
;
ppi
->
info
=
PAGE_INFO_INITIALIZER
;
ppi
->
used
=
true
;
ppi
->
used
=
true
;
ppi
->
pn
=
NULL
;
return
*
(
SPageInfo
**
)
taosArrayPush
(
list
,
&
ppi
);
return
*
(
SPageInfo
**
)
taosArrayPush
(
list
,
&
ppi
);
}
}
...
@@ -246,6 +246,8 @@ static char* evicOneDataPage(SDiskbasedResultBuf* pResultBuf) {
...
@@ -246,6 +246,8 @@ static char* evicOneDataPage(SDiskbasedResultBuf* pResultBuf) {
// all pages are referenced by user, try to allocate new space
// all pages are referenced by user, try to allocate new space
if
(
pn
==
NULL
)
{
if
(
pn
==
NULL
)
{
int32_t
prev
=
pResultBuf
->
inMemPages
;
int32_t
prev
=
pResultBuf
->
inMemPages
;
// increase by 50% of previous mem pages
pResultBuf
->
inMemPages
=
pResultBuf
->
inMemPages
*
1
.
5
;
pResultBuf
->
inMemPages
=
pResultBuf
->
inMemPages
*
1
.
5
;
qWarn
(
"%p in memory buf page not sufficient, expand from %d to %d, page size:%d"
,
pResultBuf
,
prev
,
qWarn
(
"%p in memory buf page not sufficient, expand from %d to %d, page size:%d"
,
pResultBuf
,
prev
,
...
@@ -353,6 +355,8 @@ tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
...
@@ -353,6 +355,8 @@ tFilePage* getResBufPage(SDiskbasedResultBuf* pResultBuf, int32_t id) {
((
void
**
)((
*
pi
)
->
pData
))[
0
]
=
(
*
pi
);
((
void
**
)((
*
pi
)
->
pData
))[
0
]
=
(
*
pi
);
lruListPushFront
(
pResultBuf
->
lruList
,
*
pi
);
lruListPushFront
(
pResultBuf
->
lruList
,
*
pi
);
(
*
pi
)
->
used
=
true
;
loadPageFromDisk
(
pResultBuf
,
*
pi
);
loadPageFromDisk
(
pResultBuf
,
*
pi
);
return
GET_DATA_PAYLOAD
(
*
pi
);
return
GET_DATA_PAYLOAD
(
*
pi
);
}
}
...
...
src/query/tests/resultBufferTest.cpp
浏览文件 @
39dc3c42
...
@@ -130,7 +130,6 @@ void recyclePageTest() {
...
@@ -130,7 +130,6 @@ void recyclePageTest() {
ASSERT_TRUE
(
t4
==
pBufPage4
);
ASSERT_TRUE
(
t4
==
pBufPage4
);
ASSERT_TRUE
(
pageId
==
4
);
ASSERT_TRUE
(
pageId
==
4
);
releaseResBufPage
(
pResultBuf
,
t4
);
releaseResBufPage
(
pResultBuf
,
t4
);
releaseResBufPage
(
pResultBuf
,
t4
);
tFilePage
*
pBufPage5
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
pBufPage5
=
getNewDataBuf
(
pResultBuf
,
groupId
,
&
pageId
);
tFilePage
*
t5
=
getResBufPage
(
pResultBuf
,
pageId
);
tFilePage
*
t5
=
getResBufPage
(
pResultBuf
,
pageId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录