Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3e335478
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
3e335478
编写于
11月 07, 2022
作者:
D
dapan1121
提交者:
GitHub
11月 07, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17930 from taosdata/enh/showWrite
enh: support grant check in vnode query
上级
9d830206
5ab6166e
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
21 addition
and
23 deletion
+21
-23
include/common/tmsg.h
include/common/tmsg.h
+1
-5
include/libs/qcom/query.h
include/libs/qcom/query.h
+4
-0
include/libs/qworker/qworker.h
include/libs/qworker/qworker.h
+1
-1
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+3
-10
source/dnode/mnode/impl/src/mndQuery.c
source/dnode/mnode/impl/src/mndQuery.c
+1
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+0
-1
source/dnode/qnode/src/qnode.c
source/dnode/qnode/src/qnode.c
+1
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+1
-1
source/libs/qworker/src/qwMsg.c
source/libs/qworker/src/qwMsg.c
+8
-1
source/libs/scheduler/src/schRemote.c
source/libs/scheduler/src/schRemote.c
+1
-1
source/libs/sync/src/syncRaftEntry.c
source/libs/sync/src/syncRaftEntry.c
+0
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
3e335478
...
...
@@ -216,14 +216,9 @@ typedef struct SEp {
uint16_t
port
;
}
SEp
;
#define SHOW_REWRITE_MASK() (1 << 0)
#define TEST_SHOW_REWRITE_MASK(m) (((m) & SHOW_REWRITE_MASK()) != 0)
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
int32_t
msgMask
;
}
SMsgHead
;
// Submit message for one table
...
...
@@ -1616,6 +1611,7 @@ typedef struct SSubQueryMsg {
int8_t
needFetch
;
uint32_t
sqlLen
;
// the query sql,
uint32_t
phyLen
;
int32_t
msgMask
;
char
msg
[];
}
SSubQueryMsg
;
...
...
include/libs/qcom/query.h
浏览文件 @
3e335478
...
...
@@ -57,6 +57,10 @@ typedef enum {
#define QUERY_RSP_POLICY_DELAY 0
#define QUERY_RSP_POLICY_QUICK 1
#define QUERY_MSG_MASK_SHOW_REWRITE() (1 << 0)
#define TEST_SHOW_REWRITE_MASK(m) (((m) & QUERY_MSG_MASK_SHOW_REWRITE()) != 0)
typedef
struct
STableComInfo
{
uint8_t
numOfTags
;
// the number of tags in schema
uint8_t
precision
;
// the number of precision
...
...
include/libs/qworker/qworker.h
浏览文件 @
3e335478
...
...
@@ -76,7 +76,7 @@ int32_t qWorkerInit(int8_t nodeType, int32_t nodeId, void **qWorkerMgmt, const S
int32_t
qWorkerAbortPreprocessQueryMsg
(
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
);
int32_t
qWorkerPreprocessQueryMsg
(
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
);
int32_t
qWorkerPreprocessQueryMsg
(
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
,
bool
chkGrant
);
int32_t
qWorkerProcessQueryMsg
(
void
*
node
,
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
,
int64_t
ts
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
3e335478
...
...
@@ -145,7 +145,6 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
pHead
->
contLen
=
ntohl
(
pHead
->
contLen
);
pHead
->
vgId
=
ntohl
(
pHead
->
vgId
);
pHead
->
msgMask
=
ntohl
(
pHead
->
msgMask
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
pHead
->
vgId
);
if
(
pVnode
==
NULL
)
{
...
...
@@ -156,15 +155,9 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
switch
(
qtype
)
{
case
QUERY_QUEUE
:
if
((
pMsg
->
msgType
==
TDMT_SCH_QUERY
)
&&
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
&&
!
TEST_SHOW_REWRITE_MASK
(
pHead
->
msgMask
))
{
terrno
=
TSDB_CODE_GRANT_EXPIRED
;
code
=
terrno
;
dDebug
(
"vgId:%d, msg:%p put into vnode-query queue failed since %s"
,
pVnode
->
vgId
,
pMsg
,
terrstr
(
code
));
}
else
{
vnodePreprocessQueryMsg
(
pVnode
->
pImpl
,
pMsg
);
dGTrace
(
"vgId:%d, msg:%p put into vnode-query queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
}
vnodePreprocessQueryMsg
(
pVnode
->
pImpl
,
pMsg
);
dGTrace
(
"vgId:%d, msg:%p put into vnode-query queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
break
;
case
STREAM_QUEUE
:
dGTrace
(
"vgId:%d, msg:%p put into vnode-stream queue"
,
pVnode
->
vgId
,
pMsg
);
...
...
source/dnode/mnode/impl/src/mndQuery.c
浏览文件 @
3e335478
...
...
@@ -21,7 +21,7 @@
int32_t
mndPreProcessQueryMsg
(
SRpcMsg
*
pMsg
)
{
if
(
TDMT_SCH_QUERY
!=
pMsg
->
msgType
&&
TDMT_SCH_MERGE_QUERY
!=
pMsg
->
msgType
)
return
0
;
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
return
qWorkerPreprocessQueryMsg
(
pMnode
->
pQuery
,
pMsg
);
return
qWorkerPreprocessQueryMsg
(
pMnode
->
pQuery
,
pMsg
,
false
);
}
void
mndPostProcessQueryMsg
(
SRpcMsg
*
pMsg
)
{
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
3e335478
...
...
@@ -519,7 +519,6 @@ static void *mndBuildVDropStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb,
pHead
->
contLen
=
htonl
(
contLen
);
pHead
->
vgId
=
htonl
(
pVgroup
->
vgId
);
pHead
->
msgMask
=
htonl
(
0
);
void
*
pBuf
=
POINTER_SHIFT
(
pHead
,
sizeof
(
SMsgHead
));
...
...
source/dnode/qnode/src/qnode.c
浏览文件 @
3e335478
...
...
@@ -69,7 +69,7 @@ int32_t qndPreprocessQueryMsg(SQnode *pQnode, SRpcMsg *pMsg) {
return
0
;
}
return
qWorkerPreprocessQueryMsg
(
pQnode
->
pQuery
,
pMsg
);
return
qWorkerPreprocessQueryMsg
(
pQnode
->
pQuery
,
pMsg
,
false
);
}
int32_t
qndProcessQueryMsg
(
SQnode
*
pQnode
,
int64_t
ts
,
SRpcMsg
*
pMsg
)
{
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
3e335478
...
...
@@ -329,7 +329,7 @@ int32_t vnodePreprocessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) {
return
0
;
}
return
qWorkerPreprocessQueryMsg
(
pVnode
->
pQuery
,
pMsg
);
return
qWorkerPreprocessQueryMsg
(
pVnode
->
pQuery
,
pMsg
,
TDMT_SCH_QUERY
==
pMsg
->
msgType
);
}
int32_t
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
...
...
source/libs/qworker/src/qwMsg.c
浏览文件 @
3e335478
...
...
@@ -8,6 +8,7 @@
#include "tcommon.h"
#include "tmsg.h"
#include "tname.h"
#include "tgrant.h"
int32_t
qwMallocFetchRsp
(
int8_t
rpcMalloc
,
int32_t
length
,
SRetrieveTableRsp
**
rsp
)
{
int32_t
msgSize
=
sizeof
(
SRetrieveTableRsp
)
+
length
;
...
...
@@ -305,7 +306,7 @@ int32_t qwRegisterHbBrokenLinkArg(SQWorker *mgmt, uint64_t sId, SRpcHandleInfo *
return
TSDB_CODE_SUCCESS
;
}
int32_t
qWorkerPreprocessQueryMsg
(
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
qWorkerPreprocessQueryMsg
(
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
,
bool
chkGrant
)
{
if
(
NULL
==
qWorkerMgmt
||
NULL
==
pMsg
)
{
QW_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
...
...
@@ -326,6 +327,12 @@ int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) {
msg
->
execId
=
ntohl
(
msg
->
execId
);
msg
->
phyLen
=
ntohl
(
msg
->
phyLen
);
msg
->
sqlLen
=
ntohl
(
msg
->
sqlLen
);
msg
->
msgMask
=
ntohl
(
msg
->
msgMask
);
if
(
chkGrant
&&
(
!
TEST_SHOW_REWRITE_MASK
(
msg
->
msgMask
))
&&
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
))
{
QW_ELOG
(
"query failed cause of grant expired, msgMask:%d"
,
msg
->
msgMask
);
QW_ERR_RET
(
TSDB_CODE_GRANT_EXPIRED
);
}
uint64_t
sId
=
msg
->
sId
;
uint64_t
qId
=
msg
->
queryId
;
...
...
source/libs/scheduler/src/schRemote.c
浏览文件 @
3e335478
...
...
@@ -1047,7 +1047,6 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
SSubQueryMsg
*
pMsg
=
msg
;
pMsg
->
header
.
vgId
=
htonl
(
addr
->
nodeId
);
pMsg
->
header
.
msgMask
=
htonl
((
pTask
->
plan
->
showRewrite
)
?
SHOW_REWRITE_MASK
()
:
0
);
pMsg
->
sId
=
htobe64
(
schMgmt
.
sId
);
pMsg
->
queryId
=
htobe64
(
pJob
->
queryId
);
pMsg
->
taskId
=
htobe64
(
pTask
->
taskId
);
...
...
@@ -1058,6 +1057,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
pMsg
->
needFetch
=
SCH_TASK_NEED_FETCH
(
pTask
);
pMsg
->
phyLen
=
htonl
(
pTask
->
msgLen
);
pMsg
->
sqlLen
=
htonl
(
len
);
pMsg
->
msgMask
=
htonl
((
pTask
->
plan
->
showRewrite
)
?
QUERY_MSG_MASK_SHOW_REWRITE
()
:
0
);
memcpy
(
pMsg
->
msg
,
pJob
->
sql
,
len
);
memcpy
(
pMsg
->
msg
+
len
,
pTask
->
msg
,
pTask
->
msgLen
);
...
...
source/libs/sync/src/syncRaftEntry.c
浏览文件 @
3e335478
...
...
@@ -72,7 +72,6 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId)
SMsgHead
head
;
head
.
vgId
=
vgId
;
head
.
contLen
=
sizeof
(
SMsgHead
);
head
.
msgMask
=
0
;
SRpcMsg
rpcMsg
;
memset
(
&
rpcMsg
,
0
,
sizeof
(
SRpcMsg
));
rpcMsg
.
contLen
=
head
.
contLen
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录