Merge pull request #28437 from taosdata/fix/TD-32485

fix: the problem of taosc driver retrying errors after clearing the dnode data
This commit is contained in:
Shengliang Guan 2024-10-31 09:19:07 +08:00 committed by GitHub
commit 91f8c4cfed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 3 deletions

View File

@ -30,9 +30,18 @@ static inline void dmBuildMnodeRedirectRsp(SDnode *pDnode, SRpcMsg *pMsg) {
dmGetMnodeEpSetForRedirect(&pDnode->data, pMsg, &epSet); dmGetMnodeEpSetForRedirect(&pDnode->data, pMsg, &epSet);
if (epSet.numOfEps <= 1) { if (epSet.numOfEps <= 1) {
pMsg->pCont = NULL; if (epSet.numOfEps == 0) {
pMsg->code = TSDB_CODE_MNODE_NOT_FOUND; pMsg->pCont = NULL;
return; pMsg->code = TSDB_CODE_MNODE_NOT_FOUND;
return;
}
// dnode is not the mnode or mnode leader and This ensures that the function correctly handles cases where the
// dnode cannot obtain a valid epSet and avoids returning an incorrect or misleading epSet.
if (strcmp(epSet.eps[0].fqdn, tsLocalFqdn) == 0 && epSet.eps[0].port == tsServerPort) {
pMsg->pCont = NULL;
pMsg->code = TSDB_CODE_MNODE_NOT_FOUND;
return;
}
} }
int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet); int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet);