Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
86838afa
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
86838afa
编写于
7月 16, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-933] make alter dnode msg more easy to use
上级
4282dc41
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
22 deletion
+51
-22
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+16
-13
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+26
-7
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+9
-2
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
86838afa
...
...
@@ -4642,21 +4642,24 @@ typedef struct SDNodeDynConfOption {
}
SDNodeDynConfOption
;
int32_t
validateEp
(
char
*
ep
)
{
int32_t
validateEp
(
char
*
ep
)
{
char
buf
[
TSDB_EP_LEN
+
1
]
=
{
0
};
tstrncpy
(
buf
,
ep
,
TSDB_EP_LEN
);
char
*
pos
=
strchr
(
buf
,
':'
);
if
(
NULL
==
pos
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
char
*
pos
=
strchr
(
buf
,
':'
);
if
(
NULL
==
pos
)
{
int32_t
val
=
strtol
(
ep
,
NULL
,
10
);
if
(
val
<=
0
||
val
>
65536
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
else
{
uint16_t
port
=
atoi
(
pos
+
1
);
if
(
0
==
port
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
uint16_t
port
=
atoi
(
pos
+
1
);
if
(
0
==
port
)
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
validateDNodeConfig
(
tDCLSQL
*
pOptions
)
{
...
...
@@ -4664,13 +4667,13 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) {
return
TSDB_CODE_TSC_INVALID_SQL
;
}
const
int
DNODE_DYNAMIC_CFG_OPTIONS_SIZE
=
1
7
;
const
int
DNODE_DYNAMIC_CFG_OPTIONS_SIZE
=
1
9
;
const
SDNodeDynConfOption
DNODE_DYNAMIC_CFG_OPTIONS
[]
=
{
{
"resetLog"
,
8
},
{
"resetQueryCache"
,
15
},
{
"debugFlag"
,
9
},
{
"mDebugFlag"
,
10
},
{
"dDebugFlag"
,
10
},
{
"sdbDebugFlag"
,
12
},
{
"vDebugFlag"
,
10
},
{
"cDebugFlag"
,
10
},
{
"httpDebugFlag"
,
13
},
{
"monitorDebugFlag"
,
16
},
{
"rpcDebugFlag"
,
12
},
{
"uDebugFlag"
,
10
},
{
"tmrDebugFlag"
,
12
},
{
"qDebugflag"
,
10
},
{
"sDebugflag"
,
10
},
{
"tsdbDebugFlag"
,
13
},
{
"monitor"
,
7
}};
{
"m
qttDebugFlag"
,
13
},
{
"wDebugFlag"
,
10
},
{
"m
onitor"
,
7
}};
SSQLToken
*
pOptionToken
=
&
pOptions
->
a
[
1
];
...
...
@@ -4694,7 +4697,7 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) {
SSQLToken
*
pValToken
=
&
pOptions
->
a
[
2
];
int32_t
val
=
strtol
(
pValToken
->
z
,
NULL
,
10
);
if
(
val
<
131
||
val
>
199
)
{
if
(
val
<
0
||
val
>
256
)
{
/* options value is out of valid range */
return
TSDB_CODE_TSC_INVALID_SQL
;
}
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
86838afa
...
...
@@ -269,18 +269,37 @@ void mnodeUpdateDnode(SDnodeObj *pDnode) {
}
static
int32_t
mnodeProcessCfgDnodeMsg
(
SMnodeMsg
*
pMsg
)
{
if
(
strcmp
(
pMsg
->
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
{
mError
(
"failed to cfg dnode, no rights"
);
return
TSDB_CODE_MND_NO_RIGHTS
;
}
SCMCfgDnodeMsg
*
pCmCfgDnode
=
pMsg
->
rpcMsg
.
pCont
;
if
(
pCmCfgDnode
->
ep
[
0
]
==
0
)
{
strcpy
(
pCmCfgDnode
->
ep
,
tsLocalEp
);
}
else
{
// TODO temporary disabled for compiling: strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep);
tstrncpy
(
pCmCfgDnode
->
ep
,
tsLocalEp
,
TSDB_EP_LEN
);
}
int32_t
dnodeId
=
0
;
char
*
pos
=
strchr
(
pCmCfgDnode
->
ep
,
':'
);
if
(
NULL
==
pos
)
{
dnodeId
=
strtol
(
pCmCfgDnode
->
ep
,
NULL
,
10
);
if
(
dnodeId
<=
0
||
dnodeId
>
65536
)
{
mError
(
"failed to cfg dnode, invalid dnodeId:%s"
,
pCmCfgDnode
->
ep
);
return
TSDB_CODE_MND_DNODE_NOT_EXIST
;
}
}
if
(
strcmp
(
pMsg
->
pUser
->
user
,
TSDB_DEFAULT_USER
)
!=
0
)
{
return
TSDB_CODE_MND_NO_RIGHTS
;
SRpcIpSet
ipSet
=
mnodeGetIpSetFromIp
(
pCmCfgDnode
->
ep
);
if
(
dnodeId
!=
0
)
{
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
dnodeId
);
if
(
pDnode
==
NULL
)
{
mError
(
"failed to cfg dnode, invalid dnodeId:%d"
,
dnodeId
);
return
TSDB_CODE_MND_DNODE_NOT_EXIST
;
}
ipSet
=
mnodeGetIpSetFromIp
(
pDnode
->
dnodeEp
);
mnodeDecDnodeRef
(
pDnode
);
}
SRpcIpSet
ipSet
=
mnodeGetIpSetFromIp
(
pCmCfgDnode
->
ep
);
SMDCfgDnodeMsg
*
pMdCfgDnode
=
rpcMallocCont
(
sizeof
(
SMDCfgDnodeMsg
));
strcpy
(
pMdCfgDnode
->
ep
,
pCmCfgDnode
->
ep
);
strcpy
(
pMdCfgDnode
->
config
,
pCmCfgDnode
->
config
);
...
...
@@ -292,9 +311,9 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
.
pCont
=
pMdCfgDnode
,
.
contLen
=
sizeof
(
SMDCfgDnodeMsg
)
};
dnodeSendMsgToDnode
(
&
ipSet
,
&
rpcMdCfgDnodeMsg
);
mInfo
(
"dnode:%s, is configured by %s"
,
pCmCfgDnode
->
ep
,
pMsg
->
pUser
->
user
);
dnodeSendMsgToDnode
(
&
ipSet
,
&
rpcMdCfgDnodeMsg
);
return
TSDB_CODE_SUCCESS
;
}
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
86838afa
...
...
@@ -593,7 +593,7 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
strcpy
(
pSchema
[
cols
].
name
,
"
maxTabl
es"
);
strcpy
(
pSchema
[
cols
].
name
,
"
onlineVnod
es"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -692,8 +692,15 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v
*
(
int32_t
*
)
pWrite
=
taosIdPoolMaxSize
(
pVgroup
->
idPool
);
cols
++
;
int32_t
onlineVnodes
=
0
;
for
(
int32_t
i
=
0
;
i
<
pShow
->
maxReplica
;
++
i
)
{
if
(
pVgroup
->
vnodeGid
[
i
].
role
==
TAOS_SYNC_ROLE_SLAVE
||
pVgroup
->
vnodeGid
[
i
].
role
==
TAOS_SYNC_ROLE_MASTER
)
{
onlineVnodes
++
;
}
}
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
tsMaxTablePerVnode
;
*
(
int32_t
*
)
pWrite
=
onlineVnodes
;
cols
++
;
for
(
int32_t
i
=
0
;
i
<
pShow
->
maxReplica
;
++
i
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录