Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
693942b8
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看板
提交
693942b8
编写于
6月 15, 2023
作者:
L
liuyao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
trans state
上级
3b2f2f0a
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
78 addition
and
5 deletion
+78
-5
include/libs/executor/executor.h
include/libs/executor/executor.h
+3
-0
include/libs/executor/storageapi.h
include/libs/executor/storageapi.h
+1
-0
include/libs/stream/streamState.h
include/libs/stream/streamState.h
+2
-0
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+3
-0
include/libs/stream/tstreamFileState.h
include/libs/stream/tstreamFileState.h
+1
-0
source/dnode/snode/src/snodeInitApi.c
source/dnode/snode/src/snodeInitApi.c
+1
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+2
-0
source/dnode/vnode/src/vnd/vnodeInitApi.c
source/dnode/vnode/src/vnd/vnodeInitApi.c
+1
-0
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+13
-1
source/libs/executor/src/projectoperator.c
source/libs/executor/src/projectoperator.c
+15
-0
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+15
-4
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+12
-0
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+4
-0
source/libs/stream/src/tstreamFileState.c
source/libs/stream/src/tstreamFileState.c
+5
-0
未找到文件。
include/libs/executor/executor.h
浏览文件 @
693942b8
...
...
@@ -229,6 +229,9 @@ bool qStreamRecoverScanFinished(qTaskInfo_t tinfo);
void
qStreamCloseTsdbReader
(
void
*
task
);
void
resetTaskInfo
(
qTaskInfo_t
tinfo
);
int32_t
qStreamOperatorReleaseState
(
qTaskInfo_t
tInfo
);
int32_t
qStreamOperatorReloadState
(
qTaskInfo_t
tInfo
);
#ifdef __cplusplus
}
#endif
...
...
include/libs/executor/storageapi.h
浏览文件 @
693942b8
...
...
@@ -392,6 +392,7 @@ typedef struct SStateStore {
int32_t
(
*
streamStateCommit
)(
SStreamState
*
pState
);
void
(
*
streamStateDestroy
)(
SStreamState
*
pState
,
bool
remove
);
int32_t
(
*
streamStateDeleteCheckPoint
)(
SStreamState
*
pState
,
TSKEY
mark
);
void
(
*
streamStateReloadInfo
)(
SStreamState
*
pState
,
TSKEY
ts
);
}
SStateStore
;
typedef
struct
SStorageAPI
{
...
...
include/libs/stream/streamState.h
浏览文件 @
693942b8
...
...
@@ -138,6 +138,8 @@ int32_t streamStateCurPrev(SStreamState* pState, SStreamStateCur* pCur);
int32_t
streamStatePutParName
(
SStreamState
*
pState
,
int64_t
groupId
,
const
char
*
tbname
);
int32_t
streamStateGetParName
(
SStreamState
*
pState
,
int64_t
groupId
,
void
**
pVal
);
void
streamStateReloadInfo
(
SStreamState
*
pState
,
TSKEY
ts
);
/***compare func **/
typedef
struct
SStateChekpoint
{
...
...
include/libs/stream/tstream.h
浏览文件 @
693942b8
...
...
@@ -620,6 +620,9 @@ int32_t streamProcessCheckpointSourceReq(SStreamMeta* pMeta, SStreamTask* pTask,
int32_t
streamProcessCheckpointReq
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamCheckpointReq
*
pReq
);
int32_t
streamProcessCheckpointRsp
(
SStreamMeta
*
pMeta
,
SStreamTask
*
pTask
,
SStreamCheckpointRsp
*
pRsp
);
int32_t
streamTaskReleaseState
(
SStreamTask
*
pTask
);
int32_t
streamTaskReloadState
(
SStreamTask
*
pTask
);
#ifdef __cplusplus
}
#endif
...
...
include/libs/stream/tstreamFileState.h
浏览文件 @
693942b8
...
...
@@ -49,6 +49,7 @@ int32_t recoverSnapshot(SStreamFileState* pFileState);
int32_t
getSnapshotIdList
(
SStreamFileState
*
pFileState
,
SArray
*
list
);
int32_t
deleteExpiredCheckPoint
(
SStreamFileState
*
pFileState
,
TSKEY
mark
);
int32_t
streamFileStateGeSelectRowSize
(
SStreamFileState
*
pFileState
);
void
streamFileStateReloadInfo
(
SStreamFileState
*
pFileState
,
TSKEY
ts
);
#ifdef __cplusplus
}
...
...
source/dnode/snode/src/snodeInitApi.c
浏览文件 @
693942b8
...
...
@@ -101,6 +101,7 @@ void initStateStoreAPI(SStateStore* pStore) {
pStore
->
streamStateCommit
=
streamStateCommit
;
pStore
->
streamStateDestroy
=
streamStateDestroy
;
pStore
->
streamStateDeleteCheckPoint
=
streamStateDeleteCheckPoint
;
pStore
->
streamStateReloadInfo
=
streamStateReloadInfo
;
}
void
initFunctionStateStore
(
SFunctionStateStore
*
pStore
)
{
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
693942b8
...
...
@@ -1111,6 +1111,8 @@ int32_t tqProcessTaskScanHistory(STQ* pTq, SRpcMsg* pMsg) {
if
(
pStreamTask
==
NULL
)
{
// todo handle error
}
// streamTaskReleaseState(pTask);
// streamTaskReloadState(pStreamTask);
ASSERT
(
pStreamTask
->
info
.
taskLevel
==
TASK_LEVEL__SOURCE
);
...
...
source/dnode/vnode/src/vnd/vnodeInitApi.c
浏览文件 @
693942b8
...
...
@@ -203,6 +203,7 @@ void initStateStoreAPI(SStateStore* pStore) {
pStore
->
streamStateCommit
=
streamStateCommit
;
pStore
->
streamStateDestroy
=
streamStateDestroy
;
pStore
->
streamStateDeleteCheckPoint
=
streamStateDeleteCheckPoint
;
pStore
->
streamStateReloadInfo
=
streamStateReloadInfo
;
}
void
initMetaReaderAPI
(
SStoreMetaReader
*
pMetaReader
)
{
...
...
source/libs/executor/src/executor.c
浏览文件 @
693942b8
...
...
@@ -1326,4 +1326,16 @@ SArray* getTableListInfo(const SExecTaskInfo* pTaskInfo) {
SOperatorInfo
*
pOperator
=
pTaskInfo
->
pRoot
;
extractTableList
(
pArray
,
pOperator
);
return
pArray
;
}
\ No newline at end of file
}
int32_t
qStreamOperatorReleaseState
(
qTaskInfo_t
tInfo
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tInfo
;
pTaskInfo
->
pRoot
->
fpSet
.
releaseStreamStateFn
(
pTaskInfo
->
pRoot
);
return
0
;
}
int32_t
qStreamOperatorReloadState
(
qTaskInfo_t
tInfo
)
{
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tInfo
;
pTaskInfo
->
pRoot
->
fpSet
.
reloadStreamStateFn
(
pTaskInfo
->
pRoot
);
return
0
;
}
source/libs/executor/src/projectoperator.c
浏览文件 @
693942b8
...
...
@@ -73,6 +73,20 @@ static void destroyIndefinitOperatorInfo(void* param) {
taosMemoryFreeClear
(
param
);
}
void
streamOperatorReleaseState
(
SOperatorInfo
*
pOperator
)
{
SOperatorInfo
*
downstream
=
pOperator
->
pDownstream
[
0
];
if
(
downstream
->
fpSet
.
releaseStreamStateFn
)
{
downstream
->
fpSet
.
releaseStreamStateFn
(
downstream
);
}
}
void
streamOperatorReloadState
(
SOperatorInfo
*
pOperator
)
{
SOperatorInfo
*
downstream
=
pOperator
->
pDownstream
[
0
];
if
(
downstream
->
fpSet
.
reloadStreamStateFn
)
{
downstream
->
fpSet
.
reloadStreamStateFn
(
downstream
);
}
}
SOperatorInfo
*
createProjectOperatorInfo
(
SOperatorInfo
*
downstream
,
SProjectPhysiNode
*
pProjPhyNode
,
SExecTaskInfo
*
pTaskInfo
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -134,6 +148,7 @@ SOperatorInfo* createProjectOperatorInfo(SOperatorInfo* downstream, SProjectPhys
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
optrDummyOpenFn
,
doProjectOperation
,
NULL
,
destroyProjectOperatorInfo
,
optrDefaultBufFn
,
NULL
);
setOperatorStreamStateFn
(
pOperator
,
streamOperatorReleaseState
,
streamOperatorReloadState
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
693942b8
...
...
@@ -28,6 +28,7 @@
#define IS_FINAL_OP(op) ((op)->isFinal)
#define DEAULT_DELETE_MARK (1000LL * 60LL * 60LL * 24LL * 365LL * 10LL);
#define STREAM_INTERVAL_OP_STATE_NAME "StreamIntervalHistoryState"
#define STREAM_SESSION_OP_STATE_NAME "StreamSessionHistoryState"
#define STREAM_STATE_OP_STATE_NAME "StreamStateHistoryState"
...
...
@@ -2724,8 +2725,10 @@ int32_t getMaxFunResSize(SExprSupp* pSup, int32_t numOfCols) {
}
void
streamIntervalReleaseState
(
SOperatorInfo
*
pOperator
)
{
if
(
pOperator
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
)
{
return
;
if
(
pOperator
->
operatorType
!=
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
)
{
SStreamIntervalOperatorInfo
*
pInfo
=
pOperator
->
info
;
int32_t
resSize
=
sizeof
(
TSKEY
);
pInfo
->
statestore
.
streamStateSaveInfo
(
pInfo
->
pState
,
STREAM_INTERVAL_OP_STATE_NAME
,
strlen
(
STREAM_INTERVAL_OP_STATE_NAME
),
&
pInfo
->
twAggSup
.
maxTs
,
resSize
);
}
SStreamIntervalOperatorInfo
*
pInfo
=
pOperator
->
info
;
SStorageAPI
*
pAPI
=
&
pOperator
->
pTaskInfo
->
storageAPI
;
...
...
@@ -2737,6 +2740,15 @@ void streamIntervalReleaseState(SOperatorInfo* pOperator) {
}
void
streamIntervalReloadState
(
SOperatorInfo
*
pOperator
)
{
if
(
pOperator
->
operatorType
!=
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
)
{
SStreamIntervalOperatorInfo
*
pInfo
=
pOperator
->
info
;
int32_t
size
=
0
;
void
*
pBuf
=
NULL
;
int32_t
code
=
pInfo
->
statestore
.
streamStateGetInfo
(
pInfo
->
pState
,
STREAM_INTERVAL_OP_STATE_NAME
,
strlen
(
STREAM_INTERVAL_OP_STATE_NAME
),
&
pBuf
,
&
size
);
TSKEY
ts
=
*
(
TSKEY
*
)
pBuf
;
pInfo
->
statestore
.
streamStateReloadInfo
(
pInfo
->
pState
,
ts
);
}
SOperatorInfo
*
downstream
=
pOperator
->
pDownstream
[
0
];
if
(
downstream
->
fpSet
.
reloadStreamStateFn
)
{
downstream
->
fpSet
.
reloadStreamStateFn
(
downstream
);
...
...
@@ -3651,7 +3663,6 @@ void streamSessionReloadState(SOperatorInfo* pOperator) {
SStreamSessionAggOperatorInfo
*
pInfo
=
pOperator
->
info
;
SStreamAggSupporter
*
pAggSup
=
&
pInfo
->
streamAggSup
;
SResultWindowInfo
winInfo
=
{
0
};
SSessionKey
seKey
=
{.
win
.
skey
=
INT64_MIN
,
.
win
.
ekey
=
INT64_MIN
,
.
groupId
=
0
};
int32_t
size
=
0
;
void
*
pBuf
=
NULL
;
int32_t
code
=
pAggSup
->
stateStore
.
streamStateGetInfo
(
pAggSup
->
pState
,
STREAM_SESSION_OP_STATE_NAME
,
...
...
@@ -4352,7 +4363,7 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo
,
pTaskInfo
);
pOperator
->
fpSet
=
createOperatorFpSet
(
optrDummyOpenFn
,
doStreamStateAgg
,
NULL
,
destroyStreamStateOperatorInfo
,
optrDefaultBufFn
,
NULL
);
setOperatorStreamStateFn
(
pOperator
,
streamStateReleaseState
,
streamS
ession
ReloadState
);
setOperatorStreamStateFn
(
pOperator
,
streamStateReleaseState
,
streamS
tate
ReloadState
);
initDownStream
(
downstream
,
&
pInfo
->
streamAggSup
,
pOperator
->
operatorType
,
pInfo
->
primaryTsIndex
,
&
pInfo
->
twAggSup
);
code
=
appendDownstream
(
pOperator
,
&
downstream
,
1
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
source/libs/stream/src/streamExec.c
浏览文件 @
693942b8
...
...
@@ -562,3 +562,15 @@ int32_t streamTryExec(SStreamTask* pTask) {
return
0
;
}
int32_t
streamTaskReleaseState
(
SStreamTask
*
pTask
)
{
void
*
exec
=
pTask
->
exec
.
pExecutor
;
int32_t
code
=
qStreamOperatorReleaseState
(
exec
);
return
code
;
}
int32_t
streamTaskReloadState
(
SStreamTask
*
pTask
)
{
void
*
exec
=
pTask
->
exec
.
pExecutor
;
int32_t
code
=
qStreamOperatorReloadState
(
exec
);
return
code
;
}
source/libs/stream/src/streamState.c
浏览文件 @
693942b8
...
...
@@ -1113,6 +1113,10 @@ int32_t streamStateDeleteCheckPoint(SStreamState* pState, TSKEY mark) {
#endif
}
void
streamStateReloadInfo
(
SStreamState
*
pState
,
TSKEY
ts
)
{
streamFileStateReloadInfo
(
pState
->
pFileState
,
ts
);
}
#if 0
char* streamStateSessionDump(SStreamState* pState) {
SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
...
...
source/libs/stream/src/tstreamFileState.c
浏览文件 @
693942b8
...
...
@@ -524,3 +524,8 @@ int32_t recoverSnapshot(SStreamFileState* pFileState) {
}
int32_t
streamFileStateGeSelectRowSize
(
SStreamFileState
*
pFileState
)
{
return
pFileState
->
selectivityRowSize
;
}
void
streamFileStateReloadInfo
(
SStreamFileState
*
pFileState
,
TSKEY
ts
)
{
pFileState
->
flushMark
=
TMAX
(
pFileState
->
flushMark
,
ts
);
pFileState
->
maxTs
=
TMAX
(
pFileState
->
maxTs
,
ts
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录