Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ead5d8ed
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ead5d8ed
编写于
12月 17, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: reduce drop dnode speed makes data more secure
上级
191c4365
变更
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
浏览文件 @
ead5d8ed
...
@@ -68,7 +68,7 @@ typedef uint16_t tmsg_t;
...
@@ -68,7 +68,7 @@ typedef uint16_t tmsg_t;
static
inline
bool
vnodeIsMsgBlock
(
tmsg_t
type
)
{
static
inline
bool
vnodeIsMsgBlock
(
tmsg_t
type
)
{
return
(
type
==
TDMT_VND_CREATE_TABLE
)
||
(
type
==
TDMT_VND_ALTER_TABLE
)
||
(
type
==
TDMT_VND_DROP_TABLE
)
||
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
)
{
static
inline
bool
syncUtilUserCommit
(
tmsg_t
msgType
)
{
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
ead5d8ed
...
@@ -1126,8 +1126,12 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
...
@@ -1126,8 +1126,12 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
}
}
if
(
!
force
)
{
if
(
!
force
)
{
#if 1
{
#else
if
(
newVg
.
replica
==
1
)
{
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
;
if
(
mndAddVnodeToVgroup
(
pMnode
,
pTrans
,
&
newVg
,
pArray
)
!=
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
newVg
.
replica
-
1
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
newVg
.
replica
-
1
;
++
i
)
{
if
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
newVg
.
vnodeGid
[
i
].
dnodeId
)
!=
0
)
return
-
1
;
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,
...
@@ -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
(
mndAddAlterVnodeReplicaAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
newVg
.
vnodeGid
[
i
].
dnodeId
)
!=
0
)
return
-
1
;
}
}
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
)
!=
0
)
return
-
1
;
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
)
!=
0
)
return
-
1
;
#if 1
}
#else
}
else
{
// new replica == 3
}
else
{
// new replica == 3
mInfo
(
"vgId:%d, will add 1 vnode, replca:3"
,
pVgroup
->
vgId
);
mInfo
(
"vgId:%d, will add 1 vnode, replca:3"
,
pVgroup
->
vgId
);
if
(
mndAddVnodeToVgroup
(
pMnode
,
pTrans
,
&
newVg
,
pArray
)
!=
0
)
return
-
1
;
if
(
mndAddVnodeToVgroup
(
pMnode
,
pTrans
,
&
newVg
,
pArray
)
!=
0
)
return
-
1
;
...
@@ -1181,6 +1188,7 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
...
@@ -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
(
mndAddCreateVnodeAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
&
newVg
.
vnodeGid
[
vnIndex
])
!=
0
)
return
-
1
;
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
)
!=
0
)
return
-
1
;
if
(
mndAddAlterVnodeConfirmAction
(
pMnode
,
pTrans
,
pDb
,
&
newVg
)
!=
0
)
return
-
1
;
}
}
#endif
}
else
{
}
else
{
mInfo
(
"vgId:%d, will add 1 vnode and force remove 1 vnode"
,
pVgroup
->
vgId
);
mInfo
(
"vgId:%d, will add 1 vnode and force remove 1 vnode"
,
pVgroup
->
vgId
);
if
(
mndAddVnodeToVgroup
(
pMnode
,
pTrans
,
&
newVg
,
pArray
)
!=
0
)
return
-
1
;
if
(
mndAddVnodeToVgroup
(
pMnode
,
pTrans
,
&
newVg
,
pArray
)
!=
0
)
return
-
1
;
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
ead5d8ed
...
@@ -233,7 +233,7 @@ int32_t syncSendTimeoutRsp(int64_t rid, int64_t seq) {
...
@@ -233,7 +233,7 @@ int32_t syncSendTimeoutRsp(int64_t rid, int64_t seq) {
rpcSendResponse
(
&
rpcMsg
);
rpcSendResponse
(
&
rpcMsg
);
return
0
;
return
0
;
}
else
{
}
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
;
return
-
1
;
}
}
}
}
...
...
source/libs/sync/src/syncRespMgr.c
浏览文件 @
ead5d8ed
...
@@ -35,11 +35,16 @@ SSyncRespMgr *syncRespMgrCreate(void *data, int64_t ttl) {
...
@@ -35,11 +35,16 @@ SSyncRespMgr *syncRespMgrCreate(void *data, int64_t ttl) {
pObj
->
seqNum
=
0
;
pObj
->
seqNum
=
0
;
taosThreadMutexInit
(
&
(
pObj
->
mutex
),
NULL
);
taosThreadMutexInit
(
&
(
pObj
->
mutex
),
NULL
);
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, create resp manager"
,
pNode
->
vgId
);
return
pObj
;
return
pObj
;
}
}
void
syncRespMgrDestroy
(
SSyncRespMgr
*
pObj
)
{
void
syncRespMgrDestroy
(
SSyncRespMgr
*
pObj
)
{
if
(
pObj
!=
NULL
)
{
if
(
pObj
!=
NULL
)
{
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, destroy resp manager"
,
pNode
->
vgId
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
taosHashCleanup
(
pObj
->
pRespHash
);
taosHashCleanup
(
pObj
->
pRespHash
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
...
@@ -81,6 +86,8 @@ int32_t syncRespMgrGet(SSyncRespMgr *pObj, uint64_t seq, SRespStub *pStub) {
...
@@ -81,6 +86,8 @@ int32_t syncRespMgrGet(SSyncRespMgr *pObj, uint64_t seq, SRespStub *pStub) {
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
return
1
;
// get one object
return
1
;
// get one object
}
else
{
sNError
(
pObj
->
data
,
"get message handle, no object of seq:%"
PRIu64
,
seq
);
}
}
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
...
@@ -99,6 +106,8 @@ int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t seq, SRpcHandleInfo *p
...
@@ -99,6 +106,8 @@ int32_t syncRespMgrGetAndDel(SSyncRespMgr *pObj, uint64_t seq, SRpcHandleInfo *p
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
return
1
;
// get one object
return
1
;
// get one object
}
else
{
sNError
(
pObj
->
data
,
"get-and-del message handle, no object of seq:%"
PRIu64
,
seq
);
}
}
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
...
@@ -114,7 +123,7 @@ static void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
...
@@ -114,7 +123,7 @@ static void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
SArray
*
delIndexArray
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
SArray
*
delIndexArray
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
if
(
delIndexArray
==
NULL
)
return
;
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
)
{
while
(
pStub
)
{
size_t
len
;
size_t
len
;
void
*
key
=
taosHashGetKey
(
pStub
,
&
len
);
void
*
key
=
taosHashGetKey
(
pStub
,
&
len
);
...
@@ -143,34 +152,39 @@ static void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
...
@@ -143,34 +152,39 @@ static void syncRespCleanByTTL(SSyncRespMgr *pObj, int64_t ttl, bool rsp) {
// TODO: and make rpcMsg body, call commit cb
// TODO: and make rpcMsg body, call commit cb
// pSyncNode->pFsm->FpCommitCb(pSyncNode->pFsm, &pStub->rpcMsg, cbMeta);
// pSyncNode->pFsm->FpCommitCb(pSyncNode->pFsm, &pStub->rpcMsg, cbMeta);
SRpcMsg
rpcMsg
=
{.
info
=
pStub
->
rpcMsg
.
info
,
.
code
=
TSDB_CODE_SYN_TIMEOUT
};
pStub
->
rpcMsg
.
code
=
TSDB_CODE_SYN_NOT_LEADER
;
sInfo
(
"vgId:%d, message handle:%p expired, type:%s ahandle:%p"
,
pSyncNode
->
vgId
,
rpcMsg
.
info
.
handle
,
if
(
pStub
->
rpcMsg
.
info
.
handle
!=
NULL
)
{
TMSG_INFO
(
pStub
->
rpcMsg
.
msgType
),
rpcMsg
.
info
.
ahandle
);
tmsgSendRsp
(
&
pStub
->
rpcMsg
);
rpcSendResponse
(
&
rpcMsg
);
}
}
}
pStub
=
taosHashIterate
(
pObj
->
pRespHash
,
pStub
);
pStub
=
taosHashIterate
(
pObj
->
pRespHash
,
pStub
);
}
}
int32_t
arraySize
=
taosArrayGetSize
(
delIndexArray
);
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
)
{
for
(
int32_t
i
=
0
;
i
<
arraySize
;
++
i
)
{
uint64_t
*
pSeqNum
=
taosArrayGet
(
delIndexArray
,
i
);
uint64_t
*
pSeqNum
=
taosArrayGet
(
delIndexArray
,
i
);
taosHashRemove
(
pObj
->
pRespHash
,
pSeqNum
,
sizeof
(
uint64_t
));
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
);
taosArrayDestroy
(
delIndexArray
);
}
}
void
syncRespCleanRsp
(
SSyncRespMgr
*
pObj
)
{
void
syncRespCleanRsp
(
SSyncRespMgr
*
pObj
)
{
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, clean all rsp"
,
pNode
->
vgId
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
syncRespCleanByTTL
(
pObj
,
-
1
,
true
);
syncRespCleanByTTL
(
pObj
,
-
1
,
true
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
}
}
void
syncRespClean
(
SSyncRespMgr
*
pObj
)
{
void
syncRespClean
(
SSyncRespMgr
*
pObj
)
{
SSyncNode
*
pNode
=
pObj
->
data
;
sTrace
(
"vgId:%d, clean rsp by ttl"
,
pNode
->
vgId
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
taosThreadMutexLock
(
&
pObj
->
mutex
);
syncRespCleanByTTL
(
pObj
,
pObj
->
ttl
,
false
);
syncRespCleanByTTL
(
pObj
,
pObj
->
ttl
,
false
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
taosThreadMutexUnlock
(
&
pObj
->
mutex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录