From 9bee9a8397e84c3b2ae9e734327cd343b7dda8fa Mon Sep 17 00:00:00 2001 From: plum-lihui Date: Sat, 16 Apr 2022 14:11:13 +0800 Subject: [PATCH 1/2] [test: reopen char scalar function cases] --- tests/script/jenkins/basic.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 3df1d4287b..8dc7fb920e 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -31,7 +31,7 @@ ./test.sh -f tsim/query/interval.sim ./test.sh -f tsim/query/interval-offset.sim ./test.sh -f tsim/query/scalarFunction.sim -#./test.sh -f tsim/query/charScalarFunction.sim +./test.sh -f tsim/query/charScalarFunction.sim ./test.sh -f tsim/query/explain.sim ./test.sh -f tsim/query/session.sim From a6d12f069e233ef7ae0dae3ba06007d2b4f8f828 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Sat, 16 Apr 2022 06:32:34 +0000 Subject: [PATCH 2/2] insert return result --- include/libs/wal/wal.h | 16 ++++++------- source/dnode/vnode/src/tsdb/tsdbMemTable.c | 4 ++-- source/dnode/vnode/src/vnd/vnodeSvr.c | 28 +++++++++++++++++++--- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h index e635227eaa..10d01f12ec 100644 --- a/include/libs/wal/wal.h +++ b/include/libs/wal/wal.h @@ -61,16 +61,16 @@ extern "C" { } \ } -#define WAL_HEAD_VER 0 +#define WAL_HEAD_VER 0 #define WAL_NOSUFFIX_LEN 20 -#define WAL_SUFFIX_AT (WAL_NOSUFFIX_LEN + 1) -#define WAL_LOG_SUFFIX "log" +#define WAL_SUFFIX_AT (WAL_NOSUFFIX_LEN + 1) +#define WAL_LOG_SUFFIX "log" #define WAL_INDEX_SUFFIX "idx" -#define WAL_REFRESH_MS 1000 -#define WAL_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead)) -#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12) -#define WAL_FILE_LEN (WAL_PATH_LEN + 32) -#define WAL_MAGIC 0xFAFBFCFDULL +#define WAL_REFRESH_MS 1000 +#define WAL_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead)) +#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12) +#define WAL_FILE_LEN (WAL_PATH_LEN + 32) +#define WAL_MAGIC 0xFAFBFCFDULL #define WAL_CUR_FAILED 1 diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable.c b/source/dnode/vnode/src/tsdb/tsdbMemTable.c index 5f401c9b2b..bea2b66af8 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable.c @@ -97,8 +97,8 @@ int tsdbMemTableInsert(STsdb *pTsdb, STsdbMemTable *pMemTable, SSubmitReq *pMsg, } if (pRsp != NULL) { - pRsp->affectedRows = htonl(affectedrows); - pRsp->numOfRows = htonl(numOfRows); + pRsp->affectedRows = affectedrows; + pRsp->numOfRows = numOfRows; } return 0; diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 395f715b8f..87cef53042 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -18,6 +18,7 @@ static int vnodeProcessCreateStbReq(SVnode *pVnode, void *pReq); static int vnodeProcessCreateTbReq(SVnode *pVnode, SRpcMsg *pMsg, void *pReq, SRpcMsg **pRsp); static int vnodeProcessAlterStbReq(SVnode *pVnode, void *pReq); +static int vnodeProcessSubmitReq(SVnode *pVnode, SSubmitReq *pSubmitReq, SRpcMsg *pRsp); void vnodePreprocessWriteReqs(SVnode *pVnode, SArray *pMsgs) { SNodeMsg *pMsg; @@ -79,9 +80,10 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { case TDMT_VND_SUBMIT: /*printf("vnode %d write data %ld\n", pVnode->vgId, ver);*/ if (pVnode->config.streamMode == 0) { - if (tsdbInsertData(pVnode->pTsdb, (SSubmitReq *)ptr, NULL) < 0) { - // TODO: handle error - } + *pRsp = taosMemoryCalloc(1, sizeof(SRpcMsg)); + (*pRsp)->handle = pMsg->handle; + (*pRsp)->ahandle = pMsg->ahandle; + return vnodeProcessSubmitReq(pVnode, ptr, *pRsp); } break; case TDMT_VND_MQ_SET_CONN: { @@ -298,5 +300,25 @@ static int vnodeProcessAlterStbReq(SVnode *pVnode, void *pReq) { } taosMemoryFree(vAlterTbReq.dbFName); taosMemoryFree(vAlterTbReq.name); + return 0; +} + +static int vnodeProcessSubmitReq(SVnode *pVnode, SSubmitReq *pSubmitReq, SRpcMsg *pRsp) { + SSubmitRsp rsp = {0}; + + pRsp->code = 0; + + // handle the request + if (tsdbInsertData(pVnode->pTsdb, pSubmitReq, &rsp) < 0) { + pRsp->code = terrno; + return -1; + } + + // encode the response (TODO) + pRsp->msgType = TDMT_VND_SUBMIT_RSP; + pRsp->pCont = rpcMallocCont(sizeof(SSubmitRsp)); + memcpy(pRsp->pCont, &rsp, sizeof(rsp)); + pRsp->contLen = sizeof(SSubmitRsp); + return 0; } \ No newline at end of file