Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
26fae13c
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
26fae13c
编写于
10月 11, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(stream): state/session map id to tbname
上级
fbfae317
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
83 addition
and
9 deletion
+83
-9
source/dnode/mnode/impl/src/mndDef.c
source/dnode/mnode/impl/src/mndDef.c
+5
-1
source/dnode/vnode/src/tq/tqMeta.c
source/dnode/vnode/src/tq/tqMeta.c
+1
-0
source/dnode/vnode/src/tq/tqOffsetSnapshot.c
source/dnode/vnode/src/tq/tqOffsetSnapshot.c
+1
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+6
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+40
-0
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+28
-6
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+2
-1
未找到文件。
source/dnode/mnode/impl/src/mndDef.c
浏览文件 @
26fae13c
...
...
@@ -117,9 +117,13 @@ int32_t tDecodeSStreamObj(SDecoder *pDecoder, SStreamObj *pObj) {
SArray
*
pArray
=
taosArrayInit
(
innerSz
,
sizeof
(
void
*
));
for
(
int32_t
j
=
0
;
j
<
innerSz
;
j
++
)
{
SStreamTask
*
pTask
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamTask
));
if
(
pTask
==
NULL
)
return
-
1
;
if
(
pTask
==
NULL
)
{
taosArrayDestroy
(
pArray
);
return
-
1
;
}
if
(
tDecodeSStreamTask
(
pDecoder
,
pTask
)
<
0
)
{
taosMemoryFree
(
pTask
);
taosArrayDestroy
(
pArray
);
return
-
1
;
}
taosArrayPush
(
pArray
,
&
pTask
);
...
...
source/dnode/vnode/src/tq/tqMeta.c
浏览文件 @
26fae13c
...
...
@@ -180,6 +180,7 @@ int32_t tqMetaRestoreCheckInfo(STQ* pTq) {
return
-
1
;
}
}
tdbFree
(
pKey
);
tdbTbcClose
(
pCur
);
return
0
;
}
...
...
source/dnode/vnode/src/tq/tqOffsetSnapshot.c
浏览文件 @
26fae13c
...
...
@@ -54,7 +54,7 @@ int32_t tqOffsetSnapRead(STqOffsetReader* pReader, uint8_t** ppData) {
char
*
fname
=
tqOffsetBuildFName
(
pReader
->
pTq
->
path
,
0
);
TdFilePtr
pFile
=
taosOpenFile
(
fname
,
TD_FILE_READ
);
if
(
pFile
!
=
NULL
)
{
if
(
pFile
=
=
NULL
)
{
taosMemoryFree
(
fname
);
return
0
;
}
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
26fae13c
...
...
@@ -767,6 +767,7 @@ typedef struct SStreamSessionAggOperatorInfo {
SPhysiNode
*
pPhyNode
;
// create new child
bool
isFinal
;
bool
ignoreExpiredData
;
SHashObj
*
pGroupIdTbNameMap
;
}
SStreamSessionAggOperatorInfo
;
typedef
struct
SStreamPartitionOperatorInfo
{
...
...
@@ -844,6 +845,7 @@ typedef struct SStreamStateAggOperatorInfo {
void
*
pDelIterator
;
SArray
*
pChildren
;
// cache for children's result;
bool
ignoreExpiredData
;
SHashObj
*
pGroupIdTbNameMap
;
}
SStreamStateAggOperatorInfo
;
typedef
struct
SSortOperatorInfo
{
...
...
@@ -898,8 +900,12 @@ void destroyExprInfo(SExprInfo* pExpr, int32_t numOfExprs);
int32_t
initAggInfo
(
SExprSupp
*
pSup
,
SAggSupporter
*
pAggSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
size_t
keyBufSize
,
const
char
*
pkey
);
void
initResultSizeInfo
(
SResultInfo
*
pResultInfo
,
int32_t
numOfRows
);
void
doBuildStreamResBlock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
);
void
doBuildResultDatablock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
);
int32_t
handleLimitOffset
(
SOperatorInfo
*
pOperator
,
SLimitInfo
*
pLimitInfo
,
SSDataBlock
*
pBlock
,
bool
holdDataInBuf
);
bool
hasLimitOffsetInfo
(
SLimitInfo
*
pLimitInfo
);
void
initLimitInfo
(
const
SNode
*
pLimit
,
const
SNode
*
pSLimit
,
SLimitInfo
*
pLimitInfo
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
26fae13c
...
...
@@ -1389,6 +1389,46 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS
return
0
;
}
void
doBuildStreamResBlock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
)
{
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SSDataBlock
*
pBlock
=
pbInfo
->
pRes
;
// set output datablock version
pBlock
->
info
.
version
=
pTaskInfo
->
version
;
blockDataCleanup
(
pBlock
);
if
(
!
hasRemainResults
(
pGroupResInfo
))
{
return
;
}
// clear the existed group id
pBlock
->
info
.
groupId
=
0
;
ASSERT
(
!
pbInfo
->
mergeResultBlock
);
doCopyToSDataBlock
(
pTaskInfo
,
pBlock
,
&
pOperator
->
exprSupp
,
pBuf
,
pGroupResInfo
);
if
(
pOperator
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE
)
{
SStreamStateAggOperatorInfo
*
pInfo
=
pOperator
->
info
;
char
*
tbname
=
taosHashGet
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
));
if
(
tbname
!=
NULL
)
{
memcpy
(
pBlock
->
info
.
parTbName
,
tbname
,
TSDB_TABLE_NAME_LEN
);
}
else
{
pBlock
->
info
.
parTbName
[
0
]
=
0
;
}
}
else
if
(
pOperator
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION
||
pOperator
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_SESSION
||
pOperator
->
operatorType
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_SESSION
)
{
SStreamSessionAggOperatorInfo
*
pInfo
=
pOperator
->
info
;
char
*
tbname
=
taosHashGet
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
));
if
(
tbname
!=
NULL
)
{
memcpy
(
pBlock
->
info
.
parTbName
,
tbname
,
TSDB_TABLE_NAME_LEN
);
}
else
{
pBlock
->
info
.
parTbName
[
0
]
=
0
;
}
}
}
void
doBuildResultDatablock
(
SOperatorInfo
*
pOperator
,
SOptrBasicInfo
*
pbInfo
,
SGroupResInfo
*
pGroupResInfo
,
SDiskbasedBuf
*
pBuf
)
{
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
26fae13c
...
...
@@ -3712,6 +3712,9 @@ SOperatorInfo* createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPh
pInfo
->
pPhyNode
=
pPhyNode
;
pInfo
->
ignoreExpiredData
=
pSessionNode
->
window
.
igExpired
;
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
pOperator
->
name
=
"StreamSessionWindowAggOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION
;
pOperator
->
blocking
=
true
;
...
...
@@ -4335,7 +4338,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
printDataBlock
(
pInfo
->
pDelRes
,
IS_FINAL_OP
(
pInfo
)
?
"final session"
:
"single session"
);
return
pInfo
->
pDelRes
;
}
doBuild
ResultDatab
lock
(
pOperator
,
pBInfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
doBuild
StreamResB
lock
(
pOperator
,
pBInfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainResults
(
&
pInfo
->
groupResInfo
))
{
doSetOperatorCompleted
(
pOperator
);
}
...
...
@@ -4354,6 +4357,12 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
}
printDataBlock
(
pBlock
,
IS_FINAL_OP
(
pInfo
)
?
"final session recv"
:
"single session recv"
);
if
(
pBlock
->
info
.
parTbName
[
0
])
{
taosHashPut
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
),
&
pBlock
->
info
.
parTbName
,
TSDB_TABLE_NAME_LEN
);
/*printf("\n\n put tbname %s\n\n", pBlock->info.parTbName);*/
}
if
(
pBlock
->
info
.
type
==
STREAM_CLEAR
)
{
SArray
*
pWins
=
taosArrayInit
(
16
,
sizeof
(
SResultWindowInfo
));
doClearSessionWindows
(
&
pInfo
->
streamAggSup
,
&
pOperator
->
exprSupp
,
pBlock
,
START_TS_COLUMN_INDEX
,
...
...
@@ -4435,7 +4444,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) {
printDataBlock
(
pInfo
->
pDelRes
,
IS_FINAL_OP
(
pInfo
)
?
"final session"
:
"single session"
);
return
pInfo
->
pDelRes
;
}
doBuild
ResultDatab
lock
(
pOperator
,
&
pInfo
->
binfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
doBuild
StreamResB
lock
(
pOperator
,
&
pInfo
->
binfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
printDataBlock
(
pBInfo
->
pRes
,
IS_FINAL_OP
(
pInfo
)
?
"final session"
:
"single session"
);
return
pBInfo
->
pRes
->
info
.
rows
==
0
?
NULL
:
pBInfo
->
pRes
;
}
...
...
@@ -4466,7 +4475,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
}
{
doBuild
ResultDatab
lock
(
pOperator
,
pBInfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
doBuild
StreamResB
lock
(
pOperator
,
pBInfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
if
(
pBInfo
->
pRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pBInfo
->
pRes
,
"semi session"
);
return
pBInfo
->
pRes
;
...
...
@@ -4507,6 +4516,12 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
}
printDataBlock
(
pBlock
,
"semi session recv"
);
if
(
pBlock
->
info
.
parTbName
[
0
])
{
taosHashPut
(
pInfo
->
pGroupIdTbNameMap
,
&
pBlock
->
info
.
groupId
,
sizeof
(
int64_t
),
&
pBlock
->
info
.
parTbName
,
TSDB_TABLE_NAME_LEN
);
/*printf("\n\n put tbname %s\n\n", pBlock->info.parTbName);*/
}
if
(
pBlock
->
info
.
type
==
STREAM_CLEAR
)
{
SArray
*
pWins
=
taosArrayInit
(
16
,
sizeof
(
SResultWindowInfo
));
doClearSessionWindows
(
&
pInfo
->
streamAggSup
,
pSup
,
pBlock
,
START_TS_COLUMN_INDEX
,
pSup
->
numOfExprs
,
0
,
pWins
);
...
...
@@ -4550,7 +4565,7 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) {
initMultiResInfoFromArrayList
(
&
pInfo
->
groupResInfo
,
pUpdated
);
blockDataEnsureCapacity
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
doBuild
ResultDatab
lock
(
pOperator
,
pBInfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
doBuild
StreamResB
lock
(
pOperator
,
pBInfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
if
(
pBInfo
->
pRes
->
info
.
rows
>
0
)
{
printDataBlock
(
pBInfo
->
pRes
,
"semi session"
);
return
pBInfo
->
pRes
;
...
...
@@ -4594,6 +4609,10 @@ SOperatorInfo* createStreamFinalSessionAggOperatorInfo(SOperatorInfo* downstream
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamSessionSemiAgg
,
NULL
,
NULL
,
destroyStreamSessionAggOperatorInfo
,
aggEncodeResultRow
,
aggDecodeResultRow
,
NULL
);
}
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
pOperator
->
operatorType
=
pPhyNode
->
type
;
if
(
numOfChild
>
0
)
{
pInfo
->
pChildren
=
taosArrayInit
(
numOfChild
,
sizeof
(
void
*
));
...
...
@@ -4894,7 +4913,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
printDataBlock
(
pInfo
->
pDelRes
,
"single state"
);
return
pInfo
->
pDelRes
;
}
doBuild
ResultDatab
lock
(
pOperator
,
pBInfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
doBuild
StreamResB
lock
(
pOperator
,
pBInfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainResults
(
&
pInfo
->
groupResInfo
))
{
doSetOperatorCompleted
(
pOperator
);
}
...
...
@@ -4956,7 +4975,7 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) {
printDataBlock
(
pInfo
->
pDelRes
,
"single state"
);
return
pInfo
->
pDelRes
;
}
doBuild
ResultDatab
lock
(
pOperator
,
&
pInfo
->
binfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
doBuild
StreamResB
lock
(
pOperator
,
&
pInfo
->
binfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
streamAggSup
.
pResultBuf
);
printDataBlock
(
pBInfo
->
pRes
,
"single state"
);
return
pBInfo
->
pRes
->
info
.
rows
==
0
?
NULL
:
pBInfo
->
pRes
;
}
...
...
@@ -5029,6 +5048,9 @@ SOperatorInfo* createStreamStateAggOperatorInfo(SOperatorInfo* downstream, SPhys
pInfo
->
pChildren
=
NULL
;
pInfo
->
ignoreExpiredData
=
pStateNode
->
window
.
igExpired
;
pInfo
->
pGroupIdTbNameMap
=
taosHashInit
(
1024
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
false
,
HASH_NO_LOCK
);
pOperator
->
name
=
"StreamStateAggOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_STREAM_STATE
;
pOperator
->
blocking
=
true
;
...
...
source/libs/wal/src/walMeta.c
浏览文件 @
26fae13c
...
...
@@ -150,7 +150,6 @@ int walCheckAndRepairMeta(SWal* pWal) {
const
char
*
idxPattern
=
"^[0-9]+.idx$"
;
regex_t
logRegPattern
;
regex_t
idxRegPattern
;
SArray
*
actualLog
=
taosArrayInit
(
8
,
sizeof
(
SWalFileInfo
));
regcomp
(
&
logRegPattern
,
logPattern
,
REG_EXTENDED
);
regcomp
(
&
idxRegPattern
,
idxPattern
,
REG_EXTENDED
);
...
...
@@ -163,6 +162,8 @@ int walCheckAndRepairMeta(SWal* pWal) {
return
-
1
;
}
SArray
*
actualLog
=
taosArrayInit
(
8
,
sizeof
(
SWalFileInfo
));
// scan log files and build new meta
TdDirEntryPtr
pDirEntry
;
while
((
pDirEntry
=
taosReadDir
(
pDir
))
!=
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录