diff --git a/src/inc/dnode.h b/src/inc/dnode.h index 8decb0202313da399d0de9e8af145e4117461342..0ee2b78d80f7d7b25821e01bc2cd5228c4439f24 100644 --- a/src/inc/dnode.h +++ b/src/inc/dnode.h @@ -26,6 +26,9 @@ extern "C" { typedef struct { int32_t queryReqNum; int32_t submitReqNum; + int32_t submitReqSucNum; + int32_t submitRowNum; + int32_t submitRowSucNum; int32_t httpReqNum; } SStatisInfo; diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 35c2ab72dfdf55f66b1095c757fc4f90656c842b..64fca2d52a5d785c3c6a244379d55fc69ab70488 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -27,6 +27,10 @@ #define MAX_QUEUED_MSG_NUM 100000 #define MAX_QUEUED_MSG_SIZE 1024*1024*1024 //1GB +static int32_t tsSubmitReqSucNum = 0; +static int32_t tsSubmitRowNum = 0; +static int32_t tsSubmitRowSucNum = 0; + extern void * tsDnodeTmr; static int32_t (*vnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *, void *pCont, SRspRet *); static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *); @@ -163,7 +167,13 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR pRsp = pRet->rsp; } - if (tsdbInsertData(pVnode->tsdb, pCont, pRsp) < 0) code = terrno; + if (tsdbInsertData(pVnode->tsdb, pCont, pRsp) < 0) { + code = terrno; + } else { + atomic_fetch_add_32(&tsSubmitReqSucNum, 1); + } + atomic_fetch_add_32(&tsSubmitRowNum, pRsp->numOfRows); + atomic_fetch_add_32(&tsSubmitRowSucNum, pRsp->affectedRows); return code; } @@ -425,3 +435,15 @@ void vnodeWaitWriteCompleted(SVnodeObj *pVnode) { if (extraSleep) taosMsleep(900); } + +void vnodeGetStatisInfo(SStatisInfo *info) { + info->submitReqSucNum = atomic_load_32(&tsSubmitReqSucNum); + info->submitRowNum = atomic_load_32(&tsSubmitRowNum); + info->submitRowSucNum = atomic_load_32(&tsSubmitRowSucNum); +} + +void vnodeClearStatisInfo() { + atomic_exchange_32(&tsSubmitReqSucNum, 0); + atomic_exchange_32(&tsSubmitRowNum, 0); + atomic_exchange_32(&tsSubmitRowSucNum, 0); +}