Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
fc82a732
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看板
提交
fc82a732
编写于
6月 13, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-570] add dnode into sdb write queue
上级
585d95e9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
43 addition
and
58 deletion
+43
-58
src/mnode/inc/mnodeDnode.h
src/mnode/inc/mnodeDnode.h
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+12
-13
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+19
-34
src/mnode/src/mnodeUser.c
src/mnode/src/mnodeUser.c
+11
-10
未找到文件。
src/mnode/inc/mnodeDnode.h
浏览文件 @
fc82a732
...
...
@@ -47,7 +47,7 @@ void mnodeDecDnodeRef(SDnodeObj *pDnode);
void
*
mnodeGetDnode
(
int32_t
dnodeId
);
void
*
mnodeGetDnodeByEp
(
char
*
ep
);
void
mnodeUpdateDnode
(
SDnodeObj
*
pDnode
);
int32_t
mnodeDropDnode
(
SDnodeObj
*
pDnode
);
int32_t
mnodeDropDnode
(
SDnodeObj
*
pDnode
,
void
*
pMsg
);
extern
int32_t
tsAccessSquence
;
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
fc82a732
...
...
@@ -366,12 +366,13 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs
code
=
sdbInsertRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pDb
);
return
code
;
tfree
(
pDb
);;
}
else
{
mLPrint
(
"db:%s, is created by %s"
,
pDb
->
name
,
mnodeGetUserFromMsg
(
pMsg
));
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
pMsg
!=
NULL
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
code
;
}
bool
mnodeCheckIsMonitorDB
(
char
*
db
,
char
*
monitordb
)
{
...
...
@@ -931,15 +932,13 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SCMAlterDbMsg *pAlter, void *pMsg) {
.
cb
=
mnodeAlterDbCb
};
int32_t
code
=
sdbUpdateRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
else
{
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
code
=
sdbUpdateRow
(
&
oper
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
pMsg
!=
NULL
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
}
return
TSDB_CODE_SUCCESS
;
return
code
;
}
static
int32_t
mnodeProcessAlterDbMsg
(
SMnodeMsg
*
pMsg
)
{
...
...
@@ -967,12 +966,12 @@ static int32_t mnodeDropDb(SMnodeMsg *pMsg) {
};
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
else
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
mLPrint
(
"db:%s, is dropped by %s"
,
pDb
->
name
,
mnodeGetUserFromMsg
(
pMsg
));
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
pMsg
!=
NULL
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
code
;
}
static
int32_t
mnodeProcessDropDbMsg
(
SMnodeMsg
*
pMsg
)
{
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
fc82a732
...
...
@@ -44,7 +44,7 @@ static int32_t tsDnodeUpdateSize = 0;
extern
void
*
tsMnodeSdb
;
extern
void
*
tsVgroupSdb
;
static
int32_t
mnodeCreateDnode
(
char
*
ep
);
static
int32_t
mnodeCreateDnode
(
char
*
ep
,
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeProcessCreateDnodeMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeProcessDropDnodeMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mnodeProcessCfgDnodeMsg
(
SMnodeMsg
*
pMsg
);
...
...
@@ -118,7 +118,7 @@ static int32_t mnodeDnodeActionRestored() {
int32_t
numOfRows
=
sdbGetNumOfRows
(
tsDnodeSdb
);
if
(
numOfRows
<=
0
&&
dnodeIsFirstDeploy
())
{
mPrint
(
"dnode first deploy, create dnode:%s"
,
tsLocalEp
);
mnodeCreateDnode
(
tsLocalEp
);
mnodeCreateDnode
(
tsLocalEp
,
NULL
);
SDnodeObj
*
pDnode
=
mnodeGetDnodeByEp
(
tsLocalEp
);
mnodeAddMnode
(
pDnode
->
dnodeId
);
mnodeDecDnodeRef
(
pDnode
);
...
...
@@ -369,7 +369,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mnodeCreateDnode
(
char
*
ep
)
{
static
int32_t
mnodeCreateDnode
(
char
*
ep
,
SMnodeMsg
*
pMsg
)
{
int32_t
grantCode
=
grantCheck
(
TSDB_GRANT_DNODE
);
if
(
grantCode
!=
TSDB_CODE_SUCCESS
)
{
return
grantCode
;
...
...
@@ -393,7 +393,8 @@ static int32_t mnodeCreateDnode(char *ep) {
.
type
=
SDB_OPER_GLOBAL
,
.
table
=
tsDnodeSdb
,
.
pObj
=
pDnode
,
.
rowSize
=
sizeof
(
SDnodeObj
)
.
rowSize
=
sizeof
(
SDnodeObj
),
.
pMsg
=
pMsg
};
int32_t
code
=
sdbInsertRow
(
&
oper
);
...
...
@@ -401,30 +402,32 @@ static int32_t mnodeCreateDnode(char *ep) {
int
dnodeId
=
pDnode
->
dnodeId
;
tfree
(
pDnode
);
mError
(
"failed to create dnode:%d, result:%s"
,
dnodeId
,
tstrerror
(
code
));
return
TSDB_CODE_MND_SDB_ERROR
;
}
else
{
mPrint
(
"dnode:%d is created, result:%s"
,
pDnode
->
dnodeId
,
tstrerror
(
code
));
if
(
pMsg
!=
NULL
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
mPrint
(
"dnode:%d is created, result:%s"
,
pDnode
->
dnodeId
,
tstrerror
(
code
));
return
code
;
}
int32_t
mnodeDropDnode
(
SDnodeObj
*
pDnode
)
{
int32_t
mnodeDropDnode
(
SDnodeObj
*
pDnode
,
void
*
pMsg
)
{
SSdbOper
oper
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
table
=
tsDnodeSdb
,
.
pObj
=
pDnode
.
pObj
=
pDnode
,
.
pMsg
=
pMsg
};
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_MND_SDB_ERROR
;
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
mLPrint
(
"dnode:%d, is dropped from cluster, result:%s"
,
pDnode
->
dnodeId
,
tstrerror
(
code
));
if
(
pMsg
!=
NULL
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
mLPrint
(
"dnode:%d, is dropped from cluster, result:%s"
,
pDnode
->
dnodeId
,
tstrerror
(
code
));
return
code
;
}
static
int32_t
mnodeDropDnodeByEp
(
char
*
ep
)
{
static
int32_t
mnodeDropDnodeByEp
(
char
*
ep
,
SMnodeMsg
*
pMsg
)
{
SDnodeObj
*
pDnode
=
mnodeGetDnodeByEp
(
ep
);
if
(
pDnode
==
NULL
)
{
mError
(
"dnode:%s, is not exist"
,
ep
);
...
...
@@ -439,7 +442,7 @@ static int32_t mnodeDropDnodeByEp(char *ep) {
mPrint
(
"dnode:%d, start to drop it"
,
pDnode
->
dnodeId
);
#ifndef _SYNC
return
mnodeDropDnode
(
pDnode
);
return
mnodeDropDnode
(
pDnode
,
pMsg
);
#else
return
balanceDropDnode
(
pDnode
);
#endif
...
...
@@ -451,17 +454,7 @@ static int32_t mnodeProcessCreateDnodeMsg(SMnodeMsg *pMsg) {
if
(
strcmp
(
pMsg
->
pUser
->
user
,
"root"
)
!=
0
)
{
return
TSDB_CODE_MND_NO_RIGHTS
;
}
else
{
int32_t
code
=
mnodeCreateDnode
(
pCreate
->
ep
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
SDnodeObj
*
pDnode
=
mnodeGetDnodeByEp
(
pCreate
->
ep
);
mLPrint
(
"dnode:%d, %s is created by %s"
,
pDnode
->
dnodeId
,
pCreate
->
ep
,
pMsg
->
pUser
->
user
);
mnodeDecDnodeRef
(
pDnode
);
}
else
{
mError
(
"failed to create dnode:%s, reason:%s"
,
pCreate
->
ep
,
tstrerror
(
code
));
}
return
code
;
return
mnodeCreateDnode
(
pCreate
->
ep
,
pMsg
);
}
}
...
...
@@ -471,15 +464,7 @@ static int32_t mnodeProcessDropDnodeMsg(SMnodeMsg *pMsg) {
if
(
strcmp
(
pMsg
->
pUser
->
user
,
"root"
)
!=
0
)
{
return
TSDB_CODE_MND_NO_RIGHTS
;
}
else
{
int32_t
code
=
mnodeDropDnodeByEp
(
pDrop
->
ep
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
mLPrint
(
"dnode:%s is dropped by %s"
,
pDrop
->
ep
,
pMsg
->
pUser
->
user
);
}
else
{
mError
(
"failed to drop dnode:%s, reason:%s"
,
pDrop
->
ep
,
tstrerror
(
code
));
}
return
code
;
return
mnodeDropDnodeByEp
(
pDrop
->
ep
,
pMsg
);
}
}
...
...
src/mnode/src/mnodeUser.c
浏览文件 @
fc82a732
...
...
@@ -181,12 +181,12 @@ static int32_t mnodeUpdateUser(SUserObj *pUser, void *pMsg) {
};
int32_t
code
=
sdbUpdateRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
else
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
mLPrint
(
"user:%s, is altered by %s"
,
pUser
->
user
,
mnodeGetUserFromMsg
(
pMsg
));
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
pMsg
!=
NULL
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
code
;
}
int32_t
mnodeCreateUser
(
SAcctObj
*
pAcct
,
char
*
name
,
char
*
pass
,
void
*
pMsg
)
{
...
...
@@ -237,11 +237,12 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass, void *pMsg) {
code
=
sdbInsertRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
pUser
);
return
code
;
}
else
{
mLPrint
(
"user:%s, is created by %s"
,
pUser
->
user
,
mnodeGetUserFromMsg
(
pMsg
));
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
pMsg
!=
NULL
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
code
;
}
static
int32_t
mnodeDropUser
(
SUserObj
*
pUser
,
void
*
pMsg
)
{
...
...
@@ -253,12 +254,12 @@ static int32_t mnodeDropUser(SUserObj *pUser, void *pMsg) {
};
int32_t
code
=
sdbDeleteRow
(
&
oper
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
else
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
mLPrint
(
"user:%s, is dropped by %s"
,
pUser
->
user
,
mnodeGetUserFromMsg
(
pMsg
));
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
if
(
pMsg
!=
NULL
)
code
=
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
return
code
;
}
static
int32_t
mnodeGetUserMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录