Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
19a16640
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看板
未验证
提交
19a16640
编写于
4月 26, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
4月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11880 from taosdata/feature/dnode
fix: set ready status while alterdb
上级
7cc35bd8
efff7760
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
50 addition
and
33 deletion
+50
-33
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+4
-0
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+1
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+1
-1
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+24
-12
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+1
-1
tests/script/tsim/snode/basic1.sim
tests/script/tsim/snode/basic1.sim
+19
-19
未找到文件。
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
19a16640
...
...
@@ -126,6 +126,8 @@ typedef enum {
DND_REASON_OTHERS
}
EDndReason
;
typedef
void
(
*
TransCbFp
)(
SMnode
*
pMnode
,
void
*
param
);
typedef
struct
{
int32_t
id
;
ETrnStage
stage
;
...
...
@@ -148,6 +150,8 @@ typedef struct {
int64_t
dbUid
;
char
dbname
[
TSDB_DB_FNAME_LEN
];
char
lastError
[
TSDB_TRANS_ERROR_LEN
];
TransCbFp
transCbFp
;
void
*
transCbParam
;
}
STrans
;
typedef
struct
{
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
19a16640
...
...
@@ -44,6 +44,7 @@ int32_t mndTransAppendCommitlog(STrans *pTrans, SSdbRaw *pRaw);
int32_t
mndTransAppendRedoAction
(
STrans
*
pTrans
,
STransAction
*
pAction
);
int32_t
mndTransAppendUndoAction
(
STrans
*
pTrans
,
STransAction
*
pAction
);
void
mndTransSetRpcRsp
(
STrans
*
pTrans
,
void
*
pCont
,
int32_t
contLen
);
void
mndTransSetCb
(
STrans
*
pTrans
,
TransCbFp
fp
,
void
*
param
);
void
mndTransSetDbInfo
(
STrans
*
pTrans
,
SDbObj
*
pDb
);
int32_t
mndTransPrepare
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
19a16640
...
...
@@ -620,7 +620,7 @@ static int32_t mndSetAlterDbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOl
SSdbRaw
*
pRedoRaw
=
mndDbActionEncode
(
pOld
);
if
(
pRedoRaw
==
NULL
)
return
-
1
;
if
(
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_
UPDATING
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_
READY
)
!=
0
)
return
-
1
;
return
0
;
}
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
19a16640
...
...
@@ -193,9 +193,9 @@ TRANS_ENCODE_OVER:
static
SSdbRow
*
mndTransActionDecode
(
SSdbRaw
*
pRaw
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
SSdbRow
*
pRow
=
NULL
;
STrans
*
pTrans
=
NULL
;
char
*
pData
=
NULL
;
SSdbRow
*
pRow
=
NULL
;
STrans
*
pTrans
=
NULL
;
char
*
pData
=
NULL
;
int32_t
dataLen
=
0
;
int8_t
sver
=
0
;
int32_t
redoLogNum
=
0
;
...
...
@@ -456,7 +456,7 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
}
static
STrans
*
mndAcquireTrans
(
SMnode
*
pMnode
,
int32_t
transId
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
STrans
*
pTrans
=
sdbAcquire
(
pSdb
,
SDB_TRANS
,
&
transId
);
if
(
pTrans
==
NULL
)
{
terrno
=
TSDB_CODE_MND_TRANS_NOT_EXIST
;
...
...
@@ -574,6 +574,11 @@ void mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen) {
pTrans
->
rpcRspLen
=
contLen
;
}
void
mndTransSetCb
(
STrans
*
pTrans
,
TransCbFp
fp
,
void
*
param
)
{
pTrans
->
transCbFp
=
fp
;
pTrans
->
transCbParam
=
param
;
}
void
mndTransSetDbInfo
(
STrans
*
pTrans
,
SDbObj
*
pDb
)
{
pTrans
->
dbUid
=
pDb
->
uid
;
memcpy
(
pTrans
->
dbname
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
...
...
@@ -626,7 +631,7 @@ static int32_t mndCheckTransCanBeStartedInParallel(SMnode *pMnode, STrans *pNewT
if
(
mndIsBasicTrans
(
pNewTrans
))
return
0
;
STrans
*
pTrans
=
NULL
;
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
int32_t
code
=
0
;
while
(
1
)
{
...
...
@@ -707,6 +712,8 @@ int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
pNew
->
rpcRefId
=
pTrans
->
rpcRefId
;
pNew
->
rpcRsp
=
pTrans
->
rpcRsp
;
pNew
->
rpcRspLen
=
pTrans
->
rpcRspLen
;
pNew
->
transCbFp
=
pTrans
->
transCbFp
;
pNew
->
transCbParam
=
pTrans
->
transCbParam
;
pTrans
->
rpcRsp
=
NULL
;
pTrans
->
rpcRspLen
=
0
;
...
...
@@ -830,7 +837,7 @@ HANDLE_ACTION_RSP_OVER:
}
static
int32_t
mndTransExecuteLogs
(
SMnode
*
pMnode
,
SArray
*
pArray
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
arraySize
=
taosArrayGetSize
(
pArray
);
if
(
arraySize
==
0
)
return
0
;
...
...
@@ -1117,6 +1124,11 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
}
mDebug
(
"trans:%d, finished, code:0x%04x, failedTimes:%d"
,
pTrans
->
id
,
pTrans
->
code
,
pTrans
->
failedTimes
);
if
(
pTrans
->
transCbFp
!=
NULL
)
{
(
*
pTrans
->
transCbFp
)(
pMnode
,
pTrans
->
transCbParam
);
}
return
continueExec
;
}
...
...
@@ -1205,11 +1217,11 @@ static int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans) {
}
static
int32_t
mndProcessKillTransReq
(
SNodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SMnode
*
pMnode
=
pReq
->
pNode
;
SKillTransReq
killReq
=
{
0
};
int32_t
code
=
-
1
;
SUserObj
*
pUser
=
NULL
;
STrans
*
pTrans
=
NULL
;
SUserObj
*
pUser
=
NULL
;
STrans
*
pTrans
=
NULL
;
if
(
tDeserializeSKillTransReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
killReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
...
...
@@ -1249,7 +1261,7 @@ KILL_OVER:
void
mndTransPullup
(
SMnode
*
pMnode
)
{
STrans
*
pTrans
=
NULL
;
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
pIter
=
sdbFetch
(
pMnode
->
pSdb
,
SDB_TRANS
,
pIter
,
(
void
**
)
&
pTrans
);
...
...
@@ -1264,11 +1276,11 @@ void mndTransPullup(SMnode *pMnode) {
static
int32_t
mndRetrieveTrans
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
STrans
*
pTrans
=
NULL
;
int32_t
cols
=
0
;
char
*
pWrite
;
char
*
pWrite
;
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_TRANS
,
pShow
->
pIter
,
(
void
**
)
&
pTrans
);
...
...
tests/script/sh/deploy.sh
浏览文件 @
19a16640
...
...
@@ -135,7 +135,7 @@ echo "qDebugFlag 143" >> $TAOS_CFG
echo
"rpcDebugFlag 143"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"uDebugFlag 143"
>>
$TAOS_CFG
echo
"sDebugFlag 1
43
"
>>
$TAOS_CFG
echo
"sDebugFlag 1
35
"
>>
$TAOS_CFG
echo
"wDebugFlag 143"
>>
$TAOS_CFG
echo
"numOfLogLines 20000000"
>>
$TAOS_CFG
echo
"statusInterval 1"
>>
$TAOS_CFG
...
...
tests/script/tsim/snode/basic1.sim
浏览文件 @
19a16640
...
...
@@ -75,46 +75,46 @@ if $data02 != LEADER then
return -1
endi
print =============== create drop
q
node 1
sql create
q
node on dnode 1
sql show
q
nodes
print =============== create drop
s
node 1
sql create
s
node on dnode 1
sql show
s
nodes
if $rows != 1 then
return -1
endi
if $data00 != 1 then
return -1
endi
sql_error create
q
node on dnode 1
sql_error create
s
node on dnode 1
sql drop
q
node on dnode 1
sql show
q
nodes
sql drop
s
node on dnode 1
sql show
s
nodes
if $rows != 0 then
return -1
endi
sql_error drop
q
node on dnode 1
sql_error drop
s
node on dnode 1
print =============== create drop
q
node 2
sql create
q
node on dnode 2
sql show
q
nodes
print =============== create drop
s
node 2
sql create
s
node on dnode 2
sql show
s
nodes
if $rows != 1 then
return -1
endi
if $data00 != 2 then
return -1
endi
sql_error create
q
node on dnode 2
sql_error create
s
node on dnode 2
sql drop
q
node on dnode 2
sql show
q
nodes
sql drop
s
node on dnode 2
sql show
s
nodes
if $rows != 0 then
return -1
endi
sql_error drop
q
node on dnode 2
sql_error drop
s
node on dnode 2
print =============== create drop
q
nodes
sql create
q
node on dnode 1
sql create
q
node on dnode 2
sql show
q
nodes
print =============== create drop
s
nodes
sql create
s
node on dnode 1
sql create
s
node on dnode 2
sql show
s
nodes
if $rows != 2 then
return -1
endi
...
...
@@ -126,7 +126,7 @@ system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
sleep 2000
sql show
q
nodes
sql show
s
nodes
if $rows != 2 then
return -1
endi
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录