refact: post sem in vnode while sync timeout
This commit is contained in:
parent
3b519172a3
commit
9af36669ad
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue