Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ebd862de
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看板
提交
ebd862de
编写于
2月 18, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
trans type
上级
11c79d1b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
50 addition
and
27 deletion
+50
-27
source/dnode/mnode/impl/inc/mndDb.h
source/dnode/mnode/impl/inc/mndDb.h
+1
-0
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+31
-26
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+3
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+3
-0
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+12
-1
未找到文件。
source/dnode/mnode/impl/inc/mndDb.h
浏览文件 @
ebd862de
...
...
@@ -27,6 +27,7 @@ void mndCleanupDb(SMnode *pMnode);
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
const
char
*
db
);
void
mndReleaseDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
);
int32_t
mndValidateDbInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
pDbs
,
int32_t
numOfDbs
,
void
**
ppRsp
,
int32_t
*
pRspLen
);
char
*
mnGetDbStr
(
char
*
src
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
ebd862de
...
...
@@ -105,34 +105,39 @@ typedef enum {
}
ETrnStage
;
typedef
enum
{
TRN_TYPE_START
=
0
,
TRN_TYPE_CREATE_MNODE
=
1
,
TRN_TYPE_DROP_MNODE
=
2
,
TRN_TYPE_CREATE_DNODE
=
3
,
TRN_TYPE_DROP_DNODE
=
4
,
TRN_TYPE_CREATE_SNODE
=
5
,
TRN_TYPE_DROP_SNODE
=
6
,
TRN_TYPE_CREATE_QNODE
=
7
,
TRN_TYPE_DROP_QNODE
=
8
,
TRN_TYPE_CREATE_BNODE
=
9
,
TRN_TYPE_DROP_BNODE
=
10
,
TRN_TYPE_DB_START
=
1000
,
TRN_TYPE_CREATE_DB
=
1001
,
TRN_TYPE_ALTER_DB
=
1002
,
TRN_TYPE_DROP_DB
=
1003
,
TRN_TYPE_BASIC_SCOPE
=
1000
,
TRN_TYPE_CREATE_USER
=
1001
,
TRN_TYPE_ALTER_USER
=
1002
,
TRN_TYPE_DROP_USER
=
1003
,
TRN_TYPE_CREATE_FUNC
=
1004
,
TRN_TYPE_DROP_FUNC
=
1005
,
TRN_TYPE_CREATE_STB
=
1006
,
TRN_TYPE_ALTER_STB
=
1007
,
TRN_TYPE_DROP_STB
=
1008
,
TRN_TYPE_CREATE_TOPIC
=
1009
,
TRN_TYPE_DROP_TOPIC
=
1010
,
TRN_TYPE_CREATE_USER
=
1011
,
TRN_TYPE_ALTER_USER
=
1012
,
TRN_TYPE_DROP_USER
=
1013
,
TRN_TYPE_SUBSCRIBE
=
1014
,
TRN_TYPE_REBALANCE
=
1015
,
TRN_TYPE_MAX
,
TRN_TYPE_CREATE_SNODE
=
1006
,
TRN_TYPE_DROP_SNODE
=
1007
,
TRN_TYPE_CREATE_QNODE
=
1008
,
TRN_TYPE_DROP_QNODE
=
1009
,
TRN_TYPE_CREATE_BNODE
=
1010
,
TRN_TYPE_DROP_BNODE
=
1011
,
TRN_TYPE_CREATE_MNODE
=
1012
,
TRN_TYPE_DROP_MNODE
=
1013
,
TRN_TYPE_CREATE_TOPIC
=
1014
,
TRN_TYPE_DROP_TOPIC
=
1015
,
TRN_TYPE_SUBSCRIBE
=
1016
,
TRN_TYPE_REBALANCE
=
1017
,
TRN_TYPE_BASIC_SCOPE_END
,
TRN_TYPE_GLOBAL_SCOPE
=
2000
,
TRN_TYPE_CREATE_DNODE
=
2001
,
TRN_TYPE_DROP_DNODE
=
2002
,
TRN_TYPE_GLOBAL_SCOPE_END
,
TRN_TYPE_DB_SCOPE
=
3000
,
TRN_TYPE_CREATE_DB
=
3001
,
TRN_TYPE_ALTER_DB
=
3002
,
TRN_TYPE_DROP_DB
=
3003
,
TRN_TYPE_CREATE_STB
=
3004
,
TRN_TYPE_ALTER_STB
=
3005
,
TRN_TYPE_DROP_STB
=
3006
,
TRN_TYPE_SPLIT_VGROUP
=
3007
,
TRN_TYPE_MERGE_VGROUP
=
3018
,
TRN_TYPE_DB_SCOPE_END
,
}
ETrnType
;
typedef
enum
{
TRN_POLICY_ROLLBACK
=
0
,
TRN_POLICY_RETRY
=
1
}
ETrnPolicy
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
ebd862de
...
...
@@ -439,6 +439,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SMnodeMsg *pReq, SCreateDbReq *pCreat
mDebug
(
"trans:%d, used to create db:%s"
,
pTrans
->
id
,
pCreate
->
db
);
mndTransSetDbInfo
(
pTrans
,
&
dbObj
);
if
(
mndSetCreateDbRedoLogs
(
pMnode
,
pTrans
,
&
dbObj
,
pVgroups
)
!=
0
)
goto
CREATE_DB_OVER
;
if
(
mndSetCreateDbUndoLogs
(
pMnode
,
pTrans
,
&
dbObj
,
pVgroups
)
!=
0
)
goto
CREATE_DB_OVER
;
if
(
mndSetCreateDbCommitLogs
(
pMnode
,
pTrans
,
&
dbObj
,
pVgroups
)
!=
0
)
goto
CREATE_DB_OVER
;
...
...
@@ -625,6 +626,7 @@ static int32_t mndUpdateDb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pOld, SDbObj
mDebug
(
"trans:%d, used to update db:%s"
,
pTrans
->
id
,
pOld
->
name
);
mndTransSetDbInfo
(
pTrans
,
pOld
);
if
(
mndSetUpdateDbRedoLogs
(
pMnode
,
pTrans
,
pOld
,
pNew
)
!=
0
)
goto
UPDATE_DB_OVER
;
if
(
mndSetUpdateDbCommitLogs
(
pMnode
,
pTrans
,
pOld
,
pNew
)
!=
0
)
goto
UPDATE_DB_OVER
;
if
(
mndSetUpdateDbRedoActions
(
pMnode
,
pTrans
,
pOld
,
pNew
)
!=
0
)
goto
UPDATE_DB_OVER
;
...
...
@@ -803,6 +805,7 @@ static int32_t mndDropDb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pDb) {
if
(
pTrans
==
NULL
)
goto
DROP_DB_OVER
;
mDebug
(
"trans:%d, used to drop db:%s"
,
pTrans
->
id
,
pDb
->
name
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
if
(
mndSetDropDbRedoLogs
(
pMnode
,
pTrans
,
pDb
)
!=
0
)
goto
DROP_DB_OVER
;
if
(
mndSetDropDbCommitLogs
(
pMnode
,
pTrans
,
pDb
)
!=
0
)
goto
DROP_DB_OVER
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
ebd862de
...
...
@@ -534,6 +534,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SMnodeMsg *pReq, SMCreateStbReq *pCr
if
(
pTrans
==
NULL
)
goto
CREATE_STB_OVER
;
mDebug
(
"trans:%d, used to create stb:%s"
,
pTrans
->
id
,
pCreate
->
name
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
if
(
mndSetCreateStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
CREATE_STB_OVER
;
if
(
mndSetCreateStbUndoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
CREATE_STB_OVER
;
...
...
@@ -1025,6 +1026,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SMnodeMsg *pReq, const SMAltertbReq *
if
(
pTrans
==
NULL
)
goto
ALTER_STB_OVER
;
mDebug
(
"trans:%d, used to alter stb:%s"
,
pTrans
->
id
,
pAlter
->
name
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
if
(
mndSetAlterStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
ALTER_STB_OVER
;
if
(
mndSetAlterStbCommitLogs
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
!=
0
)
goto
ALTER_STB_OVER
;
...
...
@@ -1163,6 +1165,7 @@ static int32_t mndDropStb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pDb, SStbObj
if
(
pTrans
==
NULL
)
goto
DROP_STB_OVER
;
mDebug
(
"trans:%d, used to drop stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
if
(
mndSetDropStbRedoLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
DROP_STB_OVER
;
if
(
mndSetDropStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
DROP_STB_OVER
;
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
ebd862de
...
...
@@ -16,6 +16,7 @@
#define _DEFAULT_SOURCE
#include "mndTrans.h"
#include "mndAuth.h"
#include "mndDb.h"
#include "mndShow.h"
#include "mndSync.h"
#include "mndUser.h"
...
...
@@ -513,6 +514,11 @@ void mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen) {
pTrans
->
rpcRspLen
=
contLen
;
}
void
mndTransSetDbInfo
(
STrans
*
pTrans
,
SDbObj
*
pDb
)
{
pTrans
->
dbUid
=
pDb
->
uid
;
memcpy
(
pTrans
->
dbname
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
}
static
int32_t
mndTransSync
(
SMnode
*
pMnode
,
STrans
*
pTrans
)
{
SSdbRaw
*
pRaw
=
mndTransActionEncode
(
pTrans
);
if
(
pRaw
==
NULL
)
{
...
...
@@ -1199,7 +1205,12 @@ static int32_t mndRetrieveTrans(SMnodeMsg *pReq, SShowObj *pShow, char *data, in
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
STR_TO_VARSTR
(
pWrite
,
pTrans
->
dbname
);
char
*
name
=
mnGetDbStr
(
pTrans
->
dbname
);
if
(
name
!=
NULL
)
{
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
name
,
pShow
->
bytes
[
cols
]);
}
else
{
STR_TO_VARSTR
(
pWrite
,
"-"
);
}
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录