Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
f52cf50c
T
TDengine
项目概览
慢慢CG
/
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看板
提交
f52cf50c
编写于
4月 25, 2021
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-3572]<enhance>: response out of dnodes if #dnodes <= maxDbReplica
上级
183e6ff0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
69 addition
and
7 deletion
+69
-7
src/mnode/inc/mnodeDb.h
src/mnode/inc/mnodeDb.h
+1
-0
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+18
-0
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+9
-0
tests/script/unique/cluster/balance2.sim
tests/script/unique/cluster/balance2.sim
+19
-4
tests/script/unique/dnode/remove1.sim
tests/script/unique/dnode/remove1.sim
+2
-2
tests/script/unique/dnode/remove2.sim
tests/script/unique/dnode/remove2.sim
+20
-1
未找到文件。
src/mnode/inc/mnodeDb.h
浏览文件 @
f52cf50c
...
...
@@ -31,6 +31,7 @@ enum _TSDB_DB_STATUS {
int32_t
mnodeInitDbs
();
void
mnodeCleanupDbs
();
int64_t
mnodeGetDbNum
();
int32_t
mnodeGetDbMaxReplica
();
SDbObj
*
mnodeGetDb
(
char
*
db
);
SDbObj
*
mnodeGetDbByTableName
(
char
*
db
);
void
*
mnodeGetNextDb
(
void
*
pIter
,
SDbObj
**
pDb
);
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
f52cf50c
...
...
@@ -74,6 +74,24 @@ int64_t mnodeGetDbNum() {
return
sdbGetNumOfRows
(
tsDbSdb
);
}
int32_t
mnodeGetDbMaxReplica
()
{
int32_t
maxReplica
=
0
;
SDbObj
*
pDb
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
pIter
=
mnodeGetNextDb
(
pIter
,
&
pDb
);
if
(
pDb
==
NULL
)
break
;
if
(
pDb
->
cfg
.
replications
>
maxReplica
)
maxReplica
=
pDb
->
cfg
.
replications
;
mnodeDecDbRef
(
pDb
);
}
return
maxReplica
;
}
static
int32_t
mnodeDbActionInsert
(
SSdbRow
*
pRow
)
{
SDbObj
*
pDb
=
pRow
->
pObj
;
SAcctObj
*
pAcct
=
mnodeGetAcct
(
pDb
->
acct
);
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
f52cf50c
...
...
@@ -29,6 +29,7 @@
#include "mnodeDef.h"
#include "mnodeInt.h"
#include "mnodeDnode.h"
#include "mnodeDb.h"
#include "mnodeMnode.h"
#include "mnodeSdb.h"
#include "mnodeShow.h"
...
...
@@ -745,6 +746,14 @@ static int32_t mnodeDropDnodeByEp(char *ep, SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_NO_REMOVE_MASTER
;
}
int32_t
maxReplica
=
mnodeGetDbMaxReplica
();
int32_t
dnodesNum
=
mnodeGetDnodesNum
();
if
(
dnodesNum
<=
maxReplica
)
{
mError
(
"dnode:%d, can't drop dnode:%s, #dnodes: %d, replia: %d"
,
pDnode
->
dnodeId
,
ep
,
dnodesNum
,
maxReplica
);
mnodeDecDnodeRef
(
pDnode
);
return
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
}
mInfo
(
"dnode:%d, start to drop it"
,
pDnode
->
dnodeId
);
int32_t
code
=
bnDropDnode
(
pDnode
);
...
...
tests/script/unique/cluster/balance2.sim
浏览文件 @
f52cf50c
...
...
@@ -338,10 +338,6 @@ system sh/exec.sh -n dnode1 -s stop -x SIGINT
print stop dnode1 and sleep 3000
sleep 3000
sql drop dnode $hostname1
print drop dnode1 and sleep 9000
sleep 9000
sql show mnodes
$dnode1Role = $data2_1
$dnode4Role = $data2_4
...
...
@@ -357,6 +353,25 @@ endi
print ============================== step6.1
system sh/exec.sh -n dnode1 -s start
$x = 0
step6.1:
$x = $x + 1
sleep 1000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 $data4_1
if $data4_1 != ready then
goto step6.1
endi
sql drop dnode $hostname1
print drop dnode1 and sleep 9000
sleep 9000
$x = 0
show6:
$x = $x + 1
...
...
tests/script/unique/dnode/remove1.sim
浏览文件 @
f52cf50c
...
...
@@ -97,7 +97,6 @@ if $data2_2 != 3 then
endi
print ========== step3
sql drop dnode $hostname2
$x = 0
show3:
...
...
@@ -114,6 +113,7 @@ print dnode2 openVnodes $data2_2
print ========== step4
sql create dnode $hostname3
system sh/exec.sh -n dnode3 -s start
sql drop dnode $hostname2
$x = 0
show4:
...
...
@@ -224,4 +224,4 @@ system sh/exec.sh -n dnode4 -s stop -x SIGINT
system sh/exec.sh -n dnode5 -s stop -x SIGINT
system sh/exec.sh -n dnode6 -s stop -x SIGINT
system sh/exec.sh -n dnode7 -s stop -x SIGINT
system sh/exec.sh -n dnode8 -s stop -x SIGINT
\ No newline at end of file
system sh/exec.sh -n dnode8 -s stop -x SIGINT
tests/script/unique/dnode/remove2.sim
浏览文件 @
f52cf50c
...
...
@@ -98,7 +98,6 @@ endi
print ========== step3
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sql drop dnode $hostname2
sql show dnodes
print dnode1 openVnodes $data2_1
...
...
@@ -128,6 +127,26 @@ endi
print ============ step 4.1
system sh/exec.sh -n dnode2 -s start
$x = 0
step4.1:
$x = $x + 1
sleep 1000
if $x == 10 then
return -1
endi
sql show dnodes
print dnode1 $data4_1
print dnode2 $data4_2
print dnode3 $data4_3
print dnode4 $data4_4
if $data4_2 != ready then
goto step4.1
endi
sql drop dnode $hostname2
$x = 0
show4:
$x = $x + 1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录