Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e3437818
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看板
未验证
提交
e3437818
编写于
1月 05, 2023
作者:
S
Shengliang Guan
提交者:
GitHub
1月 05, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19369 from taosdata/fix/TD-21353
fix(vnode/mgmt): pre close vnode after queue's empty
上级
3e215fc6
7e5d97f0
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
41 addition
and
4 deletion
+41
-4
include/libs/sync/sync.h
include/libs/sync/sync.h
+1
-0
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+3
-0
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+1
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+4
-3
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+1
-0
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+2
-0
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+5
-0
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+1
-0
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+23
-0
未找到文件。
include/libs/sync/sync.h
浏览文件 @
e3437818
...
...
@@ -232,6 +232,7 @@ int64_t syncOpen(SSyncInfo* pSyncInfo);
int32_t
syncStart
(
int64_t
rid
);
void
syncStop
(
int64_t
rid
);
void
syncPreStop
(
int64_t
rid
);
void
syncPostStop
(
int64_t
rid
);
int32_t
syncPropose
(
int64_t
rid
,
SRpcMsg
*
pMsg
,
bool
isWeak
,
int64_t
*
seq
);
int32_t
syncProcessMsg
(
int64_t
rid
,
SRpcMsg
*
pMsg
);
int32_t
syncReconfig
(
int64_t
rid
,
SSyncCfg
*
pCfg
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
浏览文件 @
e3437818
...
...
@@ -118,6 +118,9 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
dInfo
(
"vgId:%d, all vnode queues is empty"
,
pVnode
->
vgId
);
dInfo
(
"vgId:%d, post close"
,
pVnode
->
vgId
);
vnodePostClose
(
pVnode
->
pImpl
);
vmFreeQueue
(
pMgmt
,
pVnode
);
vnodeClose
(
pVnode
->
pImpl
);
pVnode
->
pImpl
=
NULL
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
e3437818
...
...
@@ -1050,7 +1050,7 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
status
=
"offline"
;
}
char
b1
[
9
]
=
{
0
};
char
b1
[
16
]
=
{
0
};
STR_TO_VARSTR
(
b1
,
status
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
e3437818
...
...
@@ -54,7 +54,8 @@ int32_t vnodeAlter(const char *path, SAlterVnodeReplicaReq *pReq, STfs *pTfs);
void
vnodeDestroy
(
const
char
*
path
,
STfs
*
pTfs
);
SVnode
*
vnodeOpen
(
const
char
*
path
,
STfs
*
pTfs
,
SMsgCb
msgCb
);
void
vnodePreClose
(
SVnode
*
pVnode
);
void
vnodeSyncCheckTimeout
(
SVnode
*
pVnode
);
void
vnodePostClose
(
SVnode
*
pVnode
);
void
vnodeSyncCheckTimeout
(
SVnode
*
pVnode
);
void
vnodeClose
(
SVnode
*
pVnode
);
int32_t
vnodeStart
(
SVnode
*
pVnode
);
...
...
@@ -175,7 +176,7 @@ int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, void *pTableL
void
tsdbReaderClose
(
STsdbReader
*
pReader
);
bool
tsdbNextDataBlock
(
STsdbReader
*
pReader
);
void
tsdbRetrieveDataBlockInfo
(
const
STsdbReader
*
pReader
,
int32_t
*
rows
,
uint64_t
*
uid
,
STimeWindow
*
pWindow
);
int32_t
tsdbRetrieveDatablockSMA
(
STsdbReader
*
pReader
,
SSDataBlock
*
pDataBlock
,
bool
*
allHave
);
int32_t
tsdbRetrieveDatablockSMA
(
STsdbReader
*
pReader
,
SSDataBlock
*
pDataBlock
,
bool
*
allHave
);
SSDataBlock
*
tsdbRetrieveDataBlock
(
STsdbReader
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
int32_t
tsdbReaderReset
(
STsdbReader
*
pReader
,
SQueryTableDataCond
*
pCond
);
int32_t
tsdbGetFileBlocksDistInfo
(
STsdbReader
*
pReader
,
STableBlockDistInfo
*
pTableBlockInfo
);
...
...
@@ -185,7 +186,7 @@ void *tsdbGetIvtIdx(SMeta *pMeta);
uint64_t
getReaderMaxVersion
(
STsdbReader
*
pReader
);
int32_t
tsdbCacherowsReaderOpen
(
void
*
pVnode
,
int32_t
type
,
void
*
pTableIdList
,
int32_t
numOfTables
,
int32_t
numOfCols
,
uint64_t
suid
,
void
**
pReader
,
const
char
*
idstr
);
uint64_t
suid
,
void
**
pReader
,
const
char
*
idstr
);
int32_t
tsdbRetrieveCacheRows
(
void
*
pReader
,
SSDataBlock
*
pResBlock
,
const
int32_t
*
slotIds
,
SArray
*
pTableUids
);
void
*
tsdbCacherowsReaderClose
(
void
*
pReader
);
int32_t
tsdbGetTableSchema
(
SVnode
*
pVnode
,
int64_t
uid
,
STSchema
**
pSchema
,
int64_t
*
suid
);
...
...
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
e3437818
...
...
@@ -98,6 +98,7 @@ bool vnodeShouldRollback(SVnode* pVnode);
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
);
int32_t
vnodeSyncStart
(
SVnode
*
pVnode
);
void
vnodeSyncPreClose
(
SVnode
*
pVnode
);
void
vnodeSyncPostClose
(
SVnode
*
pVnode
);
void
vnodeSyncClose
(
SVnode
*
pVnode
);
void
vnodeRedirectRpcMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
int32_t
code
);
bool
vnodeIsLeader
(
SVnode
*
pVnode
);
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
e3437818
...
...
@@ -250,6 +250,8 @@ void vnodePreClose(SVnode *pVnode) {
vnodeSyncPreClose
(
pVnode
);
}
void
vnodePostClose
(
SVnode
*
pVnode
)
{
vnodeSyncPostClose
(
pVnode
);
}
void
vnodeClose
(
SVnode
*
pVnode
)
{
if
(
pVnode
)
{
vnodeSyncCommit
(
pVnode
);
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
e3437818
...
...
@@ -614,6 +614,11 @@ void vnodeSyncPreClose(SVnode *pVnode) {
taosThreadMutexUnlock
(
&
pVnode
->
lock
);
}
void
vnodeSyncPostClose
(
SVnode
*
pVnode
)
{
vInfo
(
"vgId:%d, post close sync"
,
pVnode
->
config
.
vgId
);
syncPostStop
(
pVnode
->
sync
);
}
void
vnodeSyncClose
(
SVnode
*
pVnode
)
{
vInfo
(
"vgId:%d, close sync"
,
pVnode
->
config
.
vgId
);
syncStop
(
pVnode
->
sync
);
...
...
source/libs/sync/inc/syncInt.h
浏览文件 @
e3437818
...
...
@@ -228,6 +228,7 @@ int32_t syncNodeStart(SSyncNode* pSyncNode);
int32_t
syncNodeStartStandBy
(
SSyncNode
*
pSyncNode
);
void
syncNodeClose
(
SSyncNode
*
pSyncNode
);
void
syncNodePreClose
(
SSyncNode
*
pSyncNode
);
void
syncNodePostClose
(
SSyncNode
*
pSyncNode
);
int32_t
syncNodePropose
(
SSyncNode
*
pSyncNode
,
SRpcMsg
*
pMsg
,
bool
isWeak
,
int64_t
*
seq
);
int32_t
syncNodeRestore
(
SSyncNode
*
pSyncNode
);
void
syncHbTimerDataFree
(
SSyncHbTimerData
*
pData
);
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
e3437818
...
...
@@ -124,6 +124,14 @@ void syncPreStop(int64_t rid) {
}
}
void
syncPostStop
(
int64_t
rid
)
{
SSyncNode
*
pSyncNode
=
syncNodeAcquire
(
rid
);
if
(
pSyncNode
!=
NULL
)
{
syncNodePostClose
(
pSyncNode
);
syncNodeRelease
(
pSyncNode
);
}
}
static
bool
syncNodeCheckNewConfig
(
SSyncNode
*
pSyncNode
,
const
SSyncCfg
*
pCfg
)
{
if
(
!
syncNodeInConfig
(
pSyncNode
,
pCfg
))
return
false
;
return
abs
(
pCfg
->
replicaNum
-
pSyncNode
->
replicaNum
)
<=
1
;
...
...
@@ -1236,6 +1244,7 @@ void syncNodePreClose(SSyncNode* pSyncNode) {
}
}
#if 0
if (pSyncNode->pNewNodeReceiver != NULL) {
if (snapshotReceiverIsStart(pSyncNode->pNewNodeReceiver)) {
snapshotReceiverForceStop(pSyncNode->pNewNodeReceiver);
...
...
@@ -1246,6 +1255,7 @@ void syncNodePreClose(SSyncNode* pSyncNode) {
snapshotReceiverDestroy(pSyncNode->pNewNodeReceiver);
pSyncNode->pNewNodeReceiver = NULL;
}
#endif
// stop elect timer
syncNodeStopElectTimer
(
pSyncNode
);
...
...
@@ -1257,6 +1267,19 @@ void syncNodePreClose(SSyncNode* pSyncNode) {
syncRespCleanRsp
(
pSyncNode
->
pSyncRespMgr
);
}
void
syncNodePostClose
(
SSyncNode
*
pSyncNode
)
{
if
(
pSyncNode
->
pNewNodeReceiver
!=
NULL
)
{
if
(
snapshotReceiverIsStart
(
pSyncNode
->
pNewNodeReceiver
))
{
snapshotReceiverForceStop
(
pSyncNode
->
pNewNodeReceiver
);
}
sDebug
(
"vgId:%d, snapshot receiver destroy while preclose sync node, data:%p"
,
pSyncNode
->
vgId
,
pSyncNode
->
pNewNodeReceiver
);
snapshotReceiverDestroy
(
pSyncNode
->
pNewNodeReceiver
);
pSyncNode
->
pNewNodeReceiver
=
NULL
;
}
}
void
syncHbTimerDataFree
(
SSyncHbTimerData
*
pData
)
{
taosMemoryFree
(
pData
);
}
void
syncNodeClose
(
SSyncNode
*
pSyncNode
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录