提交 9af36669 编写于 作者: S Shengliang Guan

refact: post sem in vnode while sync timeout

上级 3b519172
......@@ -335,15 +335,17 @@ static void vmCleanup(SVnodeMgmt *pMgmt) {
}
static void vmCheckSyncTimeout(SVnodeMgmt *pMgmt) {
taosThreadRwlockRdlock(&pMgmt->lock);
void *pIter = taosHashIterate(pMgmt->hash, NULL);
while (pIter) {
SVnodeObj **ppVnode = pIter;
if (ppVnode == NULL || *ppVnode == NULL) continue;
int32_t numOfVnodes = 0;
SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
SVnodeObj *pVnode = *ppVnode;
for (int32_t i = 0; i < numOfVnodes; ++i) {
SVnodeObj *pVnode = ppVnodes[i];
vnodeSyncCheckTimeout(pVnode->pImpl);
pIter = taosHashIterate(pMgmt->hash, pIter);
vmReleaseVnode(pMgmt, pVnode);
}
if (ppVnodes != NULL) {
taosMemoryFree(ppVnodes);
}
}
......
......@@ -223,11 +223,15 @@ void syncSendTimeoutRsp(int64_t rid, int64_t seq) {
if (pNode == NULL) return;
SRpcMsg rpcMsg = {0};
(void)syncRespMgrGetAndDel(pNode->pSyncRespMgr, seq, &rpcMsg.info);
int32_t ret = syncRespMgrGetAndDel(pNode->pSyncRespMgr, seq, &rpcMsg.info);
rpcMsg.code = TSDB_CODE_SYN_TIMEOUT;
syncNodeRelease(pNode);
rpcSendResponse(&rpcMsg);
if (ret == 1) {
sInfo("send response since sync timeout, seq:%" PRId64 " handle:%p ahandle:%p", seq, rpcMsg.info.handle,
rpcMsg.info.ahandle);
rpcSendResponse(&rpcMsg);
}
}
SyncIndex syncMinMatchIndex(SSyncNode* pSyncNode) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册