Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
3ba7fca8
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看板
提交
3ba7fca8
编写于
7月 09, 2020
作者:
H
Hui Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-876]
上级
dba97b1a
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
96 addition
and
11 deletion
+96
-11
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+5
-0
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+11
-1
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+64
-10
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+15
-0
未找到文件。
src/inc/taoserror.h
浏览文件 @
3ba7fca8
...
...
@@ -158,6 +158,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_OPTION, 0, 0x0382, "mnode inva
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB
,
0
,
0x0383
,
"mnode invalid database"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MONITOR_DB_FORBIDDEN
,
0
,
0x0384
,
"mnode monitor db forbidden"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_DATABASES
,
0
,
0x0385
,
"mnode too many databases"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_IN_DROPPING
,
0
,
0x0380
,
"mnode db in dropping"
)
// dnode
TAOS_DEFINE_ERROR
(
TSDB_CODE_DND_MSG_NOT_PROCESSED
,
0
,
0x0400
,
"dnode message not processed"
)
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
3ba7fca8
...
...
@@ -966,6 +966,11 @@ static int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_INVALID_DB
;
}
if
(
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pAlter
->
db
,
pMsg
->
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
return
mnodeAlterDb
(
pMsg
->
pDb
,
pAlter
,
pMsg
);
}
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
3ba7fca8
...
...
@@ -307,6 +307,11 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
code
=
TSDB_CODE_MND_INVALID_DB
;
goto
connect_over
;
}
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
mnodeDecDbRef
(
pDb
);
}
...
...
@@ -353,6 +358,11 @@ static int32_t mnodeProcessUseMsg(SMnodeMsg *pMsg) {
code
=
TSDB_CODE_MND_INVALID_DB
;
}
if
(
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pMsg
->
pDb
->
name
,
pMsg
->
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
return
code
;
}
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
3ba7fca8
...
...
@@ -116,6 +116,11 @@ static int32_t mnodeChildTableActionInsert(SSdbOper *pOper) {
mError
(
"ctable:%s, vgId:%d not in db:%s"
,
pTable
->
info
.
tableId
,
pVgroup
->
vgId
,
pVgroup
->
dbName
);
return
TSDB_CODE_MND_INVALID_DB
;
}
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
mnodeDecDbRef
(
pDb
);
SAcctObj
*
pAcct
=
mnodeGetAcct
(
pDb
->
acct
);
...
...
@@ -284,8 +289,8 @@ static int32_t mnodeChildTableActionRestored() {
if
(
pTable
==
NULL
)
break
;
SDbObj
*
pDb
=
mnodeGetDbByTableId
(
pTable
->
info
.
tableId
);
if
(
pDb
==
NULL
)
{
mError
(
"ctable:%s, failed to get db, discard it"
,
pTable
->
info
.
tableId
);
if
(
pDb
==
NULL
||
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"ctable:%s, failed to get db
or db in dropping
, discard it"
,
pTable
->
info
.
tableId
);
SSdbOper
desc
=
{.
type
=
SDB_OPER_LOCAL
,
.
pObj
=
pTable
,
.
table
=
tsChildTableSdb
};
sdbDeleteRow
(
&
desc
);
mnodeDecTableRef
(
pTable
);
...
...
@@ -423,7 +428,7 @@ static int32_t mnodeSuperTableActionDestroy(SSdbOper *pOper) {
static
int32_t
mnodeSuperTableActionInsert
(
SSdbOper
*
pOper
)
{
SSuperTableObj
*
pStable
=
pOper
->
pObj
;
SDbObj
*
pDb
=
mnodeGetDbByTableId
(
pStable
->
info
.
tableId
);
if
(
pDb
!=
NULL
)
{
if
(
pDb
!=
NULL
&&
pDb
->
status
==
TSDB_DB_STATUS_READY
)
{
mnodeAddSuperTableIntoDb
(
pDb
);
}
mnodeDecDbRef
(
pDb
);
...
...
@@ -685,11 +690,16 @@ static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg) {
SCMCreateTableMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDb
(
pCreate
->
db
);
if
(
pMsg
->
pDb
==
NULL
||
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
if
(
pMsg
->
pDb
==
NULL
)
{
mError
(
"app:%p:%p, table:%s, failed to create, db not selected"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pCreate
->
tableId
);
return
TSDB_CODE_MND_DB_NOT_SELECTED
;
}
if
(
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pMsg
->
pDb
->
name
,
pMsg
->
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
if
(
pMsg
->
pTable
==
NULL
)
pMsg
->
pTable
=
mnodeGetTable
(
pCreate
->
tableId
);
if
(
pMsg
->
pTable
!=
NULL
&&
pMsg
->
retry
==
0
)
{
if
(
pCreate
->
getMeta
)
{
...
...
@@ -719,11 +729,16 @@ static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg) {
static
int32_t
mnodeProcessDropTableMsg
(
SMnodeMsg
*
pMsg
)
{
SCMDropTableMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDbByTableId
(
pDrop
->
tableId
);
if
(
pMsg
->
pDb
==
NULL
||
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"app:%p:%p, table:%s, failed to drop table, db not selected"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pDrop
->
tableId
);
if
(
pMsg
->
pDb
==
NULL
)
{
mError
(
"app:%p:%p, table:%s, failed to drop table, db not selected
or db in dropping
"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pDrop
->
tableId
);
return
TSDB_CODE_MND_DB_NOT_SELECTED
;
}
if
(
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pMsg
->
pDb
->
name
,
pMsg
->
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
if
(
mnodeCheckIsMonitorDB
(
pMsg
->
pDb
->
name
,
tsMonitorDbName
))
{
mError
(
"app:%p:%p, table:%s, failed to drop table, in monitor database"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pDrop
->
tableId
);
...
...
@@ -757,12 +772,17 @@ static int32_t mnodeProcessTableMetaMsg(SMnodeMsg *pMsg) {
pInfo
->
tableId
,
pMsg
->
rpcMsg
.
handle
,
pInfo
->
createFlag
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDbByTableId
(
pInfo
->
tableId
);
if
(
pMsg
->
pDb
==
NULL
||
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
if
(
pMsg
->
pDb
==
NULL
)
{
mError
(
"app:%p:%p, table:%s, failed to get table meta, db not selected"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pInfo
->
tableId
);
return
TSDB_CODE_MND_DB_NOT_SELECTED
;
}
if
(
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pMsg
->
pDb
->
name
,
pMsg
->
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
if
(
pMsg
->
pTable
==
NULL
)
pMsg
->
pTable
=
mnodeGetTable
(
pInfo
->
tableId
);
if
(
pMsg
->
pTable
==
NULL
)
{
if
(
!
pInfo
->
createFlag
)
{
...
...
@@ -1210,6 +1230,11 @@ static int32_t mnodeGetShowSuperTableMeta(STableMetaMsg *pMeta, SShowObj *pShow,
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
return
TSDB_CODE_MND_DB_NOT_SELECTED
;
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
@@ -1269,6 +1294,11 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows,
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
0
;
}
tstrncpy
(
prefix
,
pDb
->
name
,
64
);
strcat
(
prefix
,
TS_PATH_DELIMITER
);
prefixLen
=
strlen
(
prefix
);
...
...
@@ -2299,7 +2329,7 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) {
if
(
pTable
==
NULL
)
continue
;
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDbByTableId
(
tableId
);
if
(
pMsg
->
pDb
==
NULL
)
{
if
(
pMsg
->
pDb
==
NULL
||
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mnodeDecTableRef
(
pTable
);
continue
;
}
...
...
@@ -2338,6 +2368,11 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
return
TSDB_CODE_MND_DB_NOT_SELECTED
;
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
@@ -2386,6 +2421,11 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
0
;
}
int32_t
numOfRows
=
0
;
SChildTableObj
*
pTable
=
NULL
;
SPatternCompareInfo
info
=
PATTERN_COMPARE_INFO_INITIALIZER
;
...
...
@@ -2476,11 +2516,16 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
pAlter
->
tableId
,
pMsg
->
rpcMsg
.
handle
);
if
(
pMsg
->
pDb
==
NULL
)
pMsg
->
pDb
=
mnodeGetDbByTableId
(
pAlter
->
tableId
);
if
(
pMsg
->
pDb
==
NULL
||
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
if
(
pMsg
->
pDb
==
NULL
)
{
mError
(
"app:%p:%p, table:%s, failed to alter table, db not selected"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pAlter
->
tableId
);
return
TSDB_CODE_MND_DB_NOT_SELECTED
;
}
if
(
pMsg
->
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pMsg
->
pDb
->
name
,
pMsg
->
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
if
(
mnodeCheckIsMonitorDB
(
pMsg
->
pDb
->
name
,
tsMonitorDbName
))
{
mError
(
"app:%p:%p, table:%s, failed to alter table, its log db"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pAlter
->
tableId
);
return
TSDB_CODE_MND_MONITOR_DB_FORBIDDEN
;
...
...
@@ -2540,6 +2585,11 @@ static int32_t mnodeGetStreamTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, vo
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
return
TSDB_CODE_MND_DB_NOT_SELECTED
;
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
@@ -2587,6 +2637,10 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
0
;
}
int32_t
numOfRows
=
0
;
SChildTableObj
*
pTable
=
NULL
;
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
3ba7fca8
...
...
@@ -76,6 +76,11 @@ static int32_t mnodeVgroupActionInsert(SSdbOper *pOper) {
return
TSDB_CODE_MND_INVALID_DB
;
}
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
pVgroup
->
pDb
=
pDb
;
pVgroup
->
prev
=
NULL
;
pVgroup
->
next
=
NULL
;
...
...
@@ -436,6 +441,11 @@ int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
return
TSDB_CODE_MND_DB_NOT_SELECTED
;
}
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
TSDB_CODE_MND_DB_IN_DROPPING
;
}
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
...
...
@@ -524,6 +534,11 @@ int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pC
SDbObj
*
pDb
=
mnodeGetDb
(
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
if
(
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mError
(
"db:%s, status:%d, in dropping"
,
pDb
->
name
,
pDb
->
status
);
return
0
;
}
pVgroup
=
pDb
->
pHead
;
while
(
pVgroup
!=
NULL
)
{
maxReplica
=
pVgroup
->
numOfVnodes
>
maxReplica
?
pVgroup
->
numOfVnodes
:
maxReplica
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录