Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
480de34a
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
480de34a
编写于
7月 13, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: support alter debugflag in dnode
上级
ba8d02e6
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
81 addition
and
15 deletion
+81
-15
source/common/src/tglobal.c
source/common/src/tglobal.c
+34
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+45
-13
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+2
-2
未找到文件。
source/common/src/tglobal.c
浏览文件 @
480de34a
...
...
@@ -1117,10 +1117,44 @@ void taosCfgDynamicOptions(const char *option, const char *value) {
if
(
strncasecmp
(
option
,
"debugFlag"
,
9
)
==
0
)
{
int32_t
flag
=
atoi
(
value
);
taosSetAllDebugFlag
(
flag
);
return
;
}
if
(
strcasecmp
(
option
,
"resetlog"
)
==
0
)
{
taosResetLog
();
cfgDumpCfg
(
tsCfg
,
0
,
false
);
return
;
}
if
(
strcasecmp
(
option
,
"monitor"
)
==
0
)
{
int32_t
monitor
=
atoi
(
value
);
uInfo
(
"monitor set from %d to %d"
,
tsEnableMonitor
,
monitor
);
tsEnableMonitor
=
monitor
;
return
;
}
const
char
*
options
[]
=
{
"dDebugFlag"
,
"vDebugFlag"
,
"mDebugFlag"
,
"wDebugFlag"
,
"sDebugFlag"
,
"tsdbDebugFlag"
,
"tqDebugFlag"
,
"fsDebugFlag"
,
"udfDebugFlag"
,
"smaDebugFlag"
,
"idxDebugFlag"
,
"tmrDebugFlag"
,
"uDebugFlag"
,
"smaDebugFlag"
,
"rpcDebugFlag"
,
"qDebugFlag"
,
};
int32_t
*
optionVars
[]
=
{
&
dDebugFlag
,
&
vDebugFlag
,
&
mDebugFlag
,
&
wDebugFlag
,
&
sDebugFlag
,
&
tsdbDebugFlag
,
&
tqDebugFlag
,
&
fsDebugFlag
,
&
udfDebugFlag
,
&
smaDebugFlag
,
&
idxDebugFlag
,
&
tmrDebugFlag
,
&
uDebugFlag
,
&
smaDebugFlag
,
&
rpcDebugFlag
,
&
qDebugFlag
,
};
int32_t
optionSize
=
tListLen
(
options
);
for
(
int32_t
d
=
0
;
d
<
optionSize
;
++
d
)
{
const
char
*
optName
=
options
[
d
];
int32_t
optLen
=
strlen
(
optName
);
if
(
strncasecmp
(
option
,
optName
,
optLen
)
!=
0
)
continue
;
int32_t
flag
=
atoi
(
value
);
uInfo
(
"%s set from %d to %d"
,
optName
,
*
optionVars
[
d
],
flag
);
*
optionVars
[
d
]
=
flag
;
return
;
}
uError
(
"failed to cfg dynamic option:%s value:%s"
,
option
,
value
);
}
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
480de34a
...
...
@@ -782,6 +782,12 @@ _OVER:
static
int32_t
mndProcessConfigDnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
const
char
*
options
[]
=
{
"debugFlag"
,
"dDebugFlag"
,
"vDebugFlag"
,
"mDebugFlag"
,
"wDebugFlag"
,
"sDebugFlag"
,
"tsdbDebugFlag"
,
"tqDebugFlag"
,
"fsDebugFlag"
,
"udfDebugFlag"
,
"smaDebugFlag"
,
"idxDebugFlag"
,
"tmrDebugFlag"
,
"uDebugFlag"
,
"smaDebugFlag"
,
"rpcDebugFlag"
,
"qDebugFlag"
,
};
int32_t
optionSize
=
tListLen
(
options
);
SMCfgDnodeReq
cfgReq
=
{
0
};
if
(
tDeserializeSMCfgDnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
cfgReq
)
!=
0
)
{
...
...
@@ -802,28 +808,53 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
SEpSet
epSet
=
mndGetDnodeEpset
(
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
SDCfgDnodeReq
dcfgReq
=
{
0
};
if
(
strncasecmp
(
cfgReq
.
config
,
"debugFlag"
,
9
)
==
0
)
{
if
(
strcasecmp
(
cfgReq
.
config
,
"resetlog"
)
==
0
)
{
strcpy
(
dcfgReq
.
config
,
"resetlog"
);
}
else
if
(
strncasecmp
(
cfgReq
.
config
,
"monitor"
,
7
)
==
0
)
{
const
char
*
value
=
cfgReq
.
value
;
int32_t
flag
=
atoi
(
value
);
if
(
flag
<=
0
)
{
flag
=
atoi
(
cfgReq
.
config
+
10
);
flag
=
atoi
(
cfgReq
.
config
+
8
);
}
if
(
flag
<
=
0
||
flag
>
255
)
{
mError
(
"dnode:%d, failed to config
debugFlag
since value:%d"
,
cfgReq
.
dnodeId
,
flag
);
if
(
flag
<
0
||
flag
>
2
)
{
mError
(
"dnode:%d, failed to config
monitor
since value:%d"
,
cfgReq
.
dnodeId
,
flag
);
terrno
=
TSDB_CODE_INVALID_CFG
;
return
-
1
;
}
strcpy
(
dcfgReq
.
config
,
"
debugFlag
"
);
strcpy
(
dcfgReq
.
config
,
"
monitor
"
);
snprintf
(
dcfgReq
.
value
,
TSDB_DNODE_VALUE_LEN
,
"%d"
,
flag
);
}
else
if
(
strcasecmp
(
cfgReq
.
config
,
"resetlog"
)
==
0
)
{
strcpy
(
dcfgReq
.
config
,
"resetlog"
);
}
else
{
bool
findOpt
=
false
;
for
(
int32_t
d
=
0
;
d
<
optionSize
;
++
d
)
{
const
char
*
optName
=
options
[
d
];
int32_t
optLen
=
strlen
(
optName
);
if
(
strncasecmp
(
cfgReq
.
config
,
optName
,
optLen
)
!=
0
)
continue
;
const
char
*
value
=
cfgReq
.
value
;
int32_t
flag
=
atoi
(
value
);
if
(
flag
<=
0
)
{
flag
=
atoi
(
cfgReq
.
config
+
optLen
+
1
);
}
if
(
flag
<=
0
||
flag
>
255
)
{
mError
(
"dnode:%d, failed to config %s since value:%d"
,
cfgReq
.
dnodeId
,
optName
,
flag
);
terrno
=
TSDB_CODE_INVALID_CFG
;
return
-
1
;
}
tstrncpy
(
dcfgReq
.
config
,
optName
,
optLen
+
1
);
snprintf
(
dcfgReq
.
value
,
TSDB_DNODE_VALUE_LEN
,
"%d"
,
flag
);
findOpt
=
true
;
}
if
(
!
findOpt
)
{
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
);
...
...
@@ -831,13 +862,14 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
if
(
pBuf
==
NULL
)
return
-
1
;
tSerializeSDCfgDnodeReq
(
pBuf
,
bufLen
,
&
dcfgReq
);
mDebug
(
"dnode:%d, send config req to dnode, app:%p"
,
cfgReq
.
dnodeId
,
pReq
->
info
.
ahandle
);
mInfo
(
"dnode:%d, send config req to dnode, app:%p config:%s value:%s"
,
cfgReq
.
dnodeId
,
pReq
->
info
.
ahandle
,
dcfgReq
.
config
,
dcfgReq
.
value
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
};
return
tmsgSendReq
(
&
epSet
,
&
rpcMsg
);
}
static
int32_t
mndProcessConfigDnodeRsp
(
SRpcMsg
*
pRsp
)
{
m
Debug
(
"config rsp from dnode, app:%p"
,
pRsp
->
info
.
ahandle
);
m
Info
(
"config rsp from dnode, app:%p"
,
pRsp
->
info
.
ahandle
);
return
0
;
}
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
480de34a
...
...
@@ -293,7 +293,7 @@ int32_t syncLeaderTransferTo(int64_t rid, SNodeInfo newLeader) {
int32_t
syncNodeLeaderTransfer
(
SSyncNode
*
pSyncNode
)
{
if
(
pSyncNode
->
peersNum
==
0
)
{
s
Error
(
"only one replica, cannot leader transfer"
);
s
Debug
(
"only one replica, cannot leader transfer"
);
terrno
=
TSDB_CODE_SYN_ONE_REPLICA
;
return
-
1
;
}
...
...
@@ -307,7 +307,7 @@ int32_t syncNodeLeaderTransferTo(SSyncNode* pSyncNode, SNodeInfo newLeader) {
int32_t
ret
=
0
;
if
(
pSyncNode
->
replicaNum
==
1
)
{
s
Error
(
"only one replica, cannot leader transfer"
);
s
Debug
(
"only one replica, cannot leader transfer"
);
terrno
=
TSDB_CODE_SYN_ONE_REPLICA
;
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录