Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9be89ce0
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看板
提交
9be89ce0
编写于
4月 12, 2023
作者:
L
liuyao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete expired check point
上级
4625dd98
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
12 deletion
+30
-12
include/libs/stream/streamState.h
include/libs/stream/streamState.h
+1
-0
include/libs/stream/tstreamFileState.h
include/libs/stream/tstreamFileState.h
+1
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+1
-1
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+9
-8
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+8
-0
source/libs/stream/src/tstreamFileState.c
source/libs/stream/src/tstreamFileState.c
+10
-2
未找到文件。
include/libs/stream/streamState.h
浏览文件 @
9be89ce0
...
...
@@ -65,6 +65,7 @@ void streamStateClose(SStreamState* pState);
int32_t
streamStateBegin
(
SStreamState
*
pState
);
int32_t
streamStateCommit
(
SStreamState
*
pState
);
void
streamStateDestroy
(
SStreamState
*
pState
);
int32_t
streamStateDeleteCheckPoint
(
SStreamState
*
pState
,
TSKEY
mark
);
typedef
struct
{
rocksdb_iterator_t
*
iter
;
...
...
include/libs/stream/tstreamFileState.h
浏览文件 @
9be89ce0
...
...
@@ -54,7 +54,7 @@ int32_t flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pS
int32_t
recoverSnapshot
(
SStreamFileState
*
pFileState
);
int32_t
getSnapshotIdList
(
SStreamFileState
*
pFileState
,
SArray
*
list
);
int32_t
forceRemoveCheckpoint
(
SStreamFileState
*
pFileState
,
int64_t
checkpointId
);
int32_t
deleteExpiredCheckPoint
(
SStreamFileState
*
pFileState
,
TSKEY
mark
);
#ifdef __cplusplus
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
9be89ce0
...
...
@@ -2151,7 +2151,7 @@ FETCH_NEXT_BLOCK:
// record the scan action.
pInfo
->
numOfExec
++
;
pOperator
->
resultInfo
.
totalRows
+=
pBlockInfo
->
rows
;
//
printDataBlock(pInfo->pRes, "stream scan");
printDataBlock
(
pInfo
->
pRes
,
"stream scan"
);
qDebug
(
"scan rows: %"
PRId64
,
pBlockInfo
->
rows
);
if
(
pBlockInfo
->
rows
>
0
)
{
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
9be89ce0
...
...
@@ -1454,10 +1454,6 @@ STimeWindow getFinalTimeWindow(int64_t ts, SInterval* pInterval) {
return
w
;
}
static
void
deleteIntervalDiscBuf
(
SStreamState
*
pState
,
TSKEY
mark
)
{
//todo(liuyao) delete expired check point
}
static
void
closeChildIntervalWindow
(
SOperatorInfo
*
pOperator
,
SArray
*
pChildren
,
TSKEY
maxTs
)
{
int32_t
size
=
taosArrayGetSize
(
pChildren
);
for
(
int32_t
i
=
0
;
i
<
size
;
i
++
)
{
...
...
@@ -2404,6 +2400,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
STimeWindow
nextWin
=
{
0
};
if
(
IS_FINAL_OP
(
pInfo
))
{
nextWin
=
getFinalTimeWindow
(
ts
,
&
pInfo
->
interval
);
qDebug
(
"===stream===final ts:%"
PRId64
", getFinalTimeWindow:%"
PRId64
,
ts
,
nextWin
.
skey
);
}
else
{
nextWin
=
getActiveTimeWindow
(
pInfo
->
aggSup
.
pResultBuf
,
pResultRowInfo
,
ts
,
&
pInfo
->
interval
,
TSDB_ORDER_ASC
);
}
...
...
@@ -2448,14 +2445,17 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
}
if
(
ignore
)
{
startPos
=
getNexWindowPos
(
&
pInfo
->
interval
,
&
pSDataBlock
->
info
,
tsCols
,
startPos
,
nextWin
.
ekey
,
&
nextWin
);
// startPos = getNexWindowPos(&pInfo->interval, &pSDataBlock->info, tsCols, startPos, nextWin.ekey, &nextWin);
int32_t
prevEndPos
=
startPos
;
startPos
=
getNextQualifiedFinalWindow
(
&
pInfo
->
interval
,
&
nextWin
,
&
pSDataBlock
->
info
,
tsCols
,
prevEndPos
);
if
(
startPos
<
0
)
{
break
;
}
continue
;
}
}
qDebug
(
"===stream===final setIntervalOutputBuf:%"
PRId64
,
nextWin
.
skey
);
int32_t
code
=
setIntervalOutputBuf
(
pInfo
->
pState
,
&
nextWin
,
&
pResPos
,
groupId
,
pSup
->
pCtx
,
numOfOutput
,
pSup
->
rowEntryInfoOffset
,
&
pInfo
->
aggSup
);
pResult
=
(
SResultRow
*
)
pResPos
->
pRowBuff
;
...
...
@@ -2474,6 +2474,7 @@ static void doStreamIntervalAggImpl(SOperatorInfo* pOperatorInfo, SSDataBlock* p
.
groupId
=
groupId
,
};
if
(
pInfo
->
twAggSup
.
calTrigger
==
STREAM_TRIGGER_AT_ONCE
&&
pUpdatedMap
)
{
qDebug
(
"===stream===is final%d saveWinResult:%"
PRId64
,
IS_FINAL_OP
(
pInfo
),
key
.
ts
);
saveWinResult
(
&
key
,
pResPos
,
pUpdatedMap
);
}
...
...
@@ -2575,9 +2576,9 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
setStreamDataVersion
(
pTaskInfo
,
pInfo
->
dataVersion
,
pInfo
->
pState
->
checkPointId
);
qDebug
(
"===stream===clear semi operator"
);
}
else
{
deleteIntervalDiscBuf
(
pInfo
->
pState
,
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
deleteMark
);
if
(
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
checkPointInterval
>
pInfo
->
twAggSup
.
checkPointTs
)
{
streamStateCommit
(
pInfo
->
pState
);
streamStateDeleteCheckPoint
(
pInfo
->
pState
,
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
deleteMark
);
pInfo
->
twAggSup
.
checkPointTs
=
pInfo
->
twAggSup
.
maxTs
;
}
qDebug
(
"===stream===interval final close"
);
...
...
@@ -4813,10 +4814,10 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
printDataBlock
(
pInfo
->
binfo
.
pRes
,
"single interval"
);
return
pInfo
->
binfo
.
pRes
;
}
deleteIntervalDiscBuf
(
pInfo
->
pState
,
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
deleteMark
);
setOperatorCompleted
(
pOperator
);
if
(
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
checkPointInterval
>
pInfo
->
twAggSup
.
checkPointTs
)
{
streamStateCommit
(
pInfo
->
pState
);
streamStateDeleteCheckPoint
(
pInfo
->
pState
,
pInfo
->
twAggSup
.
maxTs
-
pInfo
->
twAggSup
.
deleteMark
);
setStreamDataVersion
(
pTaskInfo
,
pInfo
->
dataVersion
,
pInfo
->
pState
->
checkPointId
);
pInfo
->
twAggSup
.
checkPointTs
=
pInfo
->
twAggSup
.
maxTs
;
}
...
...
source/libs/stream/src/streamState.c
浏览文件 @
9be89ce0
...
...
@@ -1072,6 +1072,14 @@ void streamStateDestroy(SStreamState* pState) {
taosMemoryFreeClear
(
pState
);
}
int32_t
streamStateDeleteCheckPoint
(
SStreamState
*
pState
,
TSKEY
mark
)
{
#ifdef USE_ROCKSDB
return
deleteExpiredCheckPoint
(
pState
->
pFileState
,
mark
);
#else
return
0
;
#endif
}
#if 0
char* streamStateSessionDump(SStreamState* pState) {
SStreamStateCur* pCur = taosMemoryCalloc(1, sizeof(SStreamStateCur));
...
...
source/libs/stream/src/tstreamFileState.c
浏览文件 @
9be89ce0
...
...
@@ -372,17 +372,20 @@ int32_t flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot,
return
code
;
}
int32_t
forceRemoveCheckpoint
(
SStreamFileState
*
pFileState
,
int64_t
checkpointId
)
{
const
char
*
taskKey
=
"streamFileState"
;
char
keyBuf
[
128
]
=
{
0
};
sprintf
(
keyBuf
,
"%s:%"
PRId64
""
,
taskKey
,
checkpointId
);
return
streamDefaultDel_rocksdb
(
pFileState
->
pFileStore
,
keyBuf
);
}
int32_t
getSnapshotIdList
(
SStreamFileState
*
pFileState
,
SArray
*
list
)
{
const
char
*
taskKey
=
"streamFileState"
;
return
streamDefaultIter_rocksdb
(
pFileState
->
pFileStore
,
taskKey
,
NULL
,
list
);
}
int32_t
recoverSnapshot
(
SStreamFileState
*
pFileState
)
{
int32_t
deleteExpiredCheckPoint
(
SStreamFileState
*
pFileState
,
TSKEY
mark
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
const
char
*
taskKey
=
"streamFileState"
;
int64_t
maxCheckPointId
=
0
;
...
...
@@ -410,13 +413,18 @@ int32_t recoverSnapshot(SStreamFileState* pFileState) {
TSKEY
ts
;
sscanf
(
val
,
"%"
PRId64
""
,
&
ts
);
taosMemoryFree
(
val
);
if
(
ts
<
pFileState
->
deleteM
ark
)
{
if
(
ts
<
m
ark
)
{
forceRemoveCheckpoint
(
pFileState
,
i
);
break
;
}
else
{
}
}
return
code
;
}
int32_t
recoverSnapshot
(
SStreamFileState
*
pFileState
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
deleteExpiredCheckPoint
(
pFileState
,
pFileState
->
maxTs
-
pFileState
->
deleteMark
);
void
*
pStVal
=
NULL
;
int32_t
len
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录