From fd9feb1ac5afcf4edbd74df518f58ddfdb81d72f Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 28 Dec 2021 13:35:21 +0800 Subject: [PATCH] more --- contrib/test/tdev/src/main.c | 31 ++++++++++++++++++++---- include/common/tmsg.h | 14 +++++------ source/dnode/vnode/impl/src/vnodeQuery.c | 12 +++++---- 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/contrib/test/tdev/src/main.c b/contrib/test/tdev/src/main.c index baae604992..5e1de83e88 100644 --- a/contrib/test/tdev/src/main.c +++ b/contrib/test/tdev/src/main.c @@ -25,10 +25,13 @@ POINTER_SHIFT(buf, sizeof(val)); \ }) -#define tPutC(buf, val) \ - ({ \ - ((uint64_t *)buf)[0] = (val); \ - POINTER_SHIFT(buf, sizeof(val)); \ +#define tPutC(buf, val) \ + ({ \ + if (buf) { \ + ((uint64_t *)buf)[0] = (val); \ + POINTER_SHIFT(buf, sizeof(val)); \ + } \ + NULL; \ }) #define tPutD(buf, val) \ @@ -41,7 +44,14 @@ POINTER_SHIFT(buf, sizeof(val)); \ }) -typedef enum { A, B, C, D } T; +static inline void tPutE(void **buf, uint64_t val) { + if (buf) { + ((uint64_t *)(*buf))[0] = val; + *buf = POINTER_SHIFT(*buf, sizeof(val)); + } +} + +typedef enum { A, B, C, D, E } T; static void func(T t) { uint64_t val = 198; @@ -81,6 +91,14 @@ static void func(T t) { } } break; + case E: + for (size_t i = 0; i < 10 * 1024l * 1024l * 1024l; i++) { + tPutE(&pBuf, val); + if (POINTER_DISTANCE(buf, pBuf) == 1024) { + pBuf = buf; + } + } + break; default: break; @@ -108,5 +126,8 @@ int main(int argc, char const *argv[]) { func(D); uint64_t t5 = now(); printf("D: %ld\n", t5 - t4); + func(E); + uint64_t t6 = now(); + printf("E: %ld\n", t6 - t5); return 0; } diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 5d2b699ea9..775011ad40 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -319,12 +319,12 @@ typedef struct SEpSet { } SEpSet; typedef struct { - int32_t acctId; - int64_t clusterId; - int32_t connId; - int8_t superUser; - int8_t reserved[5]; - SEpSet epSet; + int32_t acctId; + int64_t clusterId; + int32_t connId; + int8_t superUser; + int8_t reserved[5]; + SEpSet epSet; } SConnectRsp; typedef struct { @@ -1129,7 +1129,7 @@ typedef struct SVCreateTbReq { } SVCreateTbReq; static FORCE_INLINE int tSerializeSVCreateTbReq(void** buf, const SVCreateTbReq* pReq) { - int tlen = 0; + int tlen = 0; // uint8_t* pBuf = (uint8_t*)(*buf); // if (TD_RT_ENDIAN() == TD_LITTLE_ENDIAN) { diff --git a/source/dnode/vnode/impl/src/vnodeQuery.c b/source/dnode/vnode/impl/src/vnodeQuery.c index 31481bf7c4..85a2de9dfa 100644 --- a/source/dnode/vnode/impl/src/vnodeQuery.c +++ b/source/dnode/vnode/impl/src/vnodeQuery.c @@ -13,12 +13,10 @@ * along with this program. If not, see . */ -#include "vnodeDef.h" #include "vnodeQuery.h" +#include "vnodeDef.h" -int vnodeQueryOpen(SVnode *pVnode) { - return qWorkerInit(NULL, &pVnode->pQuery); -} +int vnodeQueryOpen(SVnode *pVnode) { return qWorkerInit(NULL, &pVnode->pQuery); } int vnodeProcessQueryReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { vInfo("query message is processed"); @@ -32,4 +30,8 @@ int vnodeProcessFetchReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { return 0; } - +static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { + STableInfoMsg *pReq = (STableInfoMsg *)(pMsg->pCont); + // TODO + return 0; +} \ No newline at end of file