From 81f58bf74fe35b49824a5df3eee2cff68dfc1da7 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 19 Apr 2022 03:45:22 +0000 Subject: [PATCH 1/2] refactor: vnode --- include/common/tmsg.h | 1 - source/common/src/tmsg.c | 2 -- source/dnode/mnode/impl/src/mndStb.c | 1 - source/dnode/vnode/src/vnd/vnodeSvr.c | 11 +++++++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 67369bb42c..32d59c6929 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1431,7 +1431,6 @@ typedef struct { } SRSmaParam; typedef struct SVCreateTbReq { - int64_t ver; // use a general definition char* name; uint32_t ttl; uint32_t keep; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 5c97743a62..30524471a9 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -397,7 +397,6 @@ int32_t tDeserializeSClientHbBatchRsp(void *buf, int32_t bufLen, SClientHbBatchR int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) { int32_t tlen = 0; - tlen += taosEncodeFixedI64(buf, pReq->ver); tlen += taosEncodeString(buf, pReq->name); tlen += taosEncodeFixedU32(buf, pReq->ttl); tlen += taosEncodeFixedU32(buf, pReq->keep); @@ -465,7 +464,6 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) { } void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) { - buf = taosDecodeFixedI64(buf, &(pReq->ver)); buf = taosDecodeString(buf, &(pReq->name)); buf = taosDecodeFixedU32(buf, &(pReq->ttl)); buf = taosDecodeFixedU32(buf, &(pReq->keep)); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index fa24501651..3ead2f26a3 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -348,7 +348,6 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt tNameGetFullDbName(&name, dbFName); SVCreateTbReq req = {0}; - req.ver = 0; req.name = (char *)tNameGetTableName(&name); req.ttl = 0; req.keep = 0; diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 603b92d4a0..fface9d6c5 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -63,12 +63,14 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg switch (pMsg->msgType) { case TDMT_VND_CREATE_STB: ret = vnodeProcessCreateStbReq(pVnode, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))); - return 0; + break; case TDMT_VND_CREATE_TABLE: pRsp->msgType = TDMT_VND_CREATE_TABLE_RSP; - return vnodeProcessCreateTbReq(pVnode, pMsg, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), pRsp); + vnodeProcessCreateTbReq(pVnode, pMsg, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), pRsp); + break; case TDMT_VND_ALTER_STB: - return vnodeProcessAlterStbReq(pVnode, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))); + vnodeProcessAlterStbReq(pVnode, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))); + break; case TDMT_VND_DROP_STB: vTrace("vgId:%d, process drop stb req", TD_VID(pVnode)); break; @@ -76,7 +78,8 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg break; case TDMT_VND_SUBMIT: pRsp->msgType = TDMT_VND_SUBMIT_RSP; - return vnodeProcessSubmitReq(pVnode, ptr, pRsp); + vnodeProcessSubmitReq(pVnode, ptr, pRsp); + break; case TDMT_VND_MQ_SET_CONN: { if (tqProcessSetConnReq(pVnode->pTq, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { // TODO: handle error From 0d89d9378759f34a09ec35b63f7d19f2895dead2 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 19 Apr 2022 05:42:16 +0000 Subject: [PATCH 2/2] refactor: vnode --- source/dnode/vnode/CMakeLists.txt | 1 - source/dnode/vnode/src/vnd/vnodeWrite.c | 18 ------------------ 2 files changed, 19 deletions(-) delete mode 100644 source/dnode/vnode/src/vnd/vnodeWrite.c diff --git a/source/dnode/vnode/CMakeLists.txt b/source/dnode/vnode/CMakeLists.txt index 5a6fdd1b40..6a318b8e10 100644 --- a/source/dnode/vnode/CMakeLists.txt +++ b/source/dnode/vnode/CMakeLists.txt @@ -13,7 +13,6 @@ target_sources( "src/vnd/vnodeInt.c" "src/vnd/vnodeQuery.c" "src/vnd/vnodeStateMgr.c" - "src/vnd/vnodeWrite.c" "src/vnd/vnodeModule.c" "src/vnd/vnodeSvr.c" diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c deleted file mode 100644 index 16b881f00d..0000000000 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2019 TAOS Data, Inc. - * - * This program is free software: you can use, redistribute, and/or modify - * it under the terms of the GNU Affero General Public License, version 3 - * or later ("AGPL"), as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -#include "vnodeInt.h" - -/* ------------------------ STATIC METHODS ------------------------ */