diff --git a/source/dnode/vnode/impl/src/vnodeRequest.c b/source/dnode/vnode/impl/src/vnodeRequest.c index be5f5c890c..249bde4e56 100644 --- a/source/dnode/vnode/impl/src/vnodeRequest.c +++ b/source/dnode/vnode/impl/src/vnodeRequest.c @@ -25,9 +25,10 @@ int vnodeBuildReq(void **buf, const SVnodeReq *pReq, uint8_t type) { switch (type) { case TSDB_MSG_TYPE_CREATE_TABLE: tsize += vnodeBuildCreateTableReq(buf, &(pReq->ctReq)); + break; + case TSDB_MSG_TYPE_SUBMIT: /* code */ break; - default: break; } diff --git a/source/dnode/vnode/impl/test/vnodeApiTests.cpp b/source/dnode/vnode/impl/test/vnodeApiTests.cpp index 0f330d7b4c..8f33dbba85 100644 --- a/source/dnode/vnode/impl/test/vnodeApiTests.cpp +++ b/source/dnode/vnode/impl/test/vnodeApiTests.cpp @@ -126,7 +126,19 @@ static void vtBuildCreateNtbReq(char *tbname, SRpcMsg **ppMsg) { } static void vtBuildSubmitReq(SRpcMsg **ppMsg) { - // TODO + SRpcMsg *pMsg; + void * pBuf; + int tz = 0; + + pMsg = (SRpcMsg *)malloc(sizeof(*pMsg) + tz); + pMsg->msgType = TSDB_MSG_TYPE_SUBMIT; + pMsg->contLen = tz; + pMsg->pCont = POINTER_SHIFT(pMsg, sizeof(*pMsg)); + + pBuf = pMsg->pCont; + vnodeBuildReq(&pBuf, NULL /*TODO*/, TSDB_MSG_TYPE_SUBMIT); + + *ppMsg = pMsg; } static void vtClearMsgBatch(SArray *pMsgArr) { @@ -198,6 +210,7 @@ TEST(vnodeApiTest, vnode_simple_insert_test) { SArray * pMsgArr; int rcode; SVnode * pVnode; + int batch = 1; pMsgArr = (SArray *)taosArrayInit(0, sizeof(pMsg)); @@ -226,6 +239,13 @@ TEST(vnodeApiTest, vnode_simple_insert_test) { vtClearMsgBatch(pMsgArr); // 3. WRITE A LOT OF TIME-SERIES DATA + for (int i = 0; i < batch; i++) { + vtBuildSubmitReq(&pMsg); + taosArrayPush(pMsgArr, &pMsg); + } + rcode = vnodeProcessWMsgs(pVnode, pMsgArr); + GTEST_ASSERT_EQ(rcode, 0); + vtClearMsgBatch(pMsgArr); // Close the vnode vnodeClose(pVnode);