Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4d40af99
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
4d40af99
编写于
4月 28, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add redirect
上级
23c69aff
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
26 addition
and
2 deletion
+26
-2
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-0
source/dnode/mgmt/implement/src/dmTransport.c
source/dnode/mgmt/implement/src/dmTransport.c
+10
-1
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+1
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+14
-0
未找到文件。
include/libs/sync/sync.h
浏览文件 @
4d40af99
...
...
@@ -150,6 +150,7 @@ ESyncState syncGetMyRole(int64_t rid);
const
char
*
syncGetMyRoleStr
(
int64_t
rid
);
SyncTerm
syncGetMyTerm
(
int64_t
rid
);
void
syncGetEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
int32_t
syncGetVgId
(
int64_t
rid
);
typedef
enum
{
TAOS_SYNC_PROPOSE_SUCCESS
=
0
,
...
...
source/dnode/mgmt/implement/src/dmTransport.c
浏览文件 @
4d40af99
...
...
@@ -310,7 +310,7 @@ static inline void dmSendRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
}
static
inline
void
dmSendRedirectRsp
(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
,
const
SEpSet
*
pNewEpSet
)
{
ASSERT
(
pRsp
->
code
==
TSDB_CODE_
NODE
_REDIRECT
);
ASSERT
(
pRsp
->
code
==
TSDB_CODE_
RPC
_REDIRECT
);
if
(
pWrapper
->
procType
!=
DND_PROC_CHILD
)
{
rpcSendRedirectRsp
(
pRsp
->
handle
,
pNewEpSet
);
}
else
{
...
...
@@ -402,6 +402,14 @@ SProcCfg dmGenProcCfg(SMgmtWrapper *pWrapper) {
return
cfg
;
}
bool
rpcRfp
(
int32_t
code
)
{
if
(
code
==
TSDB_CODE_RPC_REDIRECT
)
{
return
true
;
}
else
{
return
false
;
}
}
static
int32_t
dmInitClient
(
SDnode
*
pDnode
)
{
SDnodeTrans
*
pTrans
=
&
pDnode
->
trans
;
...
...
@@ -416,6 +424,7 @@ static int32_t dmInitClient(SDnode *pDnode) {
rpcInit
.
ckey
=
INTERNAL_CKEY
;
rpcInit
.
spi
=
1
;
rpcInit
.
parent
=
pDnode
;
rpcInit
.
rfp
=
rpcRfp
;
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)(
INTERNAL_SECRET
),
strlen
(
INTERNAL_SECRET
),
pass
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
4d40af99
...
...
@@ -151,7 +151,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
if
(
ret
==
TAOS_SYNC_PROPOSE_NOT_LEADER
)
{
// rsp.code = TSDB_CODE_SYN_NOT_LEADER;
// tmsgSendRsp(&rsp);
dTrace
(
"syncPropose not leader redirect, vgId:%d "
,
syncGetVgId
(
vnodeGetSyncHandle
(
pVnode
->
pImpl
)));
rsp
.
code
=
TSDB_CODE_RPC_REDIRECT
;
SEpSet
newEpSet
;
syncGetEpSet
(
vnodeGetSyncHandle
(
pVnode
->
pImpl
),
&
newEpSet
);
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
4d40af99
...
...
@@ -141,6 +141,18 @@ const char* syncGetMyRoleStr(int64_t rid) {
return
s
;
}
int32_t
syncGetVgId
(
int64_t
rid
)
{
SSyncNode
*
pSyncNode
=
(
SSyncNode
*
)
taosAcquireRef
(
tsNodeRefId
,
rid
);
if
(
pSyncNode
==
NULL
)
{
return
TAOS_SYNC_STATE_ERROR
;
}
assert
(
rid
==
pSyncNode
->
rid
);
int32_t
vgId
=
pSyncNode
->
vgId
;
taosReleaseRef
(
tsNodeRefId
,
pSyncNode
->
rid
);
return
vgId
;
}
SyncTerm
syncGetMyTerm
(
int64_t
rid
)
{
SSyncNode
*
pSyncNode
=
(
SSyncNode
*
)
taosAcquireRef
(
tsNodeRefId
,
rid
);
if
(
pSyncNode
==
NULL
)
{
...
...
@@ -278,6 +290,8 @@ void setHeartbeatTimerMS(int64_t rid, int32_t hbTimerMS) {
}
int32_t
syncPropose
(
int64_t
rid
,
const
SRpcMsg
*
pMsg
,
bool
isWeak
)
{
sTrace
(
"syncPropose msgType:%d "
,
pMsg
->
msgType
);
int32_t
ret
=
TAOS_SYNC_PROPOSE_SUCCESS
;
SSyncNode
*
pSyncNode
=
(
SSyncNode
*
)
taosAcquireRef
(
tsNodeRefId
,
rid
);
if
(
pSyncNode
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录