Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2bb5ac94
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看板
未验证
提交
2bb5ac94
编写于
7月 18, 2023
作者:
H
Haojun Liao
提交者:
GitHub
7月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #22110 from taosdata/fix/TD-25263
reset state key memory
上级
5f6afc66
caa45033
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
5 deletion
+32
-5
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+32
-5
未找到文件。
source/libs/executor/src/timewindowoperator.c
浏览文件 @
2bb5ac94
...
...
@@ -4036,7 +4036,7 @@ bool isEqualStateKey(SStateWindowInfo* pWin, char* pKeyData) {
bool
compareStateKey
(
void
*
data
,
void
*
key
)
{
if
(
!
data
||
!
key
)
{
return
tru
e
;
return
fals
e
;
}
SStateKeys
*
stateKey
=
(
SStateKeys
*
)
key
;
stateKey
->
pData
=
(
char
*
)
key
+
sizeof
(
SStateKeys
);
...
...
@@ -4062,7 +4062,13 @@ void setStateOutputBuf(SStreamAggSupporter* pAggSup, TSKEY ts, uint64_t groupId,
if
(
code
==
TSDB_CODE_SUCCESS
&&
!
inWinRange
(
&
pAggSup
->
winRange
,
&
pCurWin
->
winInfo
.
sessionWin
.
win
))
{
code
=
TSDB_CODE_FAILED
;
releaseOutputBuf
(
pAggSup
->
pState
,
NULL
,
(
SResultRow
*
)
pCurWin
->
winInfo
.
pOutputBuf
,
&
pAggSup
->
pSessionAPI
->
stateStore
);
pCurWin
->
winInfo
.
pOutputBuf
=
taosMemoryMalloc
(
size
);
pCurWin
->
winInfo
.
pOutputBuf
=
taosMemoryCalloc
(
1
,
size
);
pCurWin
->
pStateKey
=
(
SStateKeys
*
)((
char
*
)
pCurWin
->
winInfo
.
pOutputBuf
+
(
pAggSup
->
resultRowSize
-
pAggSup
->
stateKeySize
));
pCurWin
->
pStateKey
->
bytes
=
pAggSup
->
stateKeySize
-
sizeof
(
SStateKeys
);
pCurWin
->
pStateKey
->
type
=
pAggSup
->
stateKeyType
;
pCurWin
->
pStateKey
->
pData
=
(
char
*
)
pCurWin
->
pStateKey
+
sizeof
(
SStateKeys
);
pCurWin
->
pStateKey
->
isNull
=
false
;
}
if
(
code
==
TSDB_CODE_SUCCESS
)
{
...
...
@@ -4076,11 +4082,19 @@ void setStateOutputBuf(SStreamAggSupporter* pAggSup, TSKEY ts, uint64_t groupId,
}
pNextWin
->
winInfo
.
sessionWin
=
pCurWin
->
winInfo
.
sessionWin
;
pNextWin
->
winInfo
.
pOutputBuf
=
NULL
;
SStreamStateCur
*
pCur
=
pAggSup
->
stateStore
.
streamStateSessionSeekKeyNext
(
pAggSup
->
pState
,
&
pCurWin
->
winInfo
.
sessionWin
)
;
code
=
pAggSup
->
stateStore
.
streamStateSessionGetKVByCur
(
pCur
,
&
pNextWin
->
winInfo
.
sessionWin
,
NULL
,
0
);
SStreamStateCur
*
pCur
=
pAggSup
->
stateStore
.
streamStateSessionSeekKeyNext
(
pAggSup
->
pState
,
&
pNextWin
->
winInfo
.
sessionWin
)
;
int32_t
nextSize
=
pAggSup
->
resultRowSize
;
code
=
pAggSup
->
stateStore
.
streamStateSessionGetKVByCur
(
pCur
,
&
pNextWin
->
winInfo
.
sessionWin
,
&
pNextWin
->
winInfo
.
pOutputBuf
,
&
nextSize
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
SET_SESSION_WIN_INVALID
(
pNextWin
->
winInfo
);
}
else
{
pNextWin
->
pStateKey
=
(
SStateKeys
*
)((
char
*
)
pNextWin
->
winInfo
.
pOutputBuf
+
(
pAggSup
->
resultRowSize
-
pAggSup
->
stateKeySize
));
pNextWin
->
pStateKey
->
bytes
=
pAggSup
->
stateKeySize
-
sizeof
(
SStateKeys
);
pNextWin
->
pStateKey
->
type
=
pAggSup
->
stateKeyType
;
pNextWin
->
pStateKey
->
pData
=
(
char
*
)
pNextWin
->
pStateKey
+
sizeof
(
SStateKeys
);
pNextWin
->
pStateKey
->
isNull
=
false
;
pNextWin
->
winInfo
.
isOutput
=
true
;
}
pAggSup
->
stateStore
.
streamStateFreeCur
(
pCur
);
}
...
...
@@ -4156,6 +4170,9 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl
SStateWindowInfo
curWin
=
{
0
};
SStateWindowInfo
nextWin
=
{
0
};
setStateOutputBuf
(
pAggSup
,
tsCols
[
i
],
groupId
,
pKeyData
,
&
curWin
,
&
nextWin
);
if
(
IS_VALID_SESSION_WIN
(
nextWin
.
winInfo
))
{
releaseOutputBuf
(
pAggSup
->
pState
,
NULL
,
(
SResultRow
*
)
nextWin
.
winInfo
.
pOutputBuf
,
&
pAPI
->
stateStore
);
}
setSessionWinOutputInfo
(
pSeUpdated
,
&
curWin
.
winInfo
);
winRows
=
updateStateWindowInfo
(
&
curWin
,
&
nextWin
,
tsCols
,
groupId
,
pKeyColInfo
,
rows
,
i
,
&
allEqual
,
pAggSup
->
pResultRows
,
pSeUpdated
,
pStDeleted
);
...
...
@@ -4346,9 +4363,19 @@ void streamStateReloadState(SOperatorInfo* pOperator) {
for
(
int32_t
i
=
0
;
i
<
num
;
i
++
)
{
SStateWindowInfo
curInfo
=
{
0
};
SStateWindowInfo
nextInfo
=
{
0
};
SStateWindowInfo
dummy
=
{
0
};
setStateOutputBuf
(
pAggSup
,
pSeKeyBuf
[
i
].
win
.
skey
,
pSeKeyBuf
[
i
].
groupId
,
NULL
,
&
curInfo
,
&
nextInfo
);
if
(
compareStateKey
(
curInfo
.
pStateKey
,
nextInfo
.
pStateKey
))
{
compactStateWindow
(
pOperator
,
&
curInfo
.
winInfo
,
&
nextInfo
.
winInfo
,
pInfo
->
pStUpdated
,
pInfo
->
pStDeleted
);
saveResult
(
curInfo
.
winInfo
,
pInfo
->
pStUpdated
);
}
if
(
IS_VALID_SESSION_WIN
(
curInfo
.
winInfo
))
{
releaseOutputBuf
(
pAggSup
->
pState
,
NULL
,
(
SResultRow
*
)
curInfo
.
winInfo
.
pOutputBuf
,
&
pAggSup
->
pSessionAPI
->
stateStore
);
}
if
(
IS_VALID_SESSION_WIN
(
nextInfo
.
winInfo
))
{
releaseOutputBuf
(
pAggSup
->
pState
,
NULL
,
(
SResultRow
*
)
nextInfo
.
winInfo
.
pOutputBuf
,
&
pAggSup
->
pSessionAPI
->
stateStore
);
}
}
taosMemoryFree
(
pBuf
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录