From 8dee6d40e2a51b1dd76bac7239f1c1f2425da684 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 10 Jan 2022 14:39:25 +0800 Subject: [PATCH] renew table meta when sversion/tversion is lower in cache --- src/client/src/tscServer.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 8d8f3a6863..9e3ac36b48 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -508,23 +508,23 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) { if (pRes->code == TSDB_CODE_SUCCESS && pCmd->command < TSDB_SQL_MAX && tscProcessMsgRsp[pCmd->command]) { rpcMsg->code = (*tscProcessMsgRsp[pCmd->command])(pSql); - } - - bool shouldFree = tscShouldBeFreed(pSql); - if (rpcMsg->code == TSDB_CODE_TSC_INVALID_SCHEMA_VERSION) { - pSql->res.code = rpcMsg->code; - tscWarn("0x%" PRIx64 " it shall renew table meta, code:%s, retry:%d", pSql->self, tstrerror(rpcMsg->code), pSql->retry); + if (rpcMsg->code == TSDB_CODE_TSC_INVALID_SCHEMA_VERSION) { + pSql->res.code = rpcMsg->code; + tscWarn("0x%" PRIx64 " it shall renew table meta, code:%s, retry:%d", pSql->self, tstrerror(rpcMsg->code), pSql->retry); - ++pSql->retry; - if (pSql->retry > pSql->maxRetry) { - tscError("0x%" PRIx64 " max retry %d reached, give up", pSql->self, pSql->maxRetry); - } else { - pSql->retryReason = rpcMsg->code; - rpcMsg->code = tscRenewTableMeta(pSql); + ++pSql->retry; + if (pSql->retry > pSql->maxRetry) { + tscError("0x%" PRIx64 " max retry %d reached, give up", pSql->self, pSql->maxRetry); + } else { + pSql->retryReason = rpcMsg->code; + rpcMsg->code = tscRenewTableMeta(pSql); + } } } - if (rpcMsg->code != TSDB_CODE_TSC_ACTION_IN_PROGRESS) { + bool shouldFree = tscShouldBeFreed(pSql); + + if (rpcMsg->code != TSDB_CODE_TSC_INVALID_SCHEMA_VERSION && rpcMsg->code != TSDB_CODE_TSC_ACTION_IN_PROGRESS) { if (rpcMsg->code != TSDB_CODE_SUCCESS) { pRes->code = rpcMsg->code; } -- GitLab