Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小楼昨夜-听风雨
TDengine
提交
ab9fac49
T
TDengine
项目概览
小楼昨夜-听风雨
/
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,发现更多精彩内容 >>
提交
ab9fac49
编写于
5月 22, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-388] drop dnode in community version
上级
268baa3d
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
190 addition
and
10 deletion
+190
-10
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-0
src/mnode/inc/mgmtDef.h
src/mnode/inc/mgmtDef.h
+0
-1
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+1
-0
src/mnode/inc/mgmtTable.h
src/mnode/inc/mgmtTable.h
+1
-0
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+18
-3
src/mnode/src/mgmtSdb.c
src/mnode/src/mgmtSdb.c
+4
-4
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+2
-0
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+29
-1
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+5
-1
tests/script/general/db/dropdnodes.sim
tests/script/general/db/dropdnodes.sim
+104
-0
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-0
tests/script/jenkins/sync.txt
tests/script/jenkins/sync.txt
+23
-0
未找到文件。
src/inc/taosmsg.h
浏览文件 @
ab9fac49
...
...
@@ -725,6 +725,8 @@ typedef struct {
typedef
struct
{
uint32_t
queryId
;
uint32_t
streamId
;
uint32_t
totalDnodes
;
uint32_t
onlineDnodes
;
int8_t
killConnection
;
SRpcIpSet
ipList
;
}
SCMHeartBeatRsp
;
...
...
src/mnode/inc/mgmtDef.h
浏览文件 @
ab9fac49
...
...
@@ -66,7 +66,6 @@ typedef struct SMnodeObj {
SDnodeObj
*
pDnode
;
}
SMnodeObj
;
// todo use dynamic length string
typedef
struct
{
char
*
tableId
;
int8_t
type
;
...
...
src/mnode/inc/mgmtDnode.h
浏览文件 @
ab9fac49
...
...
@@ -34,6 +34,7 @@ char* mgmtGetDnodeStatusStr(int32_t dnodeStatus);
void
mgmtMonitorDnodeModule
();
int32_t
mgmtGetDnodesNum
();
int32_t
mgmtGetOnlinDnodesNum
();
void
*
mgmtGetNextDnode
(
void
*
pIter
,
SDnodeObj
**
pDnode
);
void
mgmtIncDnodeRef
(
SDnodeObj
*
pDnode
);
void
mgmtDecDnodeRef
(
SDnodeObj
*
pDnode
);
...
...
src/mnode/inc/mgmtTable.h
浏览文件 @
ab9fac49
...
...
@@ -31,6 +31,7 @@ void * mgmtGetNextChildTable(void *pIter, SChildTableObj **pTable);
void
*
mgmtGetNextSuperTable
(
void
*
pIter
,
SSuperTableObj
**
pTable
);
void
mgmtDropAllChildTables
(
SDbObj
*
pDropDb
);
void
mgmtDropAllSuperTables
(
SDbObj
*
pDropDb
);
void
mgmtDropAllChildTablesInVgroups
(
SVgObj
*
pVgroup
);
#ifdef __cplusplus
}
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
ab9fac49
...
...
@@ -74,7 +74,6 @@ static int32_t mgmtDnodeActionDelete(SSdbOper *pOper) {
SDnodeObj
*
pDnode
=
pOper
->
pObj
;
#ifndef _SYNC
//TODO: drop dnode local
mgmtDropAllDnodeVgroups
(
pDnode
);
#endif
mgmtDropMnodeLocal
(
pDnode
->
dnodeId
);
...
...
@@ -179,6 +178,23 @@ int32_t mgmtGetDnodesNum() {
return
sdbGetNumOfRows
(
tsDnodeSdb
);
}
int32_t
mgmtGetOnlinDnodesNum
(
char
*
ep
)
{
SDnodeObj
*
pDnode
=
NULL
;
void
*
pIter
=
NULL
;
int32_t
onlineDnodes
=
0
;
while
(
1
)
{
pIter
=
mgmtGetNextDnode
(
pIter
,
&
pDnode
);
if
(
pDnode
==
NULL
)
break
;
if
(
pDnode
->
status
!=
TAOS_DN_STATUS_OFFLINE
)
onlineDnodes
++
;
mgmtDecDnodeRef
(
pDnode
);
}
sdbFreeIter
(
pIter
);
return
onlineDnodes
;
}
void
*
mgmtGetDnode
(
int32_t
dnodeId
)
{
return
sdbGetRow
(
tsDnodeSdb
,
&
dnodeId
);
}
...
...
@@ -397,7 +413,6 @@ static int32_t mgmtCreateDnode(char *ep) {
return
code
;
}
//TODO drop others tables
int32_t
mgmtDropDnode
(
SDnodeObj
*
pDnode
)
{
SSdbOper
oper
=
{
.
type
=
SDB_OPER_GLOBAL
,
...
...
@@ -410,7 +425,7 @@ int32_t mgmtDropDnode(SDnodeObj *pDnode) {
code
=
TSDB_CODE_SDB_ERROR
;
}
mLPrint
(
"dnode:%d is dropped from cluster, result:%s"
,
pDnode
->
dnodeId
,
tstrerror
(
code
));
mLPrint
(
"dnode:%d
,
is dropped from cluster, result:%s"
,
pDnode
->
dnodeId
,
tstrerror
(
code
));
return
code
;
}
...
...
src/mnode/src/mgmtSdb.c
浏览文件 @
ab9fac49
...
...
@@ -353,8 +353,8 @@ void sdbIncRef(void *handle, void *pObj) {
SSdbTable
*
pTable
=
handle
;
int32_t
*
pRefCount
=
(
int32_t
*
)(
pObj
+
pTable
->
refCountPos
);
atomic_add_fetch_32
(
pRefCount
,
1
);
if
(
0
&&
(
pTable
->
tableId
==
SDB_TABLE_MNODE
||
pTable
->
tableId
==
SDB_TABLE_DNODE
))
{
sdbTrace
(
"
table:%s, add ref to
record:%s:%d"
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
if
(
1
&&
(
pTable
->
tableId
==
SDB_TABLE_MNODE
||
pTable
->
tableId
==
SDB_TABLE_DNODE
))
{
sdbTrace
(
"
add ref to table:%s
record:%s:%d"
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
}
}
...
...
@@ -364,8 +364,8 @@ void sdbDecRef(void *handle, void *pObj) {
SSdbTable
*
pTable
=
handle
;
int32_t
*
pRefCount
=
(
int32_t
*
)(
pObj
+
pTable
->
refCountPos
);
int32_t
refCount
=
atomic_sub_fetch_32
(
pRefCount
,
1
);
if
(
0
&&
(
pTable
->
tableId
==
SDB_TABLE_MNODE
||
pTable
->
tableId
==
SDB_TABLE_DNODE
))
{
sdbTrace
(
"
table:%s, def ref of
record:%s:%d"
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
if
(
1
&&
(
pTable
->
tableId
==
SDB_TABLE_MNODE
||
pTable
->
tableId
==
SDB_TABLE_DNODE
))
{
sdbTrace
(
"
def ref of table:%s
record:%s:%d"
,
pTable
->
tableName
,
sdbGetKeyStrFromObj
(
pTable
,
pObj
),
*
pRefCount
);
}
int8_t
*
updateEnd
=
pObj
+
pTable
->
refCountPos
-
1
;
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
ab9fac49
...
...
@@ -325,6 +325,8 @@ static void mgmtProcessHeartBeatMsg(SQueuedMsg *pMsg) {
return
;
}
pHBRsp
->
onlineDnodes
=
htonl
(
mgmtGetOnlinDnodesNum
());
pHBRsp
->
totalDnodes
=
htonl
(
mgmtGetDnodesNum
());
mgmtGetMnodeIpSet
(
&
pHBRsp
->
ipList
);
/*
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
ab9fac49
...
...
@@ -1305,7 +1305,7 @@ static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) {
if
(
pDnode
==
NULL
)
break
;
strncpy
(
pVgroupInfo
->
vgroups
[
vgSize
].
ipAddr
[
vn
].
fqdn
,
pDnode
->
dnodeFqdn
,
tListLen
(
pDnode
->
dnodeFqdn
));
pVgroupInfo
->
vgroups
[
vgSize
].
ipAddr
[
vn
].
port
=
htons
(
tsDnodeShell
Port
);
pVgroupInfo
->
vgroups
[
vgSize
].
ipAddr
[
vn
].
port
=
htons
(
pDnode
->
dnode
Port
);
pVgroupInfo
->
vgroups
[
vgSize
].
numOfIps
++
;
}
...
...
@@ -1787,6 +1787,34 @@ static void mgmtGetChildTableMeta(SQueuedMsg *pMsg) {
rpcSendResponse
(
&
rpcRsp
);
}
void
mgmtDropAllChildTablesInVgroups
(
SVgObj
*
pVgroup
)
{
void
*
pIter
=
NULL
;
int32_t
numOfTables
=
0
;
SChildTableObj
*
pTable
=
NULL
;
mPrint
(
"vgId:%d, all child tables will be dropped from sdb"
,
pVgroup
->
vgId
);
while
(
1
)
{
pIter
=
mgmtGetNextChildTable
(
pIter
,
&
pTable
);
if
(
pTable
==
NULL
)
break
;
if
(
pTable
->
vgId
==
pVgroup
->
vgId
)
{
SSdbOper
oper
=
{
.
type
=
SDB_OPER_LOCAL
,
.
table
=
tsChildTableSdb
,
.
pObj
=
pTable
,
};
sdbDeleteRow
(
&
oper
);
numOfTables
++
;
}
mgmtDecTableRef
(
pTable
);
}
sdbFreeIter
(
pIter
);
mPrint
(
"vgId:%d, all child tables is dropped from sdb"
,
pVgroup
->
vgId
);
}
void
mgmtDropAllChildTables
(
SDbObj
*
pDropDb
)
{
void
*
pIter
=
NULL
;
int32_t
numOfTables
=
0
;
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
ab9fac49
...
...
@@ -747,11 +747,14 @@ void mgmtDropAllDnodeVgroups(SDnodeObj *pDropDnode) {
SVgObj
*
pVgroup
=
NULL
;
int32_t
numOfVgroups
=
0
;
mPrint
(
"dnode:%d, all vgroups will be dropped from sdb"
,
pDropDnode
->
dnodeId
);
while
(
1
)
{
pIter
=
mgmtGetNextVgroup
(
pIter
,
&
pVgroup
);
if
(
pVgroup
==
NULL
)
break
;
if
(
pVgroup
->
vnodeGid
[
0
].
dnodeId
==
pDropDnode
->
dnodeId
)
{
mgmtDropAllChildTablesInVgroups
(
pVgroup
);
SSdbOper
oper
=
{
.
type
=
SDB_OPER_LOCAL
,
.
table
=
tsVgroupSdb
,
...
...
@@ -759,12 +762,13 @@ void mgmtDropAllDnodeVgroups(SDnodeObj *pDropDnode) {
};
sdbDeleteRow
(
&
oper
);
numOfVgroups
++
;
continue
;
}
mgmtDecVgroupRef
(
pVgroup
);
}
sdbFreeIter
(
pIter
);
mPrint
(
"dnode:%d, all vgroups is dropped from sdb"
,
pDropDnode
->
dnodeId
);
}
void
mgmtUpdateAllDbVgroups
(
SDbObj
*
pAlterDb
)
{
...
...
tests/script/general/db/dropdnodes.sim
0 → 100644
浏览文件 @
ab9fac49
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 2
system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode1 -c walLevel -v 2
print ========== prepare data
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
sleep 3000
sql connect
sql create dnode $hostname2
sleep 2000
sql create database db maxTables 4
sql use db
print ========== step1
sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int)
sql create table db.t1 using db.mt tags(1)
sql create table db.t2 using db.mt tags(2)
sql create table db.t3 using db.mt tags(3)
sql create table db.t4 using db.mt tags(4)
sql create table db.t5 using db.mt tags(5)
sql create table db.t6 using db.mt tags(6)
sql create table db.t7 using db.mt tags(7)
sql create table db.t8 using db.mt tags(8)
sql create table db.t9 using db.mt tags(9)
sql create table db.t10 using db.mt tags(10)
sql create table db.t11 using db.mt tags(11)
sql create table db.t12 using db.mt tags(12)
sql create table db.t13 using db.mt tags(13)
sql create table db.t14 using db.mt tags(14)
sql create table db.t15 using db.mt tags(15)
sql create table db.t16 using db.mt tags(16)
sql insert into db.t1 values(now, 1)
sql insert into db.t2 values(now, 1)
sql insert into db.t3 values(now, 1)
sql insert into db.t4 values(now, 1)
sql insert into db.t5 values(now, 1)
sql insert into db.t6 values(now, 1)
sql insert into db.t7 values(now, 1)
sql insert into db.t8 values(now, 1)
sql insert into db.t9 values(now, 1)
sql insert into db.t10 values(now, 1)
sql insert into db.t11 values(now, 1)
sql insert into db.t12 values(now, 1)
sql insert into db.t13 values(now, 1)
sql insert into db.t14 values(now, 1)
sql insert into db.t15 values(now, 1)
sql insert into db.t16 values(now, 1)
print ========== step2
sql show tables
print $rows
if $rows != 16 then
return -1
endi
sql select * from mt
print $rows
if $rows != 16 then
return -1
endi
print ========== step3
system sh/exec.sh -n dnode2 -s stop -x SIGINT
sleep 500
sql drop dnode $hostname2
sleep 2000
print ========== step3
sql show tables
print $rows
if $rows != 8 then
return -1
endi
sql select * from mt
print $rows
if $rows != 8 then
return -1
endi
sql select * from db.t5
if $rows != 1 then
return -1
endi
sql select * from db.t13
if $rows != 1 then
return -1
endi
sql_error select * from db.t1
sql_error select * from db.t9
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
tests/script/jenkins/basic.txt
浏览文件 @
ab9fac49
...
...
@@ -61,6 +61,7 @@ cd ../../../debug; make
./test.sh -f general/db/delete_writing1.sim
./test.sh -f general/db/delete_writing2.sim
./test.sh -f general/db/delete.sim
./test.sh -f general/db/dropdnodes.sim
./test.sh -f general/db/len.sim
./test.sh -f general/db/repeat.sim
./test.sh -f general/db/tables.sim
...
...
tests/script/jenkins/sync.txt
0 → 100644
浏览文件 @
ab9fac49
cd ../../debug; cmake ..
cd ../../debug; make
cd ../../../debug; cmake ..
cd ../../../debug; make
./test.sh -u -f unique/cluster/balance1.sim
./test.sh -u -f unique/cluster/balance2.sim
./test.sh -u -f unique/cluster/balance3.sim
./test.sh -u -f unique/cluster/cache.sim
./test.sh -u -f unique/dnode/balance1.sim
./test.sh -u -f unique/dnode/balance2.sim
./test.sh -u -f unique/dnode/balance3.sim
./test.sh -u -f unique/dnode/balancex.sim
./test.sh -u -f unique/mnode/mgmt22.sim
./test.sh -u -f unique/mnode/mgmt23.sim
./test.sh -u -f unique/mnode/mgmt24.sim
./test.sh -u -f unique/mnode/mgmt25.sim
./test.sh -u -f unique/mnode/mgmt26.sim
./test.sh -u -f unique/mnode/mgmt33.sim
./test.sh -u -f unique/mnode/mgmt34.sim
./test.sh -u -f unique/mnode/mgmtr2.sim
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录