Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bc092d74
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看板
未验证
提交
bc092d74
编写于
12月 17, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
12月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18990 from taosdata/fix/TD-21299
fix: reduce drop dnode speed to make data more secure
上级
b8d65a53
ead5d8ed
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
11 deletion
+33
-11
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+9
-1
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+1
-1
source/libs/sync/src/syncRespMgr.c
source/libs/sync/src/syncRespMgr.c
+22
-8
未找到文件。
include/common/tmsg.h
浏览文件 @
bc092d74
...
...
@@ -68,7 +68,7 @@ typedef uint16_t tmsg_t;
static
inline
bool
vnodeIsMsgBlock
(
tmsg_t
type
)
{
return
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_ALTER_TABLE
)
||
(
type
==
TDMT_VND_DROP_TABLE
)
||
(
type
==
TDMT_VND_UPDATE_TAG_VAL
);
(
type
==
TDMT_VND_UPDATE_TAG_VAL
)
||
(
type
==
TDMT_VND_ALTER_CONFIRM
)
;
}
static
inline
bool
syncUtilUserCommit
(
tmsg_t
msgType
)
{
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
bc092d74
...
...
@@ -1126,8 +1126,12 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
}
if
(
!
force
)
{
#if 1
{
#else
if
(
newVg
.
replica
==
1
)
{
mInfo
(
"vgId:%d, will add 1 vnode, replca:1"
,
pVgroup
->
vgId
);
#endif
mInfo
(
"vgId:%d, will add 1 vnode, replca:%d"
,
pVgroup
->
vgId
,
newVg
.
replica
);
if
(
mndAddVnodeToVgroup
(
pMnode
,
pTrans
,
&
newVg
,
pArray
)
!=
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
newVg
.
replica
-
1
;
++
i
)
{
if
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
newVg
.
vnodeGid
[
i
].
dnodeId
)
!=
0
)
return
-
1
;
...
...
@@ -1155,6 +1159,9 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
if
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
newVg
.
vnodeGid
[
i
].
dnodeId
)
!=
0
)
return
-
1
;
}
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
)
!=
0
)
return
-
1
;
#if 1
}
#else
}
else
{
// new replica == 3
mInfo
(
"vgId:%d, will add 1 vnode, replca:3"
,
pVgroup
->
vgId
);
if
(
mndAddVnodeToVgroup
(
pMnode
,
pTrans
,
&
newVg
,
pArray
)
!=
0
)
return
-
1
;
...
...
@@ -1181,6 +1188,7 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
if
(
mndAddCreateVnodeAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
&
newVg
.
vnodeGid
[
vnIndex
])
!=
0
)
return
-
1
;
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
)
!=
0
)
return
-
1
;
}
#endif
}
else
{
mInfo
(
"vgId:%d, will add 1 vnode and force remove 1 vnode"
,
pVgroup
->
vgId
);
if
(
mndAddVnodeToVgroup
(
pMnode
,
pTrans
,
&
newVg
,
pArray
)
!=
0
)
return
-
1
;
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
bc092d74
...
...
@@ -233,7 +233,7 @@ int32_t syncSendTimeoutRsp(int64_t rid, int64_t seq) {
rpcSendResponse
(
&
rpcMsg
);
return
0
;
}
else
{
s
Info
(
"no rpcinfo
to send timeout response, seq:%"
PRId64
,
seq
);
s
Error
(
"no message handle
to send timeout response, seq:%"
PRId64
,
seq
);
return
-
1
;
}
}
...
...
source/libs/sync/src/syncRespMgr.c
浏览文件 @
bc092d74
...
...
@@ -35,11 +35,16 @@ SSyncRespMgr *syncRespMgrCreate(void *data, int64_t ttl) {
pObj
->
seqNum
=
0
;
taosThreadMutexInit
(
&
(
pObj
->
mutex
),
NULL
);
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, create resp manager"
,
pNode
->
vgId
);
return
pObj
;
}
void
syncRespMgrDestroy
(
SSyncRespMgr
*
pObj
)
{
if
(
pObj
!=
NULL
)
{
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, destroy resp manager"
,
pNode
->
vgId
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
taosHashCleanup
(
pObj
->
pRespHash
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
...
...
@@ -81,6 +86,8 @@ int32_t syncRespMgrGet(SSyncRespMgr *pObj, uint64_t seq, SRespStub *pStub) {
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
return
1
;
// get one object
}
else
{
sNError
(
pObj
->
data
,
"get message handle, no object of seq:%"
PRIu64
,
seq
);
}
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
...
...
@@ -99,6 +106,8 @@ int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t seq, SRpcHandleInfo *p
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
return
1
;
// get one object
}
else
{
sNError
(
pObj
->
data
,
"get-and-del message handle, no object of seq:%"
PRIu64
,
seq
);
}
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
...
...
@@ -114,7 +123,7 @@ static void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
SArray
*
delIndexArray
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
if
(
delIndexArray
==
NULL
)
return
;
sDebug
(
"vgId:%d, resp m
g
r begin clean by ttl"
,
pSyncNode
->
vgId
);
sDebug
(
"vgId:%d, resp m
anage
r begin clean by ttl"
,
pSyncNode
->
vgId
);
while
(
pStub
)
{
size_t
len
;
void
*
key
=
taosHashGetKey
(
pStub
,
&
len
);
...
...
@@ -143,34 +152,39 @@ static void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
// TODO: and make rpcMsg body, call commit cb
// pSyncNode->pFsm->FpCommitCb(pSyncNode->pFsm, &pStub->rpcMsg, cbMeta);
pStub
->
rpcMsg
.
code
=
TSDB_CODE_SYN_NOT_LEADER
;
if
(
pStub
->
rpcMsg
.
info
.
handle
!=
NULL
)
{
tmsgSendRsp
(
&
pStub
->
rpcMsg
);
}
SRpcMsg
rpcMsg
=
{.
info
=
pStub
->
rpcMsg
.
info
,
.
code
=
TSDB_CODE_SYN_TIMEOUT
};
sInfo
(
"vgId:%d, message handle:%p expired, type:%s ahandle:%p"
,
pSyncNode
->
vgId
,
rpcMsg
.
info
.
handle
,
TMSG_INFO
(
pStub
->
rpcMsg
.
msgType
),
rpcMsg
.
info
.
ahandle
);
rpcSendResponse
(
&
rpcMsg
);
}
pStub
=
taosHashIterate
(
pObj
->
pRespHash
,
pStub
);
}
int32_t
arraySize
=
taosArrayGetSize
(
delIndexArray
);
sDebug
(
"vgId:%d, resp m
g
r end clean by ttl, sum:%d, cnt:%d, array-size:%d"
,
pSyncNode
->
vgId
,
sum
,
cnt
,
arraySize
);
sDebug
(
"vgId:%d, resp m
anage
r end clean by ttl, sum:%d, cnt:%d, array-size:%d"
,
pSyncNode
->
vgId
,
sum
,
cnt
,
arraySize
);
for
(
int32_t
i
=
0
;
i
<
arraySize
;
++
i
)
{
uint64_t
*
pSeqNum
=
taosArrayGet
(
delIndexArray
,
i
);
taosHashRemove
(
pObj
->
pRespHash
,
pSeqNum
,
sizeof
(
uint64_t
));
sDebug
(
"vgId:%d, resp m
gr clean by ttl, seq:%"
PRId64
""
,
pSyncNode
->
vgId
,
*
pSeqNum
);
sDebug
(
"vgId:%d, resp m
anager clean by ttl, seq:%"
PRId64
,
pSyncNode
->
vgId
,
*
pSeqNum
);
}
taosArrayDestroy
(
delIndexArray
);
}
void
syncRespCleanRsp
(
SSyncRespMgr
*
pObj
)
{
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, clean all rsp"
,
pNode
->
vgId
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
syncRespCleanByTTL
(
pObj
,
-
1
,
true
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
}
void
syncRespClean
(
SSyncRespMgr
*
pObj
)
{
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, clean rsp by ttl"
,
pNode
->
vgId
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
syncRespCleanByTTL
(
pObj
,
pObj
->
ttl
,
false
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录