Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
36fd0dac
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看板
提交
36fd0dac
编写于
6月 05, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: add alter-confirm while alter db
上级
980e289c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
52 addition
and
14 deletion
+52
-14
include/util/taoserror.h
include/util/taoserror.h
+3
-3
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+19
-9
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+8
-1
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+1
-1
tests/script/tsim/db/alter_replica_31.sim
tests/script/tsim/db/alter_replica_31.sim
+21
-0
未找到文件。
include/util/taoserror.h
浏览文件 @
36fd0dac
...
...
@@ -40,9 +40,9 @@ int32_t* taosGetErrno();
#define TSDB_CODE_FAILED -1 // unknown or needn't tell detail error
//common & util
#define TSDB_CODE_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x000
1
)
#define TSDB_CODE_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x000
2
)
#define TSDB_CODE_APP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x000
3
)
#define TSDB_CODE_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x000
3
)
#define TSDB_CODE_APP_ERROR TAOS_DEF_ERROR_CODE(0, 0x000
4
)
#define TSDB_CODE_APP_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x000
5
)
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0010)
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0011)
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0012)
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
36fd0dac
...
...
@@ -118,25 +118,36 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
m
);
code
=
vnodePreprocessReq
(
pVnode
->
pImpl
,
pMsg
);
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
continue
;
if
(
code
!=
0
)
{
dError
(
"vgId:%d, msg:%p failed to write since %s"
,
pVnode
->
vgId
,
pMsg
,
tstrerror
(
code
));
vmSendRsp
(
pMsg
,
code
);
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
{
dTrace
(
"vgId:%d, msg:%p in progress and no rsp"
,
pVnode
->
vgId
,
pMsg
);
continue
;
}
code
=
syncPropose
(
sync
,
pMsg
,
false
);
if
(
pMsg
->
msgType
!=
TDMT_VND_ALTER_REPLICA
)
{
code
=
syncPropose
(
sync
,
pMsg
,
false
);
}
if
(
code
==
TAOS_SYNC_PROPOSE_SUCCESS
)
{
dTrace
(
"vgId:%d, msg:%p is proposed and no rsp"
,
pVnode
->
vgId
,
pMsg
);
continue
;
}
else
if
(
code
==
TAOS_SYNC_PROPOSE_NOT_LEADER
)
{
dTrace
(
"vgId:%d, msg:%p is redirect since not leader"
,
pVnode
->
vgId
,
pMsg
);
SEpSet
newEpSet
=
{
0
};
syncGetEpSet
(
sync
,
&
newEpSet
);
newEpSet
.
inUse
=
(
newEpSet
.
inUse
+
1
)
%
newEpSet
.
numOfEps
;
SEp
*
pEp
=
&
newEpSet
.
eps
[
newEpSet
.
inUse
];
if
(
pEp
->
port
==
tsServerPort
&&
strcmp
(
pEp
->
fqdn
,
tsLocalFqdn
)
==
0
)
{
newEpSet
.
inUse
=
(
newEpSet
.
inUse
+
1
)
%
newEpSet
.
numOfEps
;
}
dTrace
(
"vgId:%d, msg:%p is redirect since not leader, numOfEps:%d inUse:%d"
,
pVnode
->
vgId
,
pMsg
,
newEpSet
.
numOfEps
,
newEpSet
.
inUse
);
for
(
int32_t
i
=
0
;
i
<
newEpSet
.
numOfEps
;
++
i
)
{
dTrace
(
"vgId:%d, msg:%p ep:%s:%u"
,
pVnode
->
vgId
,
pMsg
,
newEpSet
.
eps
[
i
].
fqdn
,
newEpSet
.
eps
[
i
].
port
);
}
SRpcMsg
rsp
=
{.
code
=
TSDB_CODE_RPC_REDIRECT
,
.
info
=
pMsg
->
info
};
tmsgSendRedirectRsp
(
&
rsp
,
&
newEpSet
);
}
else
{
dError
(
"vgId:%d, msg:%p failed to
write since %s"
,
pVnode
->
vgId
,
pMsg
,
tstrerror
(
code
)
);
dError
(
"vgId:%d, msg:%p failed to
propose write since %s, code:0x%x"
,
pVnode
->
vgId
,
pMsg
,
tstrerror
(
code
),
code
);
vmSendRsp
(
pMsg
,
code
);
}
}
...
...
@@ -251,7 +262,6 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp
switch
(
qtype
)
{
case
QUERY_QUEUE
:
vnodePreprocessQueryMsg
(
pVnode
->
pImpl
,
pMsg
);
dTrace
(
"vgId:%d, msg:%p put into vnode-query queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
break
;
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
36fd0dac
...
...
@@ -870,8 +870,15 @@ static void mndTransResetActions(SMnode *pMnode, STrans *pTrans, SArray *pArray)
pAction
->
rawWritten
=
0
;
pAction
->
msgSent
=
0
;
pAction
->
msgReceived
=
0
;
if
(
pAction
->
errCode
==
TSDB_CODE_RPC_REDIRECT
)
{
pAction
->
epSet
.
inUse
=
(
pAction
->
epSet
.
inUse
+
1
)
%
pAction
->
epSet
.
numOfEps
;
mDebug
(
"trans:%d, %s:%d execute status is reset and set epset inuse:%d"
,
pTrans
->
id
,
mndTransStr
(
pAction
->
stage
),
action
,
pAction
->
epSet
.
inUse
);
}
else
{
mDebug
(
"trans:%d, %s:%d execute status is reset"
,
pTrans
->
id
,
mndTransStr
(
pAction
->
stage
),
action
);
}
pAction
->
errCode
=
0
;
mDebug
(
"trans:%d, %s:%d execute status is reset"
,
pTrans
->
id
,
mndTransStr
(
pAction
->
stage
),
action
);
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
36fd0dac
...
...
@@ -69,7 +69,7 @@ int32_t vnodeSyncAlter(SVnode *pVnode, SRpcMsg *pMsg) {
int32_t
code
=
syncReconfig
(
pVnode
->
sync
,
&
cfg
);
if
(
code
==
TAOS_SYNC_PROPOSE_SUCCESS
)
{
// todo refactor
SRpcMsg
rsp
=
{.
info
=
pMsg
->
info
,
.
code
=
terrno
};
SRpcMsg
rsp
=
{.
info
=
pMsg
->
info
,
.
code
=
0
};
tmsgSendRsp
(
&
rsp
);
return
TSDB_CODE_ACTION_IN_PROGRESS
;
}
...
...
tests/script/tsim/db/alter_replica_31.sim
浏览文件 @
36fd0dac
...
...
@@ -78,6 +78,15 @@ if $data(4)[2] != 1 then
endi
# v1_dnode
$hasleader = 0
$x = 0
step2:
$x = $x + 1
sleep 1000
if $x == 20 then
print ====> dnode not ready!
return -1
endi
sql show db.vgroups
print ===> $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08
if $data(2)[3] != 4 then
...
...
@@ -89,6 +98,18 @@ endi
if $data(2)[7] != 2 then
return -1
endi
if $data(2)[4] == leader then
$hasleader = 1
endi
if $data(2)[6] == leader then
$hasleader = 1
endi
if $data(2)[8] == leader then
$hasleader = 1
endi
if $hasleader != 1 then
goto step2
endi
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd"
sql create table db.ctb using db.stb tags(101, "102")
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录