Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0ead238a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0ead238a
编写于
6月 02, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(tmq): support check col and tag modifiable
上级
dcf156ba
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
79 addition
and
29 deletion
+79
-29
source/dnode/mnode/impl/inc/mndTopic.h
source/dnode/mnode/impl/inc/mndTopic.h
+2
-0
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+50
-0
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+26
-28
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+1
-1
未找到文件。
source/dnode/mnode/impl/inc/mndTopic.h
浏览文件 @
0ead238a
...
...
@@ -37,6 +37,8 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]);
int32_t
mndSetTopicCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
);
bool
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
int64_t
suid
,
const
SArray
*
colIds
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
0ead238a
...
...
@@ -70,6 +70,56 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]) {
return
strchr
(
topic
,
'.'
)
+
1
;
}
bool
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
int64_t
suid
,
const
SArray
*
colAndTagIds
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
bool
found
=
false
;
while
(
1
)
{
SMqTopicObj
*
pTopic
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_TOPIC
,
pIter
,
(
void
**
)
&
pTopic
);
if
(
pIter
==
NULL
)
break
;
if
(
pTopic
->
subType
!=
TOPIC_SUB_TYPE__COLUMN
)
{
sdbRelease
(
pSdb
,
pTopic
);
continue
;
}
SNode
*
pAst
=
NULL
;
if
(
nodesStringToNode
(
pTopic
->
ast
,
&
pAst
)
!=
0
)
{
ASSERT
(
0
);
return
false
;
}
SHashObj
*
pColHash
=
NULL
;
SNodeList
*
pNodeList
;
nodesCollectColumns
((
SSelectStmt
*
)
pAst
,
SQL_CLAUSE_FROM
,
NULL
,
COLLECT_COL_TYPE_ALL
,
&
pNodeList
);
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pNodeList
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
if
(
pCol
->
tableId
!=
suid
)
goto
NEXT
;
if
(
pColHash
==
NULL
)
{
pColHash
=
taosHashInit
(
0
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_SMALLINT
),
false
,
HASH_NO_LOCK
);
}
if
(
pCol
->
colId
>
0
)
{
taosHashPut
(
pColHash
,
&
pCol
->
colId
,
sizeof
(
int16_t
),
NULL
,
0
);
}
}
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
colAndTagIds
);
i
++
)
{
int16_t
*
pColId
=
taosArrayGet
(
colAndTagIds
,
i
);
if
(
taosHashGet
(
pColHash
,
pColId
,
sizeof
(
int16_t
))
!=
NULL
)
{
found
=
true
;
goto
NEXT
;
}
}
NEXT:
sdbRelease
(
pSdb
,
pTopic
);
nodesDestroyNode
(
pAst
);
if
(
found
)
return
false
;
}
return
true
;
}
SSdbRaw
*
mndTopicActionEncode
(
SMqTopicObj
*
pTopic
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
0ead238a
...
...
@@ -20,6 +20,28 @@ void tqTmrRspFunc(void* param, void* tmrId) {
atomic_store_8
(
&
pHandle
->
pushHandle
.
tmrStopped
,
1
);
}
static
int32_t
tqLoopExecFromQueue
(
STQ
*
pTq
,
STqHandle
*
pHandle
,
SStreamDataSubmit
**
ppSubmit
,
SMqDataBlkRsp
*
pRsp
)
{
SStreamDataSubmit
*
pSubmit
=
*
ppSubmit
;
while
(
pSubmit
!=
NULL
)
{
ASSERT
(
pSubmit
->
ver
==
pHandle
->
pushHandle
.
processedVer
+
1
);
if
(
tqDataExec
(
pTq
,
&
pHandle
->
execHandle
,
pSubmit
->
data
,
pRsp
,
0
)
<
0
)
{
/*ASSERT(0);*/
}
// update processed
atomic_store_64
(
&
pHandle
->
pushHandle
.
processedVer
,
pSubmit
->
ver
);
streamQSetSuccess
(
&
pHandle
->
pushHandle
.
inputQ
);
streamDataSubmitRefDec
(
pSubmit
);
if
(
pRsp
->
blockNum
>
0
)
{
*
ppSubmit
=
pSubmit
;
return
0
;
}
else
{
pSubmit
=
streamQNextItem
(
&
pHandle
->
pushHandle
.
inputQ
);
}
}
*
ppSubmit
=
pSubmit
;
return
-
1
;
}
int32_t
tqExecFromInputQ
(
STQ
*
pTq
,
STqHandle
*
pHandle
)
{
SMqDataBlkRsp
rsp
=
{
0
};
// 1. guard and set status executing
...
...
@@ -42,38 +64,14 @@ int32_t tqExecFromInputQ(STQ* pTq, STqHandle* pHandle) {
}
// 3. exec, after each success, update processed ver
// first run
while
(
pSubmit
!=
NULL
)
{
ASSERT
(
pSubmit
->
ver
==
pHandle
->
pushHandle
.
processedVer
+
1
);
if
(
tqDataExec
(
pTq
,
&
pHandle
->
execHandle
,
pSubmit
->
data
,
&
rsp
,
0
)
<
0
)
{
/*ASSERT(0);*/
}
// update processed
atomic_store_64
(
&
pHandle
->
pushHandle
.
processedVer
,
pSubmit
->
ver
);
streamQSetSuccess
(
&
pHandle
->
pushHandle
.
inputQ
);
streamDataSubmitRefDec
(
pSubmit
);
if
(
rsp
.
blockNum
>
0
)
{
goto
SEND_RSP
;
}
else
{
pSubmit
=
streamQNextItem
(
&
pHandle
->
pushHandle
.
inputQ
);
}
if
(
tqLoopExecFromQueue
(
pTq
,
pHandle
,
&
pSubmit
,
&
rsp
)
==
0
)
{
goto
SEND_RSP
;
}
// set exec status closing
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__CLOSING
);
// second run
while
(
pSubmit
!=
NULL
)
{
ASSERT
(
pSubmit
->
ver
==
pHandle
->
pushHandle
.
processedVer
+
1
);
if
(
tqDataExec
(
pTq
,
&
pHandle
->
execHandle
,
pSubmit
->
data
,
&
rsp
,
0
)
<
0
)
{
/*ASSERT(0);*/
}
// update processed
atomic_store_64
(
&
pHandle
->
pushHandle
.
processedVer
,
pSubmit
->
ver
);
streamQSetSuccess
(
&
pHandle
->
pushHandle
.
inputQ
);
streamDataSubmitRefDec
(
pSubmit
);
if
(
rsp
.
blockNum
>
0
)
{
goto
SEND_RSP
;
}
else
{
pSubmit
=
streamQNextItem
(
&
pHandle
->
pushHandle
.
inputQ
);
}
if
(
tqLoopExecFromQueue
(
pTq
,
pHandle
,
&
pSubmit
,
&
rsp
)
==
0
)
{
goto
SEND_RSP
;
}
// set exec status idle
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__IDLE
);
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
0ead238a
...
...
@@ -19,7 +19,7 @@
#include "walInt.h"
void
walRestoreFromSnapshot
(
SWal
*
pWal
,
int64_t
ver
)
{
pWal
->
vers
.
firstVer
=
-
1
;
/*pWal->vers.firstVer = -1;*/
pWal
->
vers
.
lastVer
=
ver
;
pWal
->
vers
.
commitVer
=
ver
-
1
;
pWal
->
vers
.
snapshotVer
=
ver
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录