Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d8525123
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看板
提交
d8525123
编写于
5月 19, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(stream): add API to retrieve last ts for multi-tables.
上级
7374ea2f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
67 addition
and
9 deletion
+67
-9
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+2
-1
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+55
-0
source/libs/stream/src/streamRecover.c
source/libs/stream/src/streamRecover.c
+9
-8
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
d8525123
...
...
@@ -198,6 +198,7 @@ void *tsdbGetIdx(SMeta *pMeta);
void
*
tsdbGetIvtIdx
(
SMeta
*
pMeta
);
uint64_t
tsdbGetReaderMaxVersion
(
STsdbReader
*
pReader
);
void
tsdbReaderSetCloseFlag
(
STsdbReader
*
pReader
);
int64_t
tsdbGetLastTimestamp
(
SVnode
*
pVnode
,
void
*
pTableList
,
int32_t
numOfTables
,
const
char
*
pIdStr
);
int32_t
tsdbReuseCacherowsReader
(
void
*
pReader
,
void
*
pTableIdList
,
int32_t
numOfTables
);
int32_t
tsdbCacherowsReaderOpen
(
void
*
pVnode
,
int32_t
type
,
void
*
pTableIdList
,
int32_t
numOfTables
,
int32_t
numOfCols
,
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
d8525123
...
...
@@ -760,6 +760,7 @@ void freePtr(void *ptr) {
int32_t
tqExpandTask
(
STQ
*
pTq
,
SStreamTask
*
pTask
,
int64_t
ver
)
{
int32_t
vgId
=
TD_VID
(
pTq
->
pVnode
);
pTask
->
id
.
idStr
=
createStreamTaskIdStr
(
pTask
->
id
.
streamId
,
pTask
->
id
.
taskId
);
pTask
->
refCnt
=
1
;
pTask
->
status
.
schedStatus
=
TASK_SCHED_STATUS__INACTIVE
;
...
...
@@ -837,7 +838,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
}
if
(
pTask
->
taskLevel
==
TASK_LEVEL__SOURCE
)
{
SWalFilterCond
cond
=
{.
deleteMsg
=
1
};
SWalFilterCond
cond
=
{.
deleteMsg
=
1
};
// delete msg also extract from wal files
pTask
->
exec
.
pWalReader
=
walOpenReader
(
pTq
->
pVnode
->
pWal
,
&
cond
);
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
d8525123
...
...
@@ -5506,3 +5506,58 @@ void tsdbReaderSetId(STsdbReader* pReader, const char* idstr) {
}
void
tsdbReaderSetCloseFlag
(
STsdbReader
*
pReader
)
{
pReader
->
code
=
TSDB_CODE_TSC_QUERY_CANCELLED
;
}
/*-------------todo:refactor the implementation of those APIs in this file to seperate the API into two files------*/
// opt perf, do NOT create so many readers
int64_t
tsdbGetLastTimestamp
(
SVnode
*
pVnode
,
void
*
pTableList
,
int32_t
numOfTables
,
const
char
*
pIdStr
)
{
SQueryTableDataCond
cond
=
{.
type
=
TIMEWINDOW_RANGE_CONTAINED
,
.
numOfCols
=
1
,
.
order
=
TSDB_ORDER_DESC
,
.
startVersion
=
-
1
,
.
endVersion
=
-
1
};
cond
.
twindows
.
skey
=
INT64_MIN
;
cond
.
twindows
.
ekey
=
INT64_MAX
;
cond
.
colList
=
taosMemoryCalloc
(
1
,
sizeof
(
SColumnInfo
));
cond
.
pSlotList
=
taosMemoryMalloc
(
sizeof
(
int32_t
)
*
cond
.
numOfCols
);
if
(
cond
.
colList
==
NULL
||
cond
.
pSlotList
==
NULL
)
{
// todo
}
cond
.
colList
[
0
].
colId
=
1
;
cond
.
colList
[
0
].
slotId
=
0
;
cond
.
colList
[
0
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
cond
.
pSlotList
[
0
]
=
0
;
STableKeyInfo
*
pTableKeyInfo
=
pTableList
;
STsdbReader
*
pReader
=
NULL
;
SSDataBlock
*
pBlock
=
createDataBlock
();
SColumnInfoData
data
=
{
0
};
data
.
info
=
(
SColumnInfo
)
{.
type
=
TSDB_DATA_TYPE_TIMESTAMP
,
.
colId
=
1
,
.
bytes
=
TSDB_KEYSIZE
};
blockDataAppendColInfo
(
pBlock
,
&
data
);
int64_t
key
=
INT64_MIN
;
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
int32_t
code
=
tsdbReaderOpen
(
pVnode
,
&
cond
,
&
pTableKeyInfo
[
i
],
1
,
pBlock
,
&
pReader
,
pIdStr
,
false
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
bool
hasData
=
false
;
code
=
tsdbNextDataBlock
(
pReader
,
&
hasData
);
if
(
!
hasData
||
code
!=
TSDB_CODE_SUCCESS
)
{
continue
;
}
SColumnInfoData
*
pCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
int64_t
k
=
*
(
int64_t
*
)
pCol
->
pData
;
if
(
key
<
k
)
{
key
=
k
;
}
tsdbReaderClose
(
pReader
);
}
return
0
;
}
source/libs/stream/src/streamRecover.c
浏览文件 @
d8525123
...
...
@@ -20,7 +20,7 @@ int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version) {
if
(
pTask
->
taskLevel
==
TASK_LEVEL__SOURCE
)
{
atomic_store_8
(
&
pTask
->
status
.
taskStatus
,
TASK_STATUS__RECOVER_PREPARE
);
qDebug
(
"s-task:%s set task status:%d and start recover"
,
pTask
->
id
.
idStr
,
pTask
->
status
.
taskStatus
);
qDebug
(
"s-task:%s set task status:%d and start
to
recover"
,
pTask
->
id
.
idStr
,
pTask
->
status
.
taskStatus
);
streamSetParamForRecover
(
pTask
);
streamSourceRecoverPrepareStep1
(
pTask
,
version
);
...
...
@@ -46,6 +46,7 @@ int32_t streamTaskLaunchRecover(SStreamTask* pTask, int64_t version) {
streamSetParamForRecover
(
pTask
);
streamAggRecoverPrepare
(
pTask
);
}
else
if
(
pTask
->
taskLevel
==
TASK_LEVEL__SINK
)
{
// sink nodes has no specified operation for fill history
atomic_store_8
(
&
pTask
->
status
.
taskStatus
,
TASK_STATUS__NORMAL
);
}
...
...
@@ -71,23 +72,23 @@ int32_t streamTaskCheckDownstream(SStreamTask* pTask, int64_t version) {
req
.
downstreamTaskId
=
pTask
->
fixedEpDispatcher
.
taskId
;
pTask
->
checkReqId
=
req
.
reqId
;
qDebug
(
"s-task:%s at node %d check downstream task
%d at node %d"
,
pTask
->
id
.
idStr
,
pTask
->
nodeId
,
req
.
downstreamTaskId
,
qDebug
(
"s-task:%s at node %d check downstream task
:
%d at node %d"
,
pTask
->
id
.
idStr
,
pTask
->
nodeId
,
req
.
downstreamTaskId
,
req
.
downstreamNodeId
);
streamDispatchCheckMsg
(
pTask
,
&
req
,
pTask
->
fixedEpDispatcher
.
nodeId
,
&
pTask
->
fixedEpDispatcher
.
epSet
);
}
else
if
(
pTask
->
outputType
==
TASK_OUTPUT__SHUFFLE_DISPATCH
)
{
SArray
*
vgInfo
=
pTask
->
shuffleDispatcher
.
dbInfo
.
pVgroupInfos
;
int32_t
vgSz
=
taosArrayGetSize
(
vgInfo
);
pTask
->
recoverTryingDownstream
=
vgSz
;
pTask
->
checkReqIds
=
taosArrayInit
(
vgSz
,
sizeof
(
int64_t
));
int32_t
numOfVgs
=
taosArrayGetSize
(
vgInfo
);
pTask
->
recoverTryingDownstream
=
numOfVgs
;
pTask
->
checkReqIds
=
taosArrayInit
(
numOfVgs
,
sizeof
(
int64_t
));
for
(
int32_t
i
=
0
;
i
<
vgSz
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
numOfVgs
;
i
++
)
{
SVgroupInfo
*
pVgInfo
=
taosArrayGet
(
vgInfo
,
i
);
req
.
reqId
=
tGenIdPI64
();
taosArrayPush
(
pTask
->
checkReqIds
,
&
req
.
reqId
);
req
.
downstreamNodeId
=
pVgInfo
->
vgId
;
req
.
downstreamTaskId
=
pVgInfo
->
taskId
;
qDebug
(
"s-task:%s at node %d check downstream task
%d at node %d (shuffle)"
,
pTask
->
id
.
idStr
,
pTask
->
nodeId
,
qDebug
(
"s-task:%s at node %d check downstream task
:
%d at node %d (shuffle)"
,
pTask
->
id
.
idStr
,
pTask
->
nodeId
,
req
.
downstreamTaskId
,
req
.
downstreamNodeId
);
streamDispatchCheckMsg
(
pTask
,
&
req
,
pVgInfo
->
vgId
,
&
pVgInfo
->
epSet
);
}
...
...
@@ -161,7 +162,7 @@ int32_t streamProcessTaskCheckRsp(SStreamTask* pTask, const SStreamTaskCheckRsp*
taosArrayDestroy
(
pTask
->
checkReqIds
);
pTask
->
checkReqIds
=
NULL
;
qDebug
(
"s-task:%s all
downstream tasks:%d
are ready, now enter into recover stage"
,
pTask
->
id
.
idStr
,
numOfReqs
);
qDebug
(
"s-task:%s all
%d downstream tasks
are ready, now enter into recover stage"
,
pTask
->
id
.
idStr
,
numOfReqs
);
streamTaskLaunchRecover
(
pTask
,
version
);
}
}
else
if
(
pTask
->
outputType
==
TASK_OUTPUT__FIXED_DISPATCH
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录