From ee092c2dbb047f8e753ef205f0425e1eadc11e2f Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 16 Dec 2020 19:09:13 +0800 Subject: [PATCH 1/4] [TD-2469]: disable client epSet.fqdn update with single node cluster --- src/mnode/src/mnodeMnode.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mnode/src/mnodeMnode.c b/src/mnode/src/mnodeMnode.c index b60b308cf8..8b3b2896ff 100644 --- a/src/mnode/src/mnodeMnode.c +++ b/src/mnode/src/mnodeMnode.c @@ -294,6 +294,11 @@ void mnodeGetMnodeEpSetForShell(SRpcEpSet *epSet, bool redirect) { *epSet = tsMEpForShell; mnodeMnodeUnLock(); + if (mnodeGetDnodesNum() <= 1) { + epSet->numOfEps = 0; + return; + } + mTrace("vgId:1, mnodes epSet for shell is returned, num:%d inUse:%d", tsMEpForShell.numOfEps, tsMEpForShell.inUse); for (int32_t i = 0; i < epSet->numOfEps; ++i) { if (redirect && strcmp(epSet->fqdn[i], tsLocalFqdn) == 0 && htons(epSet->port[i]) == tsServerPort) { From 1837098b44affd0988ec9ccc91667f7e45d96914 Mon Sep 17 00:00:00 2001 From: Minglei Jin <49711132+stephenkgu@users.noreply.github.com> Date: Fri, 18 Dec 2020 10:57:04 +0800 Subject: [PATCH 2/4] Revert "[TD-2340]: reserve field uint32_t crc for checksums" --- src/inc/taosmsg.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index b0c7c0895f..bf7fe7cf99 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -199,8 +199,7 @@ typedef struct { } SMsgDesc; typedef struct SMsgVersion { - char clientVersion[TSDB_VERSION_LEN]; - uint32_t crc; + char clientVersion[TSDB_VERSION_LEN]; } SMsgVersion; typedef struct SMsgHead { From 16802aa3db8085fc29844de8ea5e8cd3a1c3422f Mon Sep 17 00:00:00 2001 From: Bomin Zhang Date: Fri, 18 Dec 2020 02:59:44 +0000 Subject: [PATCH 3/4] [TD-2481]: cannot create stream --- src/query/inc/sql.y | 4 ++-- src/query/src/sql.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y index e275c50e89..32e2721103 100644 --- a/src/query/inc/sql.y +++ b/src/query/inc/sql.y @@ -346,8 +346,8 @@ create_table_args(A) ::= ifnotexists(U) ids(V) cpxName(Z) AS select(S). { A = tSetCreateSQLElems(NULL, NULL, S, TSQL_CREATE_STREAM); setSQLInfo(pInfo, A, NULL, TSDB_SQL_CREATE_TABLE); - U.n += Z.n; - setCreatedTableName(pInfo, &U, &V); + V.n += Z.n; + setCreatedTableName(pInfo, &V, &U); } %type column{TAOS_FIELD} diff --git a/src/query/src/sql.c b/src/query/src/sql.c index 3a8eb23cf8..045036676d 100644 --- a/src/query/src/sql.c +++ b/src/query/src/sql.c @@ -2420,8 +2420,8 @@ static void yy_reduce( yylhsminor.yy538 = tSetCreateSQLElems(NULL, NULL, yymsp[0].minor.yy84, TSQL_CREATE_STREAM); setSQLInfo(pInfo, yylhsminor.yy538, NULL, TSDB_SQL_CREATE_TABLE); - yymsp[-4].minor.yy0.n += yymsp[-2].minor.yy0.n; - setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0); + yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; + setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0); } yymsp[-4].minor.yy538 = yylhsminor.yy538; break; From ccbac086d4884fd3e323434c39ab05311717c599 Mon Sep 17 00:00:00 2001 From: Minglei Jin <49711132+stephenkgu@users.noreply.github.com> Date: Fri, 18 Dec 2020 11:05:49 +0800 Subject: [PATCH 4/4] Revert "[TD-1827]: force version check for client messages" --- src/client/src/tscServer.c | 7 +++---- src/dnode/src/dnodeMRead.c | 2 ++ src/dnode/src/dnodeMWrite.c | 2 ++ src/dnode/src/dnodeShell.c | 15 +-------------- src/dnode/src/dnodeVRead.c | 2 ++ src/dnode/src/dnodeVWrite.c | 1 + src/inc/taosmsg.h | 4 ---- 7 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 9f6ccef50d..d1dc18605f 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -243,7 +243,7 @@ int tscSendMsgToServer(SSqlObj *pSql) { STscObj* pObj = pSql->pTscObj; SSqlCmd* pCmd = &pSql->cmd; - char *pMsg = rpcMallocCont(sizeof(SMsgVersion) + pCmd->payloadLen); + char *pMsg = rpcMallocCont(pCmd->payloadLen); if (NULL == pMsg) { tscError("%p msg:%s malloc failed", pSql, taosMsg[pSql->cmd.msgType]); return TSDB_CODE_TSC_OUT_OF_MEMORY; @@ -254,13 +254,12 @@ int tscSendMsgToServer(SSqlObj *pSql) { tscDumpMgmtEpSet(pSql); } - tstrncpy(pMsg, version, sizeof(SMsgVersion)); - memcpy(pMsg + sizeof(SMsgVersion), pSql->cmd.payload, pSql->cmd.payloadLen); + memcpy(pMsg, pSql->cmd.payload, pSql->cmd.payloadLen); SRpcMsg rpcMsg = { .msgType = pSql->cmd.msgType, .pCont = pMsg, - .contLen = pSql->cmd.payloadLen + sizeof(SMsgVersion), + .contLen = pSql->cmd.payloadLen, .ahandle = (void*)pSql->self, .handle = NULL, .code = 0 diff --git a/src/dnode/src/dnodeMRead.c b/src/dnode/src/dnodeMRead.c index b32326f4c2..0fc6400d99 100644 --- a/src/dnode/src/dnodeMRead.c +++ b/src/dnode/src/dnodeMRead.c @@ -124,6 +124,8 @@ void dnodeDispatchToMReadQueue(SRpcMsg *pMsg) { SMnodeMsg *pRead = mnodeCreateMsg(pMsg); taosWriteQitem(tsMReadQueue, TAOS_QTYPE_RPC, pRead); } + + rpcFreeCont(pMsg->pCont); } static void dnodeFreeMReadMsg(SMnodeMsg *pRead) { diff --git a/src/dnode/src/dnodeMWrite.c b/src/dnode/src/dnodeMWrite.c index 9007b54d47..414b66653d 100644 --- a/src/dnode/src/dnodeMWrite.c +++ b/src/dnode/src/dnodeMWrite.c @@ -125,6 +125,8 @@ void dnodeDispatchToMWriteQueue(SRpcMsg *pMsg) { taosMsg[pWrite->rpcMsg.msgType], tsMWriteQueue); taosWriteQitem(tsMWriteQueue, TAOS_QTYPE_RPC, pWrite); } + + rpcFreeCont(pMsg->pCont); } static void dnodeFreeMWriteMsg(SMnodeMsg *pWrite) { diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index 221e13d109..79cc70005b 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -127,20 +127,7 @@ static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *pEpSet) { } else {} if ( dnodeProcessShellMsgFp[pMsg->msgType] ) { - SMsgVersion *pMsgVersion = pMsg->pCont; - if (taosCheckVersion(pMsgVersion->clientVersion, version, 3) != TSDB_CODE_SUCCESS) { - rpcMsg.code = TSDB_CODE_TSC_INVALID_VERSION; - rpcSendResponse(&rpcMsg); - rpcFreeCont(pMsg->pCont); - return; // todo change the error code - } - pMsg->pCont += sizeof(*pMsgVersion); - pMsg->contLen -= sizeof(*pMsgVersion); - (*dnodeProcessShellMsgFp[pMsg->msgType])(pMsg); - - //pMsg->contLen += sizeof(*pMsgVersion); - rpcFreeCont(pMsg->pCont - sizeof(*pMsgVersion)); } else { dError("RPC %p, shell msg:%s is not processed", pMsg->handle, taosMsg[pMsg->msgType]); rpcMsg.code = TSDB_CODE_DND_MSG_NOT_PROCESSED; @@ -244,4 +231,4 @@ SStatisInfo dnodeGetStatisInfo() { } return info; -} +} \ No newline at end of file diff --git a/src/dnode/src/dnodeVRead.c b/src/dnode/src/dnodeVRead.c index 2995116ef5..3f31e49370 100644 --- a/src/dnode/src/dnodeVRead.c +++ b/src/dnode/src/dnodeVRead.c @@ -77,6 +77,8 @@ void dnodeDispatchToVReadQueue(SRpcMsg *pMsg) { SRpcMsg rpcRsp = {.handle = pMsg->handle, .code = TSDB_CODE_VND_INVALID_VGROUP_ID}; rpcSendResponse(&rpcRsp); } + + rpcFreeCont(pMsg->pCont); } void *dnodeAllocVQueryQueue(void *pVnode) { diff --git a/src/dnode/src/dnodeVWrite.c b/src/dnode/src/dnodeVWrite.c index 959789a6d2..a5ae8ac830 100644 --- a/src/dnode/src/dnodeVWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -102,6 +102,7 @@ void dnodeDispatchToVWriteQueue(SRpcMsg *pRpcMsg) { } vnodeRelease(pVnode); + rpcFreeCont(pRpcMsg->pCont); } void *dnodeAllocVWriteQueue(void *pVnode) { diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index bf7fe7cf99..b7f0de54fe 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -198,10 +198,6 @@ typedef struct { int32_t numOfVnodes; } SMsgDesc; -typedef struct SMsgVersion { - char clientVersion[TSDB_VERSION_LEN]; -} SMsgVersion; - typedef struct SMsgHead { int32_t contLen; int32_t vgId;