Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7438f1fe
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看板
提交
7438f1fe
编写于
7月 14, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: read/create restrict when grant expired
上级
67a5f12a
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
58 addition
and
25 deletion
+58
-25
include/common/tcommon.h
include/common/tcommon.h
+20
-0
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+8
-3
source/dnode/mnode/impl/inc/mndGrant.h
source/dnode/mnode/impl/inc/mndGrant.h
+0
-17
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+6
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+6
-0
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+6
-0
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+2
-1
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+9
-3
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+1
-1
未找到文件。
include/common/tcommon.h
浏览文件 @
7438f1fe
...
...
@@ -282,6 +282,26 @@ typedef struct SSortExecInfo {
int32_t
readBytes
;
// read io bytes
}
SSortExecInfo
;
//======================================================================================================================
// for grant
typedef
enum
{
TSDB_GRANT_ALL
,
TSDB_GRANT_TIME
,
TSDB_GRANT_USER
,
TSDB_GRANT_DB
,
TSDB_GRANT_TIMESERIES
,
TSDB_GRANT_DNODE
,
TSDB_GRANT_ACCT
,
TSDB_GRANT_STORAGE
,
TSDB_GRANT_SPEED
,
TSDB_GRANT_QUERY_TIME
,
TSDB_GRANT_CONNS
,
TSDB_GRANT_STREAMS
,
TSDB_GRANT_CPU_CORES
,
}
EGrantType
;
int32_t
grantCheck
(
EGrantType
grant
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
7438f1fe
...
...
@@ -131,9 +131,14 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
switch
(
qtype
)
{
case
QUERY_QUEUE
:
vnodePreprocessQueryMsg
(
pVnode
->
pImpl
,
pMsg
);
dGTrace
(
"vgId:%d, msg:%p put into vnode-query queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
if
(
grantCheck
(
TSDB_GRANT_TIME
)
!=
TSDB_CODE_SUCCESS
)
{
dDebug
(
"vgId:%d, msg:%p put into vnode-query queue failed since Grant expired"
,
pVnode
->
vgId
,
pMsg
);
code
=
TSDB_CODE_GRANT_EXPIRED
;
}
else
{
vnodePreprocessQueryMsg
(
pVnode
->
pImpl
,
pMsg
);
dGTrace
(
"vgId:%d, msg:%p put into vnode-query queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
}
break
;
case
FETCH_QUEUE
:
dGTrace
(
"vgId:%d, msg:%p put into vnode-fetch queue"
,
pVnode
->
vgId
,
pMsg
);
...
...
source/dnode/mnode/impl/inc/mndGrant.h
浏览文件 @
7438f1fe
...
...
@@ -22,26 +22,9 @@
#include "mndInt.h"
typedef
enum
{
TSDB_GRANT_ALL
,
TSDB_GRANT_TIME
,
TSDB_GRANT_USER
,
TSDB_GRANT_DB
,
TSDB_GRANT_TIMESERIES
,
TSDB_GRANT_DNODE
,
TSDB_GRANT_ACCT
,
TSDB_GRANT_STORAGE
,
TSDB_GRANT_SPEED
,
TSDB_GRANT_QUERY_TIME
,
TSDB_GRANT_CONNS
,
TSDB_GRANT_STREAMS
,
TSDB_GRANT_CPU_CORES
,
}
EGrantType
;
int32_t
mndInitGrant
(
SMnode
*
pMnode
);
void
mndCleanupGrant
();
void
grantParseParameter
();
int32_t
grantCheck
(
EGrantType
grant
);
void
grantReset
(
SMnode
*
pMnode
,
EGrantType
grant
,
uint64_t
value
);
void
grantAdd
(
EGrantType
grant
,
uint64_t
value
);
void
grantRestore
(
EGrantType
grant
,
uint64_t
value
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
7438f1fe
...
...
@@ -509,6 +509,12 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
SUserObj
*
pUser
=
NULL
;
SCreateDbReq
createReq
=
{
0
};
code
=
grantCheck
(
TSDB_GRANT_DB
);
if
(
code
!=
0
)
{
terrno
=
code
;
goto
_OVER
;
}
if
(
tDeserializeSCreateDbReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
7438f1fe
...
...
@@ -621,6 +621,12 @@ static int32_t mndProcessCreateDnodeReq(SRpcMsg *pReq) {
SDnodeObj
*
pDnode
=
NULL
;
SCreateDnodeReq
createReq
=
{
0
};
code
=
grantCheck
(
TSDB_GRANT_DNODE
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
goto
_OVER
;
}
if
(
tDeserializeSCreateDnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
7438f1fe
...
...
@@ -363,6 +363,12 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
goto
_OVER
;
}
code
=
grantCheck
(
TSDB_GRANT_USER
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
goto
_OVER
;
}
code
=
mndCreateUser
(
pMnode
,
pOperUser
->
acct
,
&
createReq
,
pReq
);
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
7438f1fe
...
...
@@ -99,7 +99,8 @@ STSchema* metaGetTbTSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver);
int32_t
metaGetTbTSchemaEx
(
SMeta
*
pMeta
,
tb_uid_t
suid
,
tb_uid_t
uid
,
int32_t
sver
,
STSchema
**
ppTSchema
);
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
);
tb_uid_t
metaGetTableEntryUidByName
(
SMeta
*
pMeta
,
const
char
*
name
);
int
metaGetTbNum
(
SMeta
*
pMeta
);
int64_t
metaGetTbNum
(
SMeta
*
pMeta
);
int64_t
metaGetTimeSeriesNum
(
SMeta
*
pMeta
);
SMCtbCursor
*
metaOpenCtbCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
void
metaCloseCtbCursor
(
SMCtbCursor
*
pCtbCur
);
tb_uid_t
metaCtbCursorNext
(
SMCtbCursor
*
pCtbCur
);
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
7438f1fe
...
...
@@ -463,10 +463,16 @@ _err:
return
code
;
}
int
metaGetTbNum
(
SMeta
*
pMeta
)
{
// N.B. Called by statusReq per second
int64_t
metaGetTbNum
(
SMeta
*
pMeta
)
{
// TODO
// ASSERT(0);
return
0
;
return
100
;
}
// N.B. Called by statusReq per second
int64_t
metaGetTimeSeriesNum
(
SMeta
*
pMeta
)
{
// TODO
return
400
;
}
typedef
struct
{
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
7438f1fe
...
...
@@ -239,7 +239,7 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
pLoad
->
vgId
=
TD_VID
(
pVnode
);
pLoad
->
syncState
=
syncGetMyRole
(
pVnode
->
sync
);
pLoad
->
numOfTables
=
metaGetTbNum
(
pVnode
->
pMeta
);
pLoad
->
numOfTimeSeries
=
400
;
pLoad
->
numOfTimeSeries
=
metaGetTimeSeriesNum
(
pVnode
->
pMeta
)
;
pLoad
->
totalStorage
=
300
;
pLoad
->
compStorage
=
200
;
pLoad
->
pointsWritten
=
100
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录