Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f8761bfc
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看板
未验证
提交
f8761bfc
编写于
7月 25, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
7月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #15398 from taosdata/fix/mnode
fix: can't drop db since transaction conflict
上级
b9e7eb9c
9650f0b3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
45 addition
and
26 deletion
+45
-26
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+2
-2
source/dnode/mnode/impl/src/mndOffset.c
source/dnode/mnode/impl/src/mndOffset.c
+5
-5
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+4
-3
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+6
-4
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+7
-4
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+19
-6
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+2
-2
未找到文件。
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
f8761bfc
...
...
@@ -164,8 +164,8 @@ typedef struct {
int32_t
lastErrorNo
;
tmsg_t
lastMsgType
;
SEpSet
lastEpset
;
char
dbname1
[
TSDB_
DB
_FNAME_LEN
];
char
dbname2
[
TSDB_
DB
_FNAME_LEN
];
char
dbname1
[
TSDB_
TABLE
_FNAME_LEN
];
char
dbname2
[
TSDB_
TABLE
_FNAME_LEN
];
int32_t
startFunc
;
int32_t
stopFunc
;
int32_t
paramLen
;
...
...
source/dnode/mnode/impl/src/mndOffset.c
浏览文件 @
f8761bfc
...
...
@@ -281,7 +281,7 @@ static int32_t mndSetDropOffsetRedoLogs(SMnode *pMnode, STrans *pTrans, SMqOffse
}
int32_t
mndDropOffsetByDB
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
)
{
int32_t
code
=
-
1
;
int32_t
code
=
0
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
...
...
@@ -297,15 +297,15 @@ int32_t mndDropOffsetByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
if
(
mndSetDropOffsetCommitLogs
(
pMnode
,
pTrans
,
pOffset
)
<
0
)
{
sdbRelease
(
pSdb
,
pOffset
);
goto
END
;
sdbCancelFetch
(
pSdb
,
pIter
);
code
=
-
1
;
break
;
}
sdbRelease
(
pSdb
,
pOffset
);
}
code
=
0
;
END:
return
code
;
return
code
;
}
int32_t
mndDropOffsetByTopic
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
const
char
*
topic
)
{
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
f8761bfc
...
...
@@ -641,6 +641,7 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
action
.
contLen
=
contLen
;
action
.
msgType
=
TDMT_VND_CREATE_STB
;
action
.
acceptableCode
=
TSDB_CODE_TDB_STB_ALREADY_EXIST
;
action
.
retryCode
=
TSDB_CODE_TDB_STB_NOT_EXIST
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
pReq
);
sdbCancelFetch
(
pSdb
,
pIter
);
...
...
@@ -805,7 +806,7 @@ _OVER:
}
int32_t
mndAddStbToTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
NULL
);
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
pStb
->
name
);
if
(
mndSetCreateStbRedoLogs
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
return
-
1
;
if
(
mndSetCreateStbUndoLogs
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
return
-
1
;
if
(
mndSetCreateStbCommitLogs
(
pMnode
,
pTrans
,
pDb
,
pStb
)
!=
0
)
return
-
1
;
...
...
@@ -1612,7 +1613,7 @@ static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbOb
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to alter stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
NULL
);
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
pStb
->
name
);
if
(
needRsp
)
{
void
*
pCont
=
NULL
;
...
...
@@ -1811,7 +1812,7 @@ static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *p
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
NULL
);
mndTransSetDbName
(
pTrans
,
pDb
->
name
,
pStb
->
name
);
if
(
mndSetDropStbRedoLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropStbCommitLogs
(
pMnode
,
pTrans
,
pStb
)
!=
0
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
f8761bfc
...
...
@@ -824,7 +824,7 @@ int32_t mndSetDropSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeObj
}
int32_t
mndDropSubByDB
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
)
{
int32_t
code
=
-
1
;
int32_t
code
=
0
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
...
...
@@ -840,12 +840,14 @@ int32_t mndDropSubByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
if
(
mndSetDropSubCommitLogs
(
pMnode
,
pTrans
,
pSub
)
<
0
)
{
sdbRelease
(
pSdb
,
pSub
);
goto
END
;
sdbCancelFetch
(
pSdb
,
pIter
);
code
=
-
1
;
break
;
}
sdbRelease
(
pSdb
,
pSub
);
}
code
=
0
;
END:
return
code
;
}
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
f8761bfc
...
...
@@ -833,7 +833,7 @@ static void mndCancelGetNextTopic(SMnode *pMnode, void *pIter) {
}
int32_t
mndDropTopicByDB
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
)
{
int32_t
code
=
-
1
;
int32_t
code
=
0
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
...
...
@@ -848,11 +848,14 @@ int32_t mndDropTopicByDB(SMnode *pMnode, STrans *pTrans, SDbObj *pDb) {
}
if
(
mndSetDropTopicCommitLogs
(
pMnode
,
pTrans
,
pTopic
)
<
0
)
{
goto
END
;
sdbRelease
(
pSdb
,
pTopic
);
sdbCancelFetch
(
pSdb
,
pIter
);
code
=
-
1
;
break
;
}
sdbRelease
(
pSdb
,
pTopic
);
}
code
=
0
;
END:
return
code
;
}
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
f8761bfc
...
...
@@ -127,8 +127,8 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
SDB_SET_INT8
(
pRaw
,
dataPos
,
0
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
0
,
_OVER
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pTrans
->
createdTime
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
dbname1
,
TSDB_
DB
_FNAME_LEN
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
dbname2
,
TSDB_
DB
_FNAME_LEN
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
dbname1
,
TSDB_
TABLE
_FNAME_LEN
,
_OVER
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
dbname2
,
TSDB_
TABLE
_FNAME_LEN
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTrans
->
redoActionPos
,
_OVER
)
int32_t
redoActionNum
=
taosArrayGetSize
(
pTrans
->
redoActions
);
...
...
@@ -290,8 +290,8 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
pTrans
->
exec
=
exec
;
pTrans
->
oper
=
oper
;
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pTrans
->
createdTime
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
dbname1
,
TSDB_
DB
_FNAME_LEN
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
dbname2
,
TSDB_
DB
_FNAME_LEN
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
dbname1
,
TSDB_
TABLE
_FNAME_LEN
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTrans
->
dbname2
,
TSDB_
TABLE
_FNAME_LEN
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTrans
->
redoActionPos
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
redoActionNum
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
undoActionNum
,
_OVER
)
...
...
@@ -727,10 +727,10 @@ int32_t mndSetRpcInfoForDbTrans(SMnode *pMnode, SRpcMsg *pMsg, EOperType oper, c
void
mndTransSetDbName
(
STrans
*
pTrans
,
const
char
*
dbname1
,
const
char
*
dbname2
)
{
if
(
dbname1
!=
NULL
)
{
memcpy
(
pTrans
->
dbname1
,
dbname1
,
TSDB_DB
_FNAME_LEN
);
tstrncpy
(
pTrans
->
dbname1
,
dbname1
,
TSDB_TABLE
_FNAME_LEN
);
}
if
(
dbname2
!=
NULL
)
{
memcpy
(
pTrans
->
dbname2
,
dbname2
,
TSDB_DB
_FNAME_LEN
);
tstrncpy
(
pTrans
->
dbname2
,
dbname2
,
TSDB_TABLE
_FNAME_LEN
);
}
}
...
...
@@ -1289,6 +1289,19 @@ static bool mndTransPerformRedoActionStage(SMnode *pMnode, STrans *pTrans) {
}
else
{
pTrans
->
code
=
terrno
;
if
(
pTrans
->
policy
==
TRN_POLICY_ROLLBACK
)
{
if
(
pTrans
->
lastAction
!=
0
)
{
STransAction
*
pAction
=
taosArrayGet
(
pTrans
->
redoActions
,
pTrans
->
lastAction
);
if
(
pAction
->
retryCode
!=
0
&&
pAction
->
retryCode
!=
pAction
->
errCode
)
{
if
(
pTrans
->
failedTimes
<
6
)
{
mError
(
"trans:%d, stage keep on redoAction since action:%d code:0x%x not 0x%x, failedTimes:%d"
,
pTrans
->
id
,
pTrans
->
lastAction
,
pTrans
->
code
,
pAction
->
retryCode
,
pTrans
->
failedTimes
);
taosMsleep
(
1000
);
continueExec
=
true
;
return
true
;
}
}
}
pTrans
->
stage
=
TRN_STAGE_ROLLBACK
;
mError
(
"trans:%d, stage from redoAction to rollback since %s"
,
pTrans
->
id
,
terrstr
());
continueExec
=
true
;
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
f8761bfc
...
...
@@ -178,7 +178,7 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
if
(
metaGetTableEntryByName
(
&
mr
,
pReq
->
name
)
==
0
)
{
// TODO: just for pass case
#if 0
terrno = TSDB_CODE_TDB_
TABLE
_ALREADY_EXIST;
terrno = TSDB_CODE_TDB_
STB
_ALREADY_EXIST;
metaReaderClear(&mr);
return -1;
#else
...
...
@@ -223,7 +223,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
// check if super table exists
rc
=
tdbTbGet
(
pMeta
->
pNameIdx
,
pReq
->
name
,
strlen
(
pReq
->
name
)
+
1
,
&
pData
,
&
nData
);
if
(
rc
<
0
||
*
(
tb_uid_t
*
)
pData
!=
pReq
->
suid
)
{
terrno
=
TSDB_CODE_
VND_TABLE
_NOT_EXIST
;
terrno
=
TSDB_CODE_
TDB_STB
_NOT_EXIST
;
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录