Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
87e4d500
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看板
提交
87e4d500
编写于
5月 30, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-437] stable refcount error while drop db
上级
488addaf
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
52 deletion
+52
-52
src/mnode/inc/mnodeVgroup.h
src/mnode/inc/mnodeVgroup.h
+2
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+3
-15
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+2
-2
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+22
-29
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+23
-5
未找到文件。
src/mnode/inc/mnodeVgroup.h
浏览文件 @
87e4d500
...
...
@@ -27,7 +27,8 @@ void mnodeCleanupVgroups();
SVgObj
*
mnodeGetVgroup
(
int32_t
vgId
);
void
mnodeIncVgroupRef
(
SVgObj
*
pVgroup
);
void
mnodeDecVgroupRef
(
SVgObj
*
pVgroup
);
void
mnodeDropAllDbVgroups
(
SDbObj
*
pDropDb
,
bool
sendMsg
);
void
mnodeDropAllDbVgroups
(
SDbObj
*
pDropDb
);
void
mnodeSendDropAllDbVgroupsMsg
(
SDbObj
*
pDropDb
);
void
mnodeDropAllDnodeVgroups
(
SDnodeObj
*
pDropDnode
);
void
mnodeUpdateAllDbVgroups
(
SDbObj
*
pAlterDb
);
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
87e4d500
...
...
@@ -81,10 +81,10 @@ static int32_t mnodeDbActionDelete(SSdbOper *pOper) {
SDbObj
*
pDb
=
pOper
->
pObj
;
SAcctObj
*
pAcct
=
mnodeGetAcct
(
pDb
->
acct
);
mnodeDropDbFromAcct
(
pAcct
,
pDb
);
mnodeDropAllChildTables
(
pDb
);
mnodeDropAllSuperTables
(
pDb
);
mnodeDropAllDbVgroups
(
pDb
,
false
);
mnodeDropAllDbVgroups
(
pDb
);
mnodeDropDbFromAcct
(
pAcct
,
pDb
);
mnodeDecAcctRef
(
pAcct
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -998,19 +998,7 @@ static int32_t mnodeProcessDropDbMsg(SMnodeMsg *pMsg) {
return
code
;
}
#if 1
mnodeDropAllDbVgroups
(
pMsg
->
pDb
,
true
);
#else
SVgObj
*
pVgroup
=
pMsg
->
pDb
->
pHead
;
if
(
pVgroup
!=
NULL
)
{
mPrint
(
"vgId:%d, will be dropped"
,
pVgroup
->
vgId
);
SMnodeMsg
*
newMsg
=
mnodeCloneMsg
(
pMsg
);
newMsg
->
ahandle
=
pVgroup
;
newMsg
->
expected
=
pVgroup
->
numOfVnodes
;
mnodeDropVgroup
(
pVgroup
,
newMsg
);
return
;
}
#endif
mnodeSendDropAllDbVgroupsMsg
(
pMsg
->
pDb
);
mTrace
(
"db:%s, all vgroups is dropped"
,
pMsg
->
pDb
->
name
);
return
mnodeDropDb
(
pMsg
);
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
87e4d500
...
...
@@ -211,13 +211,13 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) {
pMsg
->
rpcRsp
.
rsp
=
pRsp
;
pMsg
->
rpcRsp
.
len
=
size
;
if
(
rowsToRead
==
0
||
(
rowsRead
==
rowsToRead
)
)
{
if
(
rowsToRead
==
0
||
rowsRead
==
rowsToRead
)
{
pRsp
->
completed
=
1
;
mnodeReleaseShowObj
(
pShow
,
true
);
}
else
{
mnodeReleaseShowObj
(
pShow
,
false
);
}
return
TSDB_CODE_SUCCESS
;
}
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
87e4d500
...
...
@@ -148,37 +148,30 @@ static int32_t mnodeChildTableActionDelete(SSdbOper *pOper) {
return
TSDB_CODE_INVALID_VGROUP_ID
;
}
SVgObj
*
pVgroup
=
mnodeGetVgroup
(
pTable
->
vgId
);
if
(
pVgroup
==
NULL
)
{
return
TSDB_CODE_INVALID_VGROUP_ID
;
}
mnodeDecVgroupRef
(
pVgroup
);
SDbObj
*
pDb
=
mnodeGetDb
(
pVgroup
->
dbName
);
if
(
pDb
==
NULL
)
{
mError
(
"ctable:%s, vgId:%d not in DB:%s"
,
pTable
->
info
.
tableId
,
pVgroup
->
vgId
,
pVgroup
->
dbName
);
return
TSDB_CODE_INVALID_DB
;
}
mnodeDecDbRef
(
pDb
);
SAcctObj
*
pAcct
=
mnodeGetAcct
(
pDb
->
acct
);
if
(
pAcct
==
NULL
)
{
mError
(
"ctable:%s, acct:%s not exists"
,
pTable
->
info
.
tableId
,
pDb
->
acct
);
return
TSDB_CODE_INVALID_ACCT
;
}
mnodeDecAcctRef
(
pAcct
);
SVgObj
*
pVgroup
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SAcctObj
*
pAcct
=
NULL
;
pVgroup
=
mnodeGetVgroup
(
pTable
->
vgId
);
if
(
pVgroup
!=
NULL
)
pDb
=
mnodeGetDb
(
pVgroup
->
dbName
);
if
(
pDb
!=
NULL
)
pAcct
=
mnodeGetAcct
(
pDb
->
acct
);
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
grantRestore
(
TSDB_GRANT_TIMESERIES
,
pTable
->
superTable
->
numOfColumns
-
1
);
pAcct
->
acctInfo
.
numOfTimeSeries
-=
(
pTable
->
superTable
->
numOfColumns
-
1
);
if
(
pAcct
!=
NULL
)
pAcct
->
acctInfo
.
numOfTimeSeries
-=
(
pTable
->
superTable
->
numOfColumns
-
1
);
mnodeRemoveTableFromStable
(
pTable
->
superTable
,
pTable
);
mnodeDecTableRef
(
pTable
->
superTable
);
}
else
{
grantRestore
(
TSDB_GRANT_TIMESERIES
,
pTable
->
numOfColumns
-
1
);
pAcct
->
acctInfo
.
numOfTimeSeries
-=
(
pTable
->
numOfColumns
-
1
);
if
(
pAcct
!=
NULL
)
pAcct
->
acctInfo
.
numOfTimeSeries
-=
(
pTable
->
numOfColumns
-
1
);
}
mnodeRemoveTableFromDb
(
pDb
);
mnodeRemoveTableFromVgroup
(
pVgroup
,
pTable
);
if
(
pDb
!=
NULL
)
mnodeRemoveTableFromDb
(
pDb
);
if
(
pVgroup
!=
NULL
)
mnodeRemoveTableFromVgroup
(
pVgroup
,
pTable
);
mnodeDecVgroupRef
(
pVgroup
);
mnodeDecDbRef
(
pDb
);
mnodeDecAcctRef
(
pAcct
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -693,10 +686,10 @@ static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg) {
}
if
(
pCreate
->
numOfTags
!=
0
)
{
mTrace
(
"table:%s, create msg is received from thandle:%p"
,
pCreate
->
tableId
,
pMsg
->
rpcMsg
.
handle
);
mTrace
(
"table:%s, create
stable
msg is received from thandle:%p"
,
pCreate
->
tableId
,
pMsg
->
rpcMsg
.
handle
);
return
mnodeProcessCreateSuperTableMsg
(
pMsg
);
}
else
{
mTrace
(
"table:%s, create msg is received from thandle:%p"
,
pCreate
->
tableId
,
pMsg
->
rpcMsg
.
handle
);
mTrace
(
"table:%s, create
ctable
msg is received from thandle:%p"
,
pCreate
->
tableId
,
pMsg
->
rpcMsg
.
handle
);
return
mnodeProcessCreateChildTableMsg
(
pMsg
);
}
}
...
...
@@ -1288,7 +1281,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
}
pRsp
->
numOfTables
=
htonl
(
numOfTable
);
char
*
msg
=
(
char
*
)
pRsp
+
sizeof
(
SCMSTableVgroupRspMsg
);
char
*
msg
=
(
char
*
)
pRsp
+
sizeof
(
SCMSTableVgroupRspMsg
);
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SCMSTableVgroupMsg
)
+
(
TSDB_TABLE_ID_LEN
)
*
i
;
...
...
@@ -1318,6 +1311,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
}
taosHashDestroyIter
(
pIter
);
mnodeDecTableRef
(
pTable
);
pVgroupInfo
->
numOfVgroups
=
htonl
(
vgSize
);
...
...
@@ -1738,7 +1732,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
static
int32_t
mnodeAutoCreateChildTable
(
SMnodeMsg
*
pMsg
)
{
SCMTableInfoMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
STagData
*
pTag
=
(
STagData
*
)
pInfo
->
tags
;
STagData
*
pTag
=
(
STagData
*
)
pInfo
->
tags
;
int32_t
contLen
=
sizeof
(
SCMCreateTableMsg
)
+
offsetof
(
STagData
,
data
)
+
ntohl
(
pTag
->
dataLen
);
SCMCreateTableMsg
*
pCreateMsg
=
rpcMallocCont
(
contLen
);
...
...
@@ -1754,13 +1748,12 @@ static int32_t mnodeAutoCreateChildTable(SMnodeMsg *pMsg) {
pCreateMsg
->
contLen
=
htonl
(
contLen
);
memcpy
(
pCreateMsg
->
schema
,
pInfo
->
tags
,
contLen
-
sizeof
(
SCMCreateTableMsg
));
mTrace
(
"table:%s, start to create on demand, stable:%s"
,
pInfo
->
tableId
,
pInfo
->
tags
);
mTrace
(
"table:%s, start to create on demand, stable:%s"
,
pInfo
->
tableId
,
((
STagData
*
)(
pCreateMsg
->
schema
))
->
name
);
rpcFreeCont
(
pMsg
->
rpcMsg
.
pCont
);
pMsg
->
rpcMsg
.
msgType
=
TSDB_MSG_TYPE_CM_CREATE_TABLE
;
pMsg
->
rpcMsg
.
pCont
=
pCreateMsg
;
pMsg
->
rpcMsg
.
contLen
=
contLen
;
return
TSDB_CODE_ACTION_NEED_REPROCESSED
;
}
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
87e4d500
...
...
@@ -784,7 +784,7 @@ void mnodeUpdateAllDbVgroups(SDbObj *pAlterDb) {
mPrint
(
"db:%s, all vgroups is updated in sdb"
,
pAlterDb
->
name
);
}
void
mnodeDropAllDbVgroups
(
SDbObj
*
pDropDb
,
bool
sendMsg
)
{
void
mnodeDropAllDbVgroups
(
SDbObj
*
pDropDb
)
{
void
*
pIter
=
NULL
;
int32_t
numOfVgroups
=
0
;
SVgObj
*
pVgroup
=
NULL
;
...
...
@@ -802,10 +802,6 @@ void mnodeDropAllDbVgroups(SDbObj *pDropDb, bool sendMsg) {
};
sdbDeleteRow
(
&
oper
);
numOfVgroups
++
;
if
(
sendMsg
)
{
mnodeSendDropVgroupMsg
(
pVgroup
,
NULL
);
}
}
mnodeDecVgroupRef
(
pVgroup
);
...
...
@@ -815,3 +811,25 @@ void mnodeDropAllDbVgroups(SDbObj *pDropDb, bool sendMsg) {
mPrint
(
"db:%s, all vgroups:%d is dropped from sdb"
,
pDropDb
->
name
,
numOfVgroups
);
}
void
mnodeSendDropAllDbVgroupsMsg
(
SDbObj
*
pDropDb
)
{
void
*
pIter
=
NULL
;
int32_t
numOfVgroups
=
0
;
SVgObj
*
pVgroup
=
NULL
;
mPrint
(
"db:%s, all vgroups will be dropped in dnode"
,
pDropDb
->
name
);
while
(
1
)
{
pIter
=
mnodeGetNextVgroup
(
pIter
,
&
pVgroup
);
if
(
pVgroup
==
NULL
)
break
;
if
(
pVgroup
->
pDb
==
pDropDb
)
{
mnodeSendDropVgroupMsg
(
pVgroup
,
NULL
);
}
mnodeDecVgroupRef
(
pVgroup
);
}
sdbFreeIter
(
pIter
);
mPrint
(
"db:%s, all vgroups:%d drop msg is sent to dnode"
,
pDropDb
->
name
,
numOfVgroups
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录