Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Rattenking
TDengine
提交
dffef1f1
T
TDengine
项目概览
Rattenking
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
dffef1f1
编写于
7月 16, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
7月 16, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2688 from taosdata/feature/vnode
Feature/vnode
上级
1e1cbd2e
86838afa
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
56 addition
and
24 deletion
+56
-24
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+16
-13
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+1
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+3
-2
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+27
-7
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+9
-2
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
dffef1f1
...
...
@@ -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/dnode/src/dnodeMgmt.c
浏览文件 @
dffef1f1
...
...
@@ -706,6 +706,7 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
// fill cluster cfg parameters
pStatus
->
clusterCfg
.
numOfMnodes
=
htonl
(
tsNumOfMnodes
);
pStatus
->
clusterCfg
.
enableBalance
=
htonl
(
tsEnableBalance
);
pStatus
->
clusterCfg
.
mnodeEqualVnodeNum
=
htonl
(
tsMnodeEqualVnodeNum
);
pStatus
->
clusterCfg
.
offlineThreshold
=
htonl
(
tsOfflineThreshold
);
pStatus
->
clusterCfg
.
statusInterval
=
htonl
(
tsStatusInterval
);
...
...
src/inc/taosmsg.h
浏览文件 @
dffef1f1
...
...
@@ -563,15 +563,16 @@ typedef struct {
typedef
struct
{
int32_t
numOfMnodes
;
// tsNumOfMnodes
int32_t
enableBalance
;
// tsEnableBalance
int32_t
mnodeEqualVnodeNum
;
// tsMnodeEqualVnodeNum
int32_t
offlineThreshold
;
// tsOfflineThreshold
int32_t
statusInterval
;
// tsStatusInterval
int32_t
maxtablesPerVnode
;
int32_t
maxVgroupsPerDb
;
char
arbitrator
[
TSDB_EP_LEN
];
// tsArbitrator
char
timezone
[
64
];
// tsTimezone
char
locale
[
TSDB_LOCALE_LEN
];
// tsLocale
char
charset
[
TSDB_LOCALE_LEN
];
// tsCharset
int32_t
maxtablesPerVnode
;
int32_t
maxVgroupsPerDb
;
}
SClusterCfg
;
typedef
struct
{
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
dffef1f1
...
...
@@ -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
;
}
...
...
@@ -305,6 +324,7 @@ static void mnodeProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) {
static
bool
mnodeCheckClusterCfgPara
(
const
SClusterCfg
*
clusterCfg
)
{
if
(
clusterCfg
->
numOfMnodes
!=
htonl
(
tsNumOfMnodes
))
return
false
;
if
(
clusterCfg
->
enableBalance
!=
htonl
(
tsEnableBalance
))
return
false
;
if
(
clusterCfg
->
mnodeEqualVnodeNum
!=
htonl
(
tsMnodeEqualVnodeNum
))
return
false
;
if
(
clusterCfg
->
offlineThreshold
!=
htonl
(
tsOfflineThreshold
))
return
false
;
if
(
clusterCfg
->
statusInterval
!=
htonl
(
tsStatusInterval
))
return
false
;
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
dffef1f1
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录