Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
665e1ddd
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看板
提交
665e1ddd
编写于
6月 29, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:add switch for buffer page debug log
上级
95f5d769
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
8 deletion
+34
-8
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+4
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+14
-4
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+6
-1
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+10
-2
未找到文件。
source/libs/executor/src/executil.c
浏览文件 @
665e1ddd
...
@@ -118,7 +118,9 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int
...
@@ -118,7 +118,9 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int
p
->
groupId
=
*
(
uint64_t
*
)
key
;
p
->
groupId
=
*
(
uint64_t
*
)
key
;
p
->
pos
=
*
(
SResultRowPosition
*
)
pData
;
p
->
pos
=
*
(
SResultRowPosition
*
)
pData
;
memcpy
(
p
->
key
,
(
char
*
)
key
+
sizeof
(
uint64_t
),
keyLen
-
sizeof
(
uint64_t
));
memcpy
(
p
->
key
,
(
char
*
)
key
+
sizeof
(
uint64_t
),
keyLen
-
sizeof
(
uint64_t
));
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_groupRes, groupId:%"
PRIu64
",pageId:%d,offset:%d
\n
"
,
p
->
groupId
,
p
->
pos
.
pageId
,
p
->
pos
.
offset
);
qDebug
(
"page_groupRes, groupId:%"
PRIu64
",pageId:%d,offset:%d
\n
"
,
p
->
groupId
,
p
->
pos
.
pageId
,
p
->
pos
.
offset
);
#endif
taosArrayPush
(
pGroupResInfo
->
pRows
,
&
p
);
taosArrayPush
(
pGroupResInfo
->
pRows
,
&
p
);
}
}
...
@@ -607,8 +609,9 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
...
@@ -607,8 +609,9 @@ static int32_t setSelectValueColumnInfo(SqlFunctionCtx* pCtx, int32_t numOfOutpu
p
=
&
pCtx
[
i
];
p
=
&
pCtx
[
i
];
}
}
}
}
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_setSelect num:%d"
,
num
);
qDebug
(
"page_setSelect num:%d"
,
num
);
#endif
if
(
p
!=
NULL
)
{
if
(
p
!=
NULL
)
{
p
->
subsidiaries
.
pCtx
=
pValCtx
;
p
->
subsidiaries
.
pCtx
=
pValCtx
;
p
->
subsidiaries
.
num
=
num
;
p
->
subsidiaries
.
num
=
num
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
665e1ddd
...
@@ -275,7 +275,9 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
...
@@ -275,7 +275,9 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// 1. close current opened time window
// 1. close current opened time window
if
(
pResultRowInfo
->
cur
.
pageId
!=
-
1
&&
((
pResult
==
NULL
)
||
(
pResult
->
pageId
!=
pResultRowInfo
->
cur
.
pageId
&&
if
(
pResultRowInfo
->
cur
.
pageId
!=
-
1
&&
((
pResult
==
NULL
)
||
(
pResult
->
pageId
!=
pResultRowInfo
->
cur
.
pageId
&&
pResult
->
offset
!=
pResultRowInfo
->
cur
.
offset
)))
{
pResult
->
offset
!=
pResultRowInfo
->
cur
.
offset
)))
{
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_1"
);
qDebug
(
"page_1"
);
#endif
SResultRowPosition
pos
=
pResultRowInfo
->
cur
;
SResultRowPosition
pos
=
pResultRowInfo
->
cur
;
SFilePage
*
pPage
=
getBufPage
(
pResultBuf
,
pos
.
pageId
);
SFilePage
*
pPage
=
getBufPage
(
pResultBuf
,
pos
.
pageId
);
releaseBufPage
(
pResultBuf
,
pPage
);
releaseBufPage
(
pResultBuf
,
pPage
);
...
@@ -283,7 +285,9 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
...
@@ -283,7 +285,9 @@ SResultRow* doSetResultOutBufByKey(SDiskbasedBuf* pResultBuf, SResultRowInfo* pR
// allocate a new buffer page
// allocate a new buffer page
if
(
pResult
==
NULL
)
{
if
(
pResult
==
NULL
)
{
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_2"
);
qDebug
(
"page_2"
);
#endif
ASSERT
(
pSup
->
resultRowSize
>
0
);
ASSERT
(
pSup
->
resultRowSize
>
0
);
pResult
=
getNewResultRow
(
pResultBuf
,
groupId
,
pSup
->
resultRowSize
);
pResult
=
getNewResultRow
(
pResultBuf
,
groupId
,
pSup
->
resultRowSize
);
...
@@ -541,7 +545,9 @@ static int32_t doAggregateImpl(SOperatorInfo* pOperator, TSKEY startTs, SqlFunct
...
@@ -541,7 +545,9 @@ static int32_t doAggregateImpl(SOperatorInfo* pOperator, TSKEY startTs, SqlFunct
if
(
pCtx
[
k
].
fpSet
.
process
==
NULL
)
{
if
(
pCtx
[
k
].
fpSet
.
process
==
NULL
)
{
continue
;
continue
;
}
}
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_process"
);
qDebug
(
"page_process"
);
#endif
int32_t
code
=
pCtx
[
k
].
fpSet
.
process
(
&
pCtx
[
k
]);
int32_t
code
=
pCtx
[
k
].
fpSet
.
process
(
&
pCtx
[
k
]);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"%s aggregate function error happens, code: %s"
,
GET_TASKID
(
pOperator
->
pTaskInfo
),
tstrerror
(
code
));
qError
(
"%s aggregate function error happens, code: %s"
,
GET_TASKID
(
pOperator
->
pTaskInfo
),
tstrerror
(
code
));
...
@@ -1416,8 +1422,9 @@ void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t
...
@@ -1416,8 +1422,9 @@ void setExecutionContext(SOperatorInfo* pOperator, int32_t numOfOutput, uint64_t
if
(
pAggInfo
->
groupId
!=
INT32_MIN
&&
pAggInfo
->
groupId
==
groupId
)
{
if
(
pAggInfo
->
groupId
!=
INT32_MIN
&&
pAggInfo
->
groupId
==
groupId
)
{
return
;
return
;
}
}
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_setbuf, groupId:%"
PRIu64
,
groupId
);
qDebug
(
"page_setbuf, groupId:%"
PRIu64
,
groupId
);
#endif
doSetTableGroupOutputBuf
(
pOperator
,
pAggInfo
,
numOfOutput
,
groupId
);
doSetTableGroupOutputBuf
(
pOperator
,
pAggInfo
,
numOfOutput
,
groupId
);
// record the current active group id
// record the current active group id
...
@@ -1493,13 +1500,15 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprI
...
@@ -1493,13 +1500,15 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprI
int32_t
numOfExprs
)
{
int32_t
numOfExprs
)
{
int32_t
numOfRows
=
getNumOfTotalRes
(
pGroupResInfo
);
int32_t
numOfRows
=
getNumOfTotalRes
(
pGroupResInfo
);
int32_t
start
=
pGroupResInfo
->
index
;
int32_t
start
=
pGroupResInfo
->
index
;
#ifdef BUF_PAGE_DEBUG
qDebug
(
"
\n
page_copytoblock rows:%d"
,
numOfRows
);
qDebug
(
"
\n
page_copytoblock rows:%d"
,
numOfRows
);
#endif
for
(
int32_t
i
=
start
;
i
<
numOfRows
;
i
+=
1
)
{
for
(
int32_t
i
=
start
;
i
<
numOfRows
;
i
+=
1
)
{
SResKeyPos
*
pPos
=
taosArrayGetP
(
pGroupResInfo
->
pRows
,
i
);
SResKeyPos
*
pPos
=
taosArrayGetP
(
pGroupResInfo
->
pRows
,
i
);
SFilePage
*
page
=
getBufPage
(
pBuf
,
pPos
->
pos
.
pageId
);
SFilePage
*
page
=
getBufPage
(
pBuf
,
pPos
->
pos
.
pageId
);
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_copytoblock pos pageId:%d, offset:%d"
,
pPos
->
pos
.
pageId
,
pPos
->
pos
.
offset
);
qDebug
(
"page_copytoblock pos pageId:%d, offset:%d"
,
pPos
->
pos
.
pageId
,
pPos
->
pos
.
offset
);
#endif
SResultRow
*
pRow
=
(
SResultRow
*
)((
char
*
)
page
+
pPos
->
pos
.
offset
);
SResultRow
*
pRow
=
(
SResultRow
*
)((
char
*
)
page
+
pPos
->
pos
.
offset
);
doUpdateNumOfRows
(
pRow
,
numOfExprs
,
rowCellOffset
);
doUpdateNumOfRows
(
pRow
,
numOfExprs
,
rowCellOffset
);
...
@@ -1531,8 +1540,9 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprI
...
@@ -1531,8 +1540,9 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprI
pCtx
[
j
].
resultInfo
=
getResultEntryInfo
(
pRow
,
j
,
rowCellOffset
);
pCtx
[
j
].
resultInfo
=
getResultEntryInfo
(
pRow
,
j
,
rowCellOffset
);
if
(
pCtx
[
j
].
fpSet
.
finalize
)
{
if
(
pCtx
[
j
].
fpSet
.
finalize
)
{
#ifdef BUF_PAGE_DEBUG
qDebug
(
"
\n
page_finalize %d"
,
numOfExprs
);
qDebug
(
"
\n
page_finalize %d"
,
numOfExprs
);
#endif
int32_t
code
=
pCtx
[
j
].
fpSet
.
finalize
(
&
pCtx
[
j
],
pBlock
);
int32_t
code
=
pCtx
[
j
].
fpSet
.
finalize
(
&
pCtx
[
j
],
pBlock
);
if
(
TAOS_FAILED
(
code
))
{
if
(
TAOS_FAILED
(
code
))
{
qError
(
"%s build result data block error, code %s"
,
GET_TASKID
(
pTaskInfo
),
tstrerror
(
code
));
qError
(
"%s build result data block error, code %s"
,
GET_TASKID
(
pTaskInfo
),
tstrerror
(
code
));
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
665e1ddd
...
@@ -3030,8 +3030,9 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
...
@@ -3030,8 +3030,9 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
// save the data of this tuple
// save the data of this tuple
saveTupleData
(
pCtx
,
rowIndex
,
pSrcBlock
,
&
pItem
->
tuplePos
);
saveTupleData
(
pCtx
,
rowIndex
,
pSrcBlock
,
&
pItem
->
tuplePos
);
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_saveTuple i:%d, item:%p,pageId:%d, offset:%d
\n
"
,
pEntryInfo
->
numOfRes
,
pItem
,
pItem
->
tuplePos
.
pageId
,
pItem
->
tuplePos
.
offset
);
qDebug
(
"page_saveTuple i:%d, item:%p,pageId:%d, offset:%d
\n
"
,
pEntryInfo
->
numOfRes
,
pItem
,
pItem
->
tuplePos
.
pageId
,
pItem
->
tuplePos
.
offset
);
#endif
// allocate the buffer and keep the data of this row into the new allocated buffer
// allocate the buffer and keep the data of this row into the new allocated buffer
pEntryInfo
->
numOfRes
++
;
pEntryInfo
->
numOfRes
++
;
taosheapsort
((
void
*
)
pItems
,
sizeof
(
STopBotResItem
),
pEntryInfo
->
numOfRes
,
(
const
void
*
)
&
type
,
topBotResComparFn
,
taosheapsort
((
void
*
)
pItems
,
sizeof
(
STopBotResItem
),
pEntryInfo
->
numOfRes
,
(
const
void
*
)
&
type
,
topBotResComparFn
,
...
@@ -3050,7 +3051,9 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
...
@@ -3050,7 +3051,9 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
// save the data of this tuple by over writing the old data
// save the data of this tuple by over writing the old data
copyTupleData
(
pCtx
,
rowIndex
,
pSrcBlock
,
&
pItem
->
tuplePos
);
copyTupleData
(
pCtx
,
rowIndex
,
pSrcBlock
,
&
pItem
->
tuplePos
);
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_copyTuple pageId:%d, offset:%d"
,
pItem
->
tuplePos
.
pageId
,
pItem
->
tuplePos
.
offset
);
qDebug
(
"page_copyTuple pageId:%d, offset:%d"
,
pItem
->
tuplePos
.
pageId
,
pItem
->
tuplePos
.
offset
);
#endif
taosheapadjust
((
void
*
)
pItems
,
sizeof
(
STopBotResItem
),
0
,
pEntryInfo
->
numOfRes
-
1
,
(
const
void
*
)
&
type
,
taosheapadjust
((
void
*
)
pItems
,
sizeof
(
STopBotResItem
),
0
,
pEntryInfo
->
numOfRes
-
1
,
(
const
void
*
)
&
type
,
topBotResComparFn
,
NULL
,
!
isTopQuery
);
topBotResComparFn
,
NULL
,
!
isTopQuery
);
}
}
...
@@ -3165,7 +3168,9 @@ int32_t topBotFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -3165,7 +3168,9 @@ int32_t topBotFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
}
else
{
}
else
{
colDataAppend
(
pCol
,
currentRow
,
(
const
char
*
)
&
pItem
->
v
.
i
,
false
);
colDataAppend
(
pCol
,
currentRow
,
(
const
char
*
)
&
pItem
->
v
.
i
,
false
);
}
}
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_finalize i:%d,item:%p,pageId:%d, offset:%d
\n
"
,
i
,
pItem
,
pItem
->
tuplePos
.
pageId
,
pItem
->
tuplePos
.
offset
);
qDebug
(
"page_finalize i:%d,item:%p,pageId:%d, offset:%d
\n
"
,
i
,
pItem
,
pItem
->
tuplePos
.
pageId
,
pItem
->
tuplePos
.
offset
);
#endif
setSelectivityValue
(
pCtx
,
pBlock
,
&
pRes
->
pItems
[
i
].
tuplePos
,
currentRow
);
setSelectivityValue
(
pCtx
,
pBlock
,
&
pRes
->
pItems
[
i
].
tuplePos
,
currentRow
);
currentRow
+=
1
;
currentRow
+=
1
;
}
}
...
...
source/util/src/tpagedbuf.c
浏览文件 @
665e1ddd
...
@@ -193,7 +193,9 @@ static char* doFlushPageToDisk(SDiskbasedBuf* pBuf, SPageInfo* pg) {
...
@@ -193,7 +193,9 @@ static char* doFlushPageToDisk(SDiskbasedBuf* pBuf, SPageInfo* pg) {
char
*
pDataBuf
=
pg
->
pData
;
char
*
pDataBuf
=
pg
->
pData
;
memset
(
pDataBuf
,
0
,
getAllocPageSize
(
pBuf
->
pageSize
));
memset
(
pDataBuf
,
0
,
getAllocPageSize
(
pBuf
->
pageSize
));
#ifdef BUF_PAGE_DEBUG
uDebug
(
"page_flush %p, pageId:%d, offset:%d"
,
pDataBuf
,
pg
->
pageId
,
pg
->
offset
);
uDebug
(
"page_flush %p, pageId:%d, offset:%d"
,
pDataBuf
,
pg
->
pageId
,
pg
->
offset
);
#endif
pg
->
length
=
size
;
// on disk size
pg
->
length
=
size
;
// on disk size
return
pDataBuf
;
return
pDataBuf
;
}
}
...
@@ -440,7 +442,9 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t groupId, int32_t* pageId) {
...
@@ -440,7 +442,9 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t groupId, int32_t* pageId) {
}
}
((
void
**
)
pi
->
pData
)[
0
]
=
pi
;
((
void
**
)
pi
->
pData
)[
0
]
=
pi
;
#ifdef BUF_PAGE_DEBUG
uDebug
(
"page_getNewBufPage , pi->pData:%p, pageId:%d, offset:%"
PRId64
,
pi
->
pData
,
pi
->
pageId
,
pi
->
offset
);
uDebug
(
"page_getNewBufPage , pi->pData:%p, pageId:%d, offset:%"
PRId64
,
pi
->
pData
,
pi
->
pageId
,
pi
->
offset
);
#endif
return
(
void
*
)(
GET_DATA_PAYLOAD
(
pi
));
return
(
void
*
)(
GET_DATA_PAYLOAD
(
pi
));
}
}
...
@@ -463,8 +467,9 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) {
...
@@ -463,8 +467,9 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) {
lruListMoveToFront
(
pBuf
->
lruList
,
(
*
pi
));
lruListMoveToFront
(
pBuf
->
lruList
,
(
*
pi
));
(
*
pi
)
->
used
=
true
;
(
*
pi
)
->
used
=
true
;
#ifdef BUF_PAGE_DEBUG
uDebug
(
"page_getBufPage1 pageId:%d, offset:%"
PRId64
,
(
*
pi
)
->
pageId
,
(
*
pi
)
->
offset
);
uDebug
(
"page_getBufPage1 pageId:%d, offset:%"
PRId64
,
(
*
pi
)
->
pageId
,
(
*
pi
)
->
offset
);
#endif
return
(
void
*
)(
GET_DATA_PAYLOAD
(
*
pi
));
return
(
void
*
)(
GET_DATA_PAYLOAD
(
*
pi
));
}
else
{
// not in memory
}
else
{
// not in memory
assert
((
*
pi
)
->
pData
==
NULL
&&
(
*
pi
)
->
pn
==
NULL
&&
(((
*
pi
)
->
length
>=
0
&&
(
*
pi
)
->
offset
>=
0
)
||
((
*
pi
)
->
length
==
-
1
&&
(
*
pi
)
->
offset
==
-
1
)));
assert
((
*
pi
)
->
pData
==
NULL
&&
(
*
pi
)
->
pn
==
NULL
&&
(((
*
pi
)
->
length
>=
0
&&
(
*
pi
)
->
offset
>=
0
)
||
((
*
pi
)
->
length
==
-
1
&&
(
*
pi
)
->
offset
==
-
1
)));
...
@@ -496,7 +501,9 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) {
...
@@ -496,7 +501,9 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) {
return
NULL
;
return
NULL
;
}
}
}
}
#ifdef BUF_PAGE_DEBUG
uDebug
(
"page_getBufPage2 pageId:%d, offset:%"
PRId64
,
(
*
pi
)
->
pageId
,
(
*
pi
)
->
offset
);
uDebug
(
"page_getBufPage2 pageId:%d, offset:%"
PRId64
,
(
*
pi
)
->
pageId
,
(
*
pi
)
->
offset
);
#endif
return
(
void
*
)(
GET_DATA_PAYLOAD
(
*
pi
));
return
(
void
*
)(
GET_DATA_PAYLOAD
(
*
pi
));
}
}
}
}
...
@@ -508,8 +515,9 @@ void releaseBufPage(SDiskbasedBuf* pBuf, void* page) {
...
@@ -508,8 +515,9 @@ void releaseBufPage(SDiskbasedBuf* pBuf, void* page) {
}
}
void
releaseBufPageInfo
(
SDiskbasedBuf
*
pBuf
,
SPageInfo
*
pi
)
{
void
releaseBufPageInfo
(
SDiskbasedBuf
*
pBuf
,
SPageInfo
*
pi
)
{
#ifdef BUF_PAGE_DEBUG
uDebug
(
"page_releaseBufPageInfo pageId:%d, used:%d, offset:%"
PRId64
,
pi
->
pageId
,
pi
->
used
,
pi
->
offset
);
uDebug
(
"page_releaseBufPageInfo pageId:%d, used:%d, offset:%"
PRId64
,
pi
->
pageId
,
pi
->
used
,
pi
->
offset
);
#endif
assert
(
pi
->
pData
!=
NULL
&&
pi
->
used
==
true
);
assert
(
pi
->
pData
!=
NULL
&&
pi
->
used
==
true
);
// assert(pi->pData != NULL);
// assert(pi->pData != NULL);
pi
->
used
=
false
;
pi
->
used
=
false
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录