Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0811e5fc
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
0811e5fc
编写于
6月 23, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: make config dnode work
上级
147a984c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
69 addition
and
18 deletion
+69
-18
include/common/tmsg.h
include/common/tmsg.h
+9
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+0
-5
source/common/src/tmsg.c
source/common/src/tmsg.c
+27
-0
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+1
-1
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+32
-11
未找到文件。
include/common/tmsg.h
浏览文件 @
0811e5fc
...
...
@@ -1346,11 +1346,19 @@ typedef struct {
int32_t
dnodeId
;
char
config
[
TSDB_DNODE_CONFIG_LEN
];
char
value
[
TSDB_DNODE_VALUE_LEN
];
}
SMCfgDnodeReq
,
SDCfgDnodeReq
;
}
SMCfgDnodeReq
;
int32_t
tSerializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
int32_t
tDeserializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
typedef
struct
{
char
config
[
TSDB_DNODE_CONFIG_LEN
];
char
value
[
TSDB_DNODE_VALUE_LEN
];
}
SDCfgDnodeReq
;
int32_t
tSerializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
);
int32_t
tDeserializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
,
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
...
...
source/common/src/tglobal.c
浏览文件 @
0811e5fc
...
...
@@ -761,11 +761,6 @@ void taosCleanupCfg() {
void
taosCfgDynamicOptions
(
const
char
*
option
,
const
char
*
value
)
{
if
(
strncasecmp
(
option
,
"debugFlag"
,
9
)
==
0
)
{
if
(
value
!=
NULL
)
{
if
(
strlen
(
option
)
>
10
)
{
value
=
option
+
10
;
}
}
int32_t
flag
=
atoi
(
value
);
taosSetAllDebugFlag
(
flag
);
}
...
...
source/common/src/tmsg.c
浏览文件 @
0811e5fc
...
...
@@ -1500,6 +1500,33 @@ int32_t tDeserializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq
return
0
;
}
int32_t
tSerializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
config
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
value
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
config
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
value
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
0811e5fc
...
...
@@ -124,7 +124,7 @@ int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
int32_t
dmProcessConfigReq
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SDCfgDnodeReq
cfgReq
=
{
0
};
if
(
tDeserializeS
M
CfgDnodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
cfgReq
)
!=
0
)
{
if
(
tDeserializeS
D
CfgDnodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
cfgReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
0811e5fc
...
...
@@ -502,20 +502,20 @@ _OVER:
}
static
int32_t
mndProcessDnodeListReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDnodeObj
*
pObj
=
NULL
;
void
*
pIter
=
NULL
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDnodeObj
*
pObj
=
NULL
;
void
*
pIter
=
NULL
;
SDnodeListRsp
rsp
=
{
0
};
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
rsp
.
dnodeList
=
taosArrayInit
(
5
,
sizeof
(
SEpSet
));
if
(
NULL
==
rsp
.
dnodeList
)
{
mError
(
"failed to alloc epSet while process dnode list req"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
...
...
@@ -554,7 +554,6 @@ _OVER:
return
code
;
}
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
...
...
@@ -732,15 +731,37 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
mError
(
"dnode:%d, failed to config since %s "
,
cfgReq
.
dnodeId
,
terrstr
());
return
-
1
;
}
SEpSet
epSet
=
mndGetDnodeEpset
(
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
int32_t
bufLen
=
tSerializeSMCfgDnodeReq
(
NULL
,
0
,
&
cfgReq
);
SDCfgDnodeReq
dcfgReq
=
{
0
};
if
(
strncasecmp
(
cfgReq
.
config
,
"debugFlag"
,
9
)
==
0
)
{
const
char
*
value
=
cfgReq
.
value
;
int32_t
flag
=
atoi
(
value
);
if
(
flag
<=
0
)
{
flag
=
atoi
(
cfgReq
.
config
+
10
);
}
if
(
flag
<=
0
||
flag
>
255
)
{
mError
(
"dnode:%d, failed to config debugFlag since value:%d"
,
cfgReq
.
dnodeId
,
flag
);
terrno
=
TSDB_CODE_INVALID_CFG
;
return
-
1
;
}
strcpy
(
dcfgReq
.
config
,
"debugFlag"
);
snprintf
(
dcfgReq
.
value
,
TSDB_DNODE_VALUE_LEN
,
"%d"
,
flag
);
}
else
if
(
strcasecmp
(
cfgReq
.
config
,
"resetlog"
)
==
0
)
{
strcpy
(
dcfgReq
.
config
,
"resetlog"
);
}
else
{
terrno
=
TSDB_CODE_INVALID_CFG
;
mError
(
"dnode:%d, failed to config since %s"
,
cfgReq
.
dnodeId
,
terrstr
());
return
-
1
;
}
int32_t
bufLen
=
tSerializeSDCfgDnodeReq
(
NULL
,
0
,
&
dcfgReq
);
void
*
pBuf
=
rpcMallocCont
(
bufLen
);
if
(
pBuf
==
NULL
)
return
-
1
;
tSerializeS
MCfgDnodeReq
(
pBuf
,
bufLen
,
&
cfgReq
);
tSerializeS
DCfgDnodeReq
(
pBuf
,
bufLen
,
&
d
cfgReq
);
mDebug
(
"dnode:%d, send config req to dnode, app:%p"
,
cfgReq
.
dnodeId
,
pReq
->
info
.
ahandle
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录