Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a878b3ed
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a878b3ed
编写于
5月 23, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: commit log should not be null
上级
d85d6d3f
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
51 addition
and
44 deletion
+51
-44
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/dnode/mnode/impl/inc/mndTopic.h
source/dnode/mnode/impl/inc/mndTopic.h
+1
-1
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+1
-1
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+8
-8
source/dnode/mnode/impl/src/mndOffset.c
source/dnode/mnode/impl/src/mndOffset.c
+2
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+1
-3
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+4
-4
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+1
-1
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+13
-13
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+6
-0
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+12
-12
source/util/src/terror.c
source/util/src/terror.c
+1
-0
未找到文件。
include/util/taoserror.h
浏览文件 @
a878b3ed
...
...
@@ -253,6 +253,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_TRANS_INVALID_STAGE TAOS_DEF_ERROR_CODE(0, 0x03D2)
#define TSDB_CODE_MND_TRANS_CONFLICT TAOS_DEF_ERROR_CODE(0, 0x03D3)
#define TSDB_CODE_MND_TRANS_UNKNOW_ERROR TAOS_DEF_ERROR_CODE(0, 0x03D4)
#define TSDB_CODE_MND_TRANS_CLOG_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x03D5)
// mnode-mq
#define TSDB_CODE_MND_TOPIC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E0)
...
...
source/dnode/mnode/impl/inc/mndTopic.h
浏览文件 @
a878b3ed
...
...
@@ -35,7 +35,7 @@ int32_t mndDropTopicByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb);
const
char
*
mndTopicGetShowName
(
const
char
topic
[
TSDB_TOPIC_FNAME_LEN
]);
int32_t
mndSetTopic
Redo
Logs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
);
int32_t
mndSetTopic
Commit
Logs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
a878b3ed
...
...
@@ -419,7 +419,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
SMqTopicObj
topicObj
=
{
0
};
memcpy
(
&
topicObj
,
pTopic
,
sizeof
(
SMqTopicObj
));
topicObj
.
refConsumerCnt
=
pTopic
->
refConsumerCnt
+
1
;
if
(
mndSetTopic
Redo
Logs
(
pMnode
,
pTrans
,
&
topicObj
)
!=
0
)
goto
SUBSCRIBE_OVER
;
if
(
mndSetTopic
Commit
Logs
(
pMnode
,
pTrans
,
&
topicObj
)
!=
0
)
goto
SUBSCRIBE_OVER
;
mndReleaseTopic
(
pMnode
,
pTopic
);
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
a878b3ed
...
...
@@ -448,13 +448,13 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
}
mDebug
(
"trans:%d, used to create dnode:%s"
,
pTrans
->
id
,
dnodeObj
.
ep
);
SSdbRaw
*
p
Redo
Raw
=
mndDnodeActionEncode
(
&
dnodeObj
);
if
(
p
RedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedo
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
redo
log since %s"
,
pTrans
->
id
,
terrstr
());
SSdbRaw
*
p
Commit
Raw
=
mndDnodeActionEncode
(
&
dnodeObj
);
if
(
p
CommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommit
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
commit
log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_READY
);
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_READY
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
...
...
@@ -524,13 +524,13 @@ static int32_t mndDropDnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode) {
}
mDebug
(
"trans:%d, used to drop dnode:%d"
,
pTrans
->
id
,
pDnode
->
id
);
SSdbRaw
*
p
Redo
Raw
=
mndDnodeActionEncode
(
pDnode
);
if
(
p
RedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedo
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
redo
log since %s"
,
pTrans
->
id
,
terrstr
());
SSdbRaw
*
p
Commit
Raw
=
mndDnodeActionEncode
(
pDnode
);
if
(
p
CommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommit
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
commit
log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_DROPPED
);
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_DROPPED
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
...
...
source/dnode/mnode/impl/src/mndOffset.c
浏览文件 @
a878b3ed
...
...
@@ -153,6 +153,7 @@ int32_t mndCreateOffsets(STrans *pTrans, const char *cgroup, const char *topicNa
return
-
1
;
}
sdbSetRawStatus
(
pOffsetRaw
,
SDB_STATUS_READY
);
// commit log or redo log?
if
(
mndTransAppendRedolog
(
pTrans
,
pOffsetRaw
)
<
0
)
{
return
-
1
;
}
...
...
@@ -188,7 +189,7 @@ static int32_t mndProcessCommitOffsetReq(SRpcMsg *pMsg) {
pOffsetObj
->
offset
=
pOffset
->
offset
;
SSdbRaw
*
pOffsetRaw
=
mndOffsetActionEncode
(
pOffsetObj
);
sdbSetRawStatus
(
pOffsetRaw
,
SDB_STATUS_READY
);
mndTransAppend
Redo
log
(
pTrans
,
pOffsetRaw
);
mndTransAppend
Commit
log
(
pTrans
,
pOffsetRaw
);
if
(
create
)
{
taosMemoryFree
(
pOffsetObj
);
}
else
{
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
a878b3ed
...
...
@@ -743,9 +743,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
mDebug
(
"trans:%d, used to create stb:%s"
,
pTrans
->
id
,
pCreate
->
name
);
if
(
mndBuildStbFromReq
(
pMnode
,
&
stbObj
,
pCreate
,
pDb
)
!=
0
)
{
goto
_OVER
;
}
if
(
mndBuildStbFromReq
(
pMnode
,
&
stbObj
,
pCreate
,
pDb
)
!=
0
)
goto
_OVER
;
if
(
mndAddStbToTrans
(
pMnode
,
pTrans
,
pDb
,
&
stbObj
)
<
0
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
a878b3ed
...
...
@@ -279,13 +279,13 @@ int32_t mndAddStreamToTrans(SMnode *pMnode, SStreamObj *pStream, const char *ast
}
mDebug
(
"trans:%d, used to create stream:%s"
,
pTrans
->
id
,
pStream
->
name
);
SSdbRaw
*
p
Redo
Raw
=
mndStreamActionEncode
(
pStream
);
if
(
p
RedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedo
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
redo
log since %s"
,
pTrans
->
id
,
terrstr
());
SSdbRaw
*
p
Commit
Raw
=
mndStreamActionEncode
(
pStream
);
if
(
p
CommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommit
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
commit
log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_READY
);
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_READY
);
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
a878b3ed
...
...
@@ -479,7 +479,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SRpcMsg *pMsg, const SMqRebOu
SMqTopicObj
topicObj
=
{
0
};
memcpy
(
&
topicObj
,
pTopic
,
sizeof
(
SMqTopicObj
));
topicObj
.
refConsumerCnt
=
pTopic
->
refConsumerCnt
-
consumerNum
;
if
(
mndSetTopic
Redo
Logs
(
pMnode
,
pTrans
,
&
topicObj
)
!=
0
)
goto
REB_FAIL
;
if
(
mndSetTopic
Commit
Logs
(
pMnode
,
pTrans
,
&
topicObj
)
!=
0
)
goto
REB_FAIL
;
}
}
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
a878b3ed
...
...
@@ -386,14 +386,14 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
}
mDebug
(
"trans:%d, used to create topic:%s"
,
pTrans
->
id
,
pCreate
->
name
);
SSdbRaw
*
p
Redo
Raw
=
mndTopicActionEncode
(
&
topicObj
);
if
(
p
RedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedo
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
redo
log since %s"
,
pTrans
->
id
,
terrstr
());
SSdbRaw
*
p
Commit
Raw
=
mndTopicActionEncode
(
&
topicObj
);
if
(
p
CommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommit
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
commit
log since %s"
,
pTrans
->
id
,
terrstr
());
taosMemoryFreeClear
(
topicObj
.
physicalPlan
);
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_READY
);
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_READY
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
...
...
@@ -473,13 +473,13 @@ CREATE_TOPIC_OVER:
}
static
int32_t
mndDropTopic
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SRpcMsg
*
pReq
,
SMqTopicObj
*
pTopic
)
{
SSdbRaw
*
p
Redo
Raw
=
mndTopicActionEncode
(
pTopic
);
if
(
p
RedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedo
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
redo
log since %s"
,
pTrans
->
id
,
terrstr
());
SSdbRaw
*
p
Commit
Raw
=
mndTopicActionEncode
(
pTopic
);
if
(
p
CommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommit
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
commit
log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_DROPPED
);
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_DROPPED
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
...
...
@@ -627,11 +627,11 @@ static int32_t mndRetrieveTopic(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
return
numOfRows
;
}
int32_t
mndSetTopic
Redo
Logs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
)
{
SSdbRaw
*
p
Redo
Raw
=
mndTopicActionEncode
(
pTopic
);
if
(
p
Redo
Raw
==
NULL
)
return
-
1
;
if
(
mndTransAppendCommitlog
(
pTrans
,
p
Redo
Raw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_READY
)
!=
0
)
return
-
1
;
int32_t
mndSetTopic
Commit
Logs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
)
{
SSdbRaw
*
p
Commit
Raw
=
mndTopicActionEncode
(
pTopic
);
if
(
p
Commit
Raw
==
NULL
)
return
-
1
;
if
(
mndTransAppendCommitlog
(
pTrans
,
p
Commit
Raw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_READY
)
!=
0
)
return
-
1
;
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
a878b3ed
...
...
@@ -768,6 +768,12 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
return
-
1
;
}
if
(
taosArrayGetSize
(
pTrans
->
commitLogs
)
<=
0
)
{
terrno
=
TSDB_CODE_MND_TRANS_CLOG_IS_NULL
;
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
return
-
1
;
}
mDebug
(
"trans:%d, prepare transaction"
,
pTrans
->
id
);
if
(
mndTransSync
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
a878b3ed
...
...
@@ -272,13 +272,13 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
}
mDebug
(
"trans:%d, used to create user:%s"
,
pTrans
->
id
,
pCreate
->
user
);
SSdbRaw
*
p
Redo
Raw
=
mndUserActionEncode
(
&
userObj
);
if
(
p
RedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedo
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to
append
redo log since %s"
,
pTrans
->
id
,
terrstr
());
SSdbRaw
*
p
Commit
Raw
=
mndUserActionEncode
(
&
userObj
);
if
(
p
CommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommit
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to
commit
redo log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_READY
);
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_READY
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
...
...
@@ -352,13 +352,13 @@ static int32_t mndAlterUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SRpc
}
mDebug
(
"trans:%d, used to alter user:%s"
,
pTrans
->
id
,
pOld
->
user
);
SSdbRaw
*
p
Redo
Raw
=
mndUserActionEncode
(
pNew
);
if
(
p
RedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedo
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
redo
log since %s"
,
pTrans
->
id
,
terrstr
());
SSdbRaw
*
p
Commit
Raw
=
mndUserActionEncode
(
pNew
);
if
(
p
CommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommit
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
commit
log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_READY
);
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_READY
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
...
...
@@ -559,13 +559,13 @@ static int32_t mndDropUser(SMnode *pMnode, SRpcMsg *pReq, SUserObj *pUser) {
}
mDebug
(
"trans:%d, used to drop user:%s"
,
pTrans
->
id
,
pUser
->
user
);
SSdbRaw
*
p
Redo
Raw
=
mndUserActionEncode
(
pUser
);
if
(
p
RedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedo
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
redo
log since %s"
,
pTrans
->
id
,
terrstr
());
SSdbRaw
*
p
Commit
Raw
=
mndUserActionEncode
(
pUser
);
if
(
p
CommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommit
Raw
)
!=
0
)
{
mError
(
"trans:%d, failed to append
commit
log since %s"
,
pTrans
->
id
,
terrstr
());
mndTransDrop
(
pTrans
);
return
-
1
;
}
sdbSetRawStatus
(
p
Redo
Raw
,
SDB_STATUS_DROPPED
);
sdbSetRawStatus
(
p
Commit
Raw
,
SDB_STATUS_DROPPED
);
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
{
mError
(
"trans:%d, failed to prepare since %s"
,
pTrans
->
id
,
terrstr
());
...
...
source/util/src/terror.c
浏览文件 @
a878b3ed
...
...
@@ -259,6 +259,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exist
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TRANS_INVALID_STAGE
,
"Invalid stage to kill"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TRANS_CONFLICT
,
"Conflict transaction not completed"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TRANS_UNKNOW_ERROR
,
"Unknown transaction error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TRANS_CLOG_IS_NULL
,
"Transaction commitlog is null"
)
// mnode-mq
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOPIC_ALREADY_EXIST
,
"Topic already exists"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录