提交 4a085db9 编写于 作者: X Xiaoyu Wang

fix: hotfix version compatibility

上级 dfcee117
...@@ -76,7 +76,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { ...@@ -76,7 +76,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
goto End; goto End;
} }
if ((code = taosCheckVersionCompatibleFromStr(version, connectRsp.sVer, 2)) != 0) { if ((code = taosCheckVersionCompatibleFromStr(version, connectRsp.sVer, 3)) != 0) {
setErrno(pRequest, code); setErrno(pRequest, code);
tsem_post(&pRequest->body.rspSem); tsem_post(&pRequest->body.rspSem);
goto End; goto End;
...@@ -506,7 +506,7 @@ int32_t processShowVariablesRsp(void* param, SDataBuf* pMsg, int32_t code) { ...@@ -506,7 +506,7 @@ int32_t processShowVariablesRsp(void* param, SDataBuf* pMsg, int32_t code) {
code = setQueryResultFromRsp(&pRequest->body.resInfo, pRes, false, true); code = setQueryResultFromRsp(&pRequest->body.resInfo, pRes, false, true);
} }
if(code != 0){ if (code != 0) {
taosMemoryFree(pRes); taosMemoryFree(pRes);
} }
tFreeSShowVariablesRsp(&rsp); tFreeSShowVariablesRsp(&rsp);
......
...@@ -226,7 +226,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { ...@@ -226,7 +226,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
goto _OVER; goto _OVER;
} }
if ((code = taosCheckVersionCompatibleFromStr(connReq.sVer, version, 2)) != 0) { if ((code = taosCheckVersionCompatibleFromStr(connReq.sVer, version, 3)) != 0) {
terrno = code; terrno = code;
goto _OVER; goto _OVER;
} }
......
...@@ -26,8 +26,9 @@ int32_t taosVersionStrToInt(const char *vstr, int32_t *vint) { ...@@ -26,8 +26,9 @@ int32_t taosVersionStrToInt(const char *vstr, int32_t *vint) {
int32_t vnum[4] = {0}; int32_t vnum[4] = {0};
int32_t len = strlen(vstr); int32_t len = strlen(vstr);
char tmp[16] = {0}; char tmp[16] = {0};
int32_t vpos = 0;
for (int32_t spos = 0, tpos = 0, vpos = 0; spos < len && vpos < 4; ++spos) { for (int32_t spos = 0, tpos = 0; spos < len && vpos < 4; ++spos) {
if (vstr[spos] != '.') { if (vstr[spos] != '.') {
tmp[spos - tpos] = vstr[spos]; tmp[spos - tpos] = vstr[spos];
} else { } else {
...@@ -38,6 +39,10 @@ int32_t taosVersionStrToInt(const char *vstr, int32_t *vint) { ...@@ -38,6 +39,10 @@ int32_t taosVersionStrToInt(const char *vstr, int32_t *vint) {
} }
} }
if ('\0' != tmp[0] && vpos < 4) {
vnum[vpos] = atoi(tmp);
}
if (vnum[0] <= 0) { if (vnum[0] <= 0) {
terrno = TSDB_CODE_INVALID_VERSION_STRING; terrno = TSDB_CODE_INVALID_VERSION_STRING;
return -1; return -1;
...@@ -66,16 +71,16 @@ int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t ...@@ -66,16 +71,16 @@ int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t
case 4: case 4:
break; break;
case 3: case 3:
clientVer %= 100; clientVer /= 100;
serverVer %= 100; serverVer /= 100;
break; break;
case 2: case 2:
clientVer %= 10000; clientVer /= 10000;
serverVer %= 10000; serverVer /= 10000;
break; break;
case 1: case 1:
clientVer %= 1000000; clientVer /= 1000000;
serverVer %= 1000000; serverVer /= 1000000;
break; break;
default: default:
terrno = TSDB_CODE_INVALID_VERSION_NUMBER; terrno = TSDB_CODE_INVALID_VERSION_NUMBER;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册