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) {
|
static void vmCheckSyncTimeout(SVnodeMgmt *pMgmt) {
|
||||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
int32_t numOfVnodes = 0;
|
||||||
void *pIter = taosHashIterate(pMgmt->hash, NULL);
|
SVnodeObj **ppVnodes = vmGetVnodeListFromHash(pMgmt, &numOfVnodes);
|
||||||
while (pIter) {
|
|
||||||
SVnodeObj **ppVnode = pIter;
|
|
||||||
if (ppVnode == NULL || *ppVnode == NULL) continue;
|
|
||||||
|
|
||||||
SVnodeObj *pVnode = *ppVnode;
|
for (int32_t i = 0; i < numOfVnodes; ++i) {
|
||||||
|
SVnodeObj *pVnode = ppVnodes[i];
|
||||||
vnodeSyncCheckTimeout(pVnode->pImpl);
|
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;
|
if (pNode == NULL) return;
|
||||||
|
|
||||||
SRpcMsg rpcMsg = {0};
|
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;
|
rpcMsg.code = TSDB_CODE_SYN_TIMEOUT;
|
||||||
|
|
||||||
syncNodeRelease(pNode);
|
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) {
|
SyncIndex syncMinMatchIndex(SSyncNode* pSyncNode) {
|
||||||
|
|
Loading…
Reference in New Issue