Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
75d7ae5a
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
75d7ae5a
编写于
11月 08, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
11月 08, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17953 from taosdata/enh/TD-20263
enh: optimize the error code when create and drop a db in dropping status
上级
fd53afd7
abd95562
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
65 addition
and
39 deletion
+65
-39
include/common/tmsg.h
include/common/tmsg.h
+1
-0
include/util/taoserror.h
include/util/taoserror.h
+16
-6
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+7
-2
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+27
-23
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+2
-5
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+2
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+4
-2
source/util/src/tarray.c
source/util/src/tarray.c
+2
-0
source/util/src/terror.c
source/util/src/terror.c
+2
-0
未找到文件。
include/common/tmsg.h
浏览文件 @
75d7ae5a
...
...
@@ -852,6 +852,7 @@ typedef struct {
int16_t
hashSuffix
;
int8_t
hashMethod
;
SArray
*
pVgroupInfos
;
// Array of SVgroupInfo
int32_t
errCode
;
}
SUseDbRsp
;
int32_t
tSerializeSUseDbRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUseDbRsp
*
pRsp
);
...
...
include/util/taoserror.h
浏览文件 @
75d7ae5a
...
...
@@ -154,7 +154,7 @@ int32_t* taosGetErrno();
// mnode-sdb
#define TSDB_CODE_SDB_OBJ_ALREADY_THERE TAOS_DEF_ERROR_CODE(0, 0x0320)
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0321)
#define TSDB_CODE_SDB_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x0321)
// internal
#define TSDB_CODE_SDB_INVALID_TABLE_TYPE TAOS_DEF_ERROR_CODE(0, 0x0322)
#define TSDB_CODE_SDB_OBJ_NOT_THERE TAOS_DEF_ERROR_CODE(0, 0x0323)
#define TSDB_CODE_SDB_INVALID_KEY_TYPE TAOS_DEF_ERROR_CODE(0, 0x0325)
...
...
@@ -218,14 +218,24 @@ int32_t* taosGetErrno();
// mnode-db
#define TSDB_CODE_MND_DB_NOT_SELECTED TAOS_DEF_ERROR_CODE(0, 0x0380)
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0381)
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0382)
#define TSDB_CODE_MND_DB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0381)
//
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0382)
//
#define TSDB_CODE_MND_INVALID_DB TAOS_DEF_ERROR_CODE(0, 0x0383)
// #define TSDB_CODE_MND_MONITOR_DB_FORBIDDEN TAOS_DEF_ERROR_CODE(0, 0x0384) // 2.x
#define TSDB_CODE_MND_TOO_MANY_DATABASES TAOS_DEF_ERROR_CODE(0, 0x0385)
#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388)
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0389)
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x038A)
#define TSDB_CODE_MND_DB_IN_DROPPING TAOS_DEF_ERROR_CODE(0, 0x0386) //
// #define TSDB_CODE_MND_VGROUP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0387) // 2.x
#define TSDB_CODE_MND_DB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388) //
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0389) // internal
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x038A) //
#define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x038B)
// #define TSDB_CODE_MND_INVALID_DB_OPTION_DAYS TAOS_DEF_ERROR_CODE(0, 0x0390) // 2.x
// #define TSDB_CODE_MND_INVALID_DB_OPTION_KEEP TAOS_DEF_ERROR_CODE(0, 0x0391) // 2.x
// #define TSDB_CODE_MND_INVALID_TOPIC TAOS_DEF_ERROR_CODE(0, 0x0392) // 2.x
// #define TSDB_CODE_MND_INVALID_TOPIC_OPTION TAOS_DEF_ERROR_CODE(0, 0x0393) // 2.x
// #define TSDB_CODE_MND_INVALID_TOPIC_PARTITONSTAOS_DEF_ERROR_CODE(0, 0x0394) // 2.x
// #define TSDB_CODE_MND_TOPIC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0395) // 2.x
#define TSDB_CODE_MND_DB_IN_CREATING TAOS_DEF_ERROR_CODE(0, 0x0396) //
#define TSDB_CODE_MND_INVALID_SYS_TABLENAME TAOS_DEF_ERROR_CODE(0, 0x039A)
// mnode-node
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
75d7ae5a
...
...
@@ -175,7 +175,8 @@ int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
int32_t
processUseDbRsp
(
void
*
param
,
SDataBuf
*
pMsg
,
int32_t
code
)
{
SRequestObj
*
pRequest
=
param
;
if
(
TSDB_CODE_MND_DB_NOT_EXIST
==
code
)
{
if
(
TSDB_CODE_MND_DB_NOT_EXIST
==
code
||
TSDB_CODE_MND_DB_IN_CREATING
==
code
||
TSDB_CODE_MND_DB_IN_DROPPING
==
code
)
{
SUseDbRsp
usedbRsp
=
{
0
};
tDeserializeSUseDbRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
usedbRsp
);
struct
SCatalog
*
pCatalog
=
NULL
;
...
...
@@ -212,7 +213,11 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
tDeserializeSUseDbRsp
(
pMsg
->
pData
,
pMsg
->
len
,
&
usedbRsp
);
if
(
strlen
(
usedbRsp
.
db
)
==
0
)
{
return
TSDB_CODE_MND_DB_NOT_EXIST
;
if
(
usedbRsp
.
errCode
!=
0
)
{
return
usedbRsp
.
errCode
;
}
else
{
return
TSDB_CODE_APP_ERROR
;
}
}
SName
name
=
{
0
};
...
...
source/common/src/tmsg.c
浏览文件 @
75d7ae5a
...
...
@@ -2489,6 +2489,7 @@ int32_t tSerializeSUseDbRspImp(SEncoder *pEncoder, const SUseDbRsp *pRsp) {
if
(
tEncodeI32
(
pEncoder
,
pVgInfo
->
numOfTable
)
<
0
)
return
-
1
;
}
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
errCode
)
<
0
)
return
-
1
;
return
0
;
}
...
...
@@ -2553,6 +2554,7 @@ int32_t tDeserializeSUseDbRspImp(SDecoder *pDecoder, SUseDbRsp *pRsp) {
taosArrayPush
(
pRsp
->
pVgroupInfos
,
&
vgInfo
);
}
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
errCode
)
<
0
)
return
-
1
;
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
75d7ae5a
...
...
@@ -285,8 +285,17 @@ static inline int32_t mndGetGlobalVgroupVersion(SMnode *pMnode) {
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
const
char
*
db
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDbObj
*
pDb
=
sdbAcquire
(
pSdb
,
SDB_DB
,
db
);
if
(
pDb
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
if
(
pDb
==
NULL
)
{
if
(
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
}
else
if
(
terrno
==
TSDB_CODE_SDB_OBJ_CREATING
)
{
terrno
=
TSDB_CODE_MND_DB_IN_CREATING
;
}
else
if
(
terrno
==
TSDB_CODE_SDB_OBJ_DROPPING
)
{
terrno
=
TSDB_CODE_MND_DB_IN_DROPPING
;
}
else
{
terrno
=
TSDB_CODE_APP_ERROR
;
mFatal
(
"db:%s, failed to acquire db since %s"
,
db
,
terrstr
());
}
}
return
pDb
;
}
...
...
@@ -594,16 +603,22 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
terrno
=
TSDB_CODE_MND_DB_ALREADY_EXIST
;
goto
_OVER
;
}
}
else
if
(
terrno
==
TSDB_CODE_SDB_OBJ_CREATING
)
{
if
(
mndSetRpcInfoForDbTrans
(
pMnode
,
pReq
,
MND_OPER_CREATE_DB
,
createReq
.
db
)
==
0
)
{
mInfo
(
"db:%s, is creating and response after trans finished"
,
createReq
.
db
);
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
}
else
{
if
(
terrno
==
TSDB_CODE_MND_DB_IN_CREATING
)
{
if
(
mndSetRpcInfoForDbTrans
(
pMnode
,
pReq
,
MND_OPER_CREATE_DB
,
createReq
.
db
)
==
0
)
{
mInfo
(
"db:%s, is creating and response after trans finished"
,
createReq
.
db
);
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
goto
_OVER
;
}
else
{
goto
_OVER
;
}
}
else
if
(
terrno
==
TSDB_CODE_MND_DB_IN_DROPPING
)
{
goto
_OVER
;
}
else
{
}
else
if
(
terrno
==
TSDB_CODE_MND_DB_NOT_EXIST
)
{
// continue
}
else
{
// TSDB_CODE_APP_ERROR
goto
_OVER
;
}
}
else
if
(
terrno
!=
TSDB_CODE_MND_DB_NOT_EXIST
)
{
goto
_OVER
;
}
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
info
.
conn
.
user
);
...
...
@@ -786,7 +801,6 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
pDb
=
mndAcquireDb
(
pMnode
,
alterReq
.
db
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
goto
_OVER
;
}
...
...
@@ -836,7 +850,6 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
pDb
=
mndAcquireDb
(
pMnode
,
cfgReq
.
db
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
goto
_OVER
;
}
...
...
@@ -1066,11 +1079,8 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
if
(
pDb
==
NULL
)
{
if
(
dropReq
.
ignoreNotExists
)
{
code
=
mndBuildDropDbRsp
(
pDb
,
&
pReq
->
info
.
rspLen
,
&
pReq
->
info
.
rsp
,
true
);
goto
_OVER
;
}
else
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
goto
_OVER
;
}
goto
_OVER
;
}
if
(
mndCheckDbPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_DROP_DB
,
pDb
)
!=
0
)
{
...
...
@@ -1197,10 +1207,7 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
int32_t
vgVersion
=
mndGetGlobalVgroupVersion
(
pMnode
);
if
(
usedbReq
.
vgVersion
<
vgVersion
)
{
usedbRsp
.
pVgroupInfos
=
taosArrayInit
(
10
,
sizeof
(
SVgroupInfo
));
if
(
usedbRsp
.
pVgroupInfos
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
if
(
usedbRsp
.
pVgroupInfos
==
NULL
)
goto
_OVER
;
mndBuildDBVgroupInfo
(
NULL
,
pMnode
,
usedbRsp
.
pVgroupInfos
);
usedbRsp
.
vgVersion
=
vgVersion
++
;
...
...
@@ -1209,16 +1216,13 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
}
usedbRsp
.
vgNum
=
taosArrayGetSize
(
usedbRsp
.
pVgroupInfos
);
code
=
0
;
// no jump, need to construct rsp
}
else
{
pDb
=
mndAcquireDb
(
pMnode
,
usedbReq
.
db
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
memcpy
(
usedbRsp
.
db
,
usedbReq
.
db
,
TSDB_DB_FNAME_LEN
);
usedbRsp
.
uid
=
usedbReq
.
dbId
;
usedbRsp
.
vgVersion
=
usedbReq
.
vgVersion
;
usedbRsp
.
errCode
=
terrno
;
mError
(
"db:%s, failed to process use db req since %s"
,
usedbReq
.
db
,
terrstr
());
}
else
{
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
75d7ae5a
...
...
@@ -287,9 +287,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
memcpy
(
pObj
->
sourceDb
,
pCreate
->
sourceDB
,
TSDB_DB_FNAME_LEN
);
SDbObj
*
pSourceDb
=
mndAcquireDb
(
pMnode
,
pCreate
->
sourceDB
);
if
(
pSourceDb
==
NULL
)
{
/*ASSERT(0);*/
mInfo
(
"stream:%s failed to create, source db %s not exist"
,
pCreate
->
name
,
pObj
->
sourceDb
);
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
mInfo
(
"stream:%s failed to create, source db %s not exist since %s"
,
pCreate
->
name
,
pObj
->
sourceDb
,
terrstr
());
return
-
1
;
}
pObj
->
sourceDbUid
=
pSourceDb
->
uid
;
...
...
@@ -298,8 +296,7 @@ static int32_t mndBuildStreamObjFromCreateReq(SMnode *pMnode, SStreamObj *pObj,
SDbObj
*
pTargetDb
=
mndAcquireDbByStb
(
pMnode
,
pObj
->
targetSTbName
);
if
(
pTargetDb
==
NULL
)
{
mInfo
(
"stream:%s failed to create, target db %s not exist"
,
pCreate
->
name
,
pObj
->
targetDb
);
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
mInfo
(
"stream:%s failed to create, target db %s not exist since %s"
,
pCreate
->
name
,
pObj
->
targetDb
,
terrstr
());
return
-
1
;
}
tstrncpy
(
pObj
->
targetDb
,
pTargetDb
->
name
,
TSDB_DB_FNAME_LEN
);
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
75d7ae5a
...
...
@@ -538,7 +538,8 @@ typedef struct SCtgOperation {
(sizeof(STableMeta) + ((pMeta)->tableInfo.numOfTags + (pMeta)->tableInfo.numOfColumns) * sizeof(SSchema))
#define CTG_TABLE_NOT_EXIST(code) (code == CTG_ERR_CODE_TABLE_NOT_EXIST)
#define CTG_DB_NOT_EXIST(code) (code == TSDB_CODE_MND_DB_NOT_EXIST)
#define CTG_DB_NOT_EXIST(code) \
(code == TSDB_CODE_MND_DB_NOT_EXIST || code == TSDB_CODE_MND_DB_IN_CREATING || code == TSDB_CODE_MND_DB_IN_DROPPING)
#define ctgFatal(param, ...) qFatal("CTG:%p " param, pCtg, __VA_ARGS__)
#define ctgError(param, ...) qError("CTG:%p " param, pCtg, __VA_ARGS__)
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
75d7ae5a
...
...
@@ -2181,7 +2181,8 @@ static int32_t getTagsTableVgroupListImpl(STranslateContext* pCxt, SName* pTarge
if
(
TSDB_DB_NAME_T
==
pTargetName
->
type
)
{
int32_t
code
=
getDBVgInfoImpl
(
pCxt
,
pTargetName
,
pVgroupList
);
if
(
TSDB_CODE_MND_DB_NOT_EXIST
==
code
)
{
if
(
TSDB_CODE_MND_DB_NOT_EXIST
==
code
||
TSDB_CODE_MND_DB_IN_CREATING
==
code
||
TSDB_CODE_MND_DB_IN_DROPPING
==
code
)
{
code
=
TSDB_CODE_SUCCESS
;
}
return
code
;
...
...
@@ -2196,7 +2197,8 @@ static int32_t getTagsTableVgroupListImpl(STranslateContext* pCxt, SName* pTarge
}
else
{
taosArrayPush
(
*
pVgroupList
,
&
vgInfo
);
}
}
else
if
(
TSDB_CODE_MND_DB_NOT_EXIST
==
code
)
{
}
else
if
(
TSDB_CODE_MND_DB_NOT_EXIST
==
code
||
TSDB_CODE_MND_DB_IN_CREATING
==
code
||
TSDB_CODE_MND_DB_IN_DROPPING
==
code
)
{
code
=
TSDB_CODE_SUCCESS
;
}
return
code
;
...
...
source/util/src/tarray.c
浏览文件 @
75d7ae5a
...
...
@@ -26,12 +26,14 @@ SArray* taosArrayInit(size_t size, size_t elemSize) {
SArray
*
pArray
=
taosMemoryMalloc
(
sizeof
(
SArray
));
if
(
pArray
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
pArray
->
size
=
0
;
pArray
->
pData
=
taosMemoryCalloc
(
size
,
elemSize
);
if
(
pArray
->
pData
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
taosMemoryFree
(
pArray
);
return
NULL
;
}
...
...
source/util/src/terror.c
浏览文件 @
75d7ae5a
...
...
@@ -225,11 +225,13 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_ALREADY_EXIST, "Database already exis
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_OPTION
,
"Invalid database options"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB
,
"Invalid database name"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_DATABASES
,
"Too many databases for account"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_IN_DROPPING
,
"Database in dropping status"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_NOT_EXIST
,
"Database not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_DB_ACCT
,
"Invalid database account"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_OPTION_UNCHANGED
,
"Database options not changed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_INDEX_NOT_EXIST
,
"Index not exist"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_INVALID_SYS_TABLENAME
,
"Invalid system table name"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_DB_IN_CREATING
,
"Database in creating status"
)
// mnode-node
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MNODE_ALREADY_EXIST
,
"Mnode already exists"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录