fix: support statistics of insert_req
This commit is contained in:
parent
6680ed32d2
commit
114ae8dbda
|
@ -29,7 +29,8 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) {
|
||||||
|
|
||||||
SVnodeObj *pVnode = *ppVnode;
|
SVnodeObj *pVnode = *ppVnode;
|
||||||
SVnodeLoad vload = {0};
|
SVnodeLoad vload = {0};
|
||||||
vnodeGetLoad(pVnode->pImpl, &vload, isReset);
|
vnodeGetLoad(pVnode->pImpl, &vload);
|
||||||
|
if (isReset) vnodeResetLoad(pVnode->pImpl, &vload);
|
||||||
taosArrayPush(pInfo->pVloads, &vload);
|
taosArrayPush(pInfo->pVloads, &vload);
|
||||||
pIter = taosHashIterate(pMgmt->hash, pIter);
|
pIter = taosHashIterate(pMgmt->hash, pIter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,8 @@ int32_t vnodeGetCtbNum(SVnode *pVnode, int64_t suid, int64_t *num);
|
||||||
int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num);
|
int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num);
|
||||||
int32_t vnodeGetAllCtbNum(SVnode *pVnode, int64_t *num);
|
int32_t vnodeGetAllCtbNum(SVnode *pVnode, int64_t *num);
|
||||||
|
|
||||||
int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad, bool isReset);
|
void vnodeResetLoad(SVnode *pVnode, SVnodeLoad *pLoad);
|
||||||
|
int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad);
|
||||||
int32_t vnodeValidateTableHash(SVnode *pVnode, char *tableFName);
|
int32_t vnodeValidateTableHash(SVnode *pVnode, char *tableFName);
|
||||||
|
|
||||||
int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg);
|
int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg);
|
||||||
|
|
|
@ -373,7 +373,7 @@ _exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad, bool isReset) {
|
int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
|
||||||
pLoad->vgId = TD_VID(pVnode);
|
pLoad->vgId = TD_VID(pVnode);
|
||||||
pLoad->syncState = syncGetMyRole(pVnode->sync);
|
pLoad->syncState = syncGetMyRole(pVnode->sync);
|
||||||
pLoad->cacheUsage = tsdbCacheGetUsage(pVnode);
|
pLoad->cacheUsage = tsdbCacheGetUsage(pVnode);
|
||||||
|
@ -387,17 +387,22 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad, bool isReset) {
|
||||||
pLoad->numOfInsertSuccessReqs = atomic_load_64(&pVnode->statis.nInsertSuccess);
|
pLoad->numOfInsertSuccessReqs = atomic_load_64(&pVnode->statis.nInsertSuccess);
|
||||||
pLoad->numOfBatchInsertReqs = atomic_load_64(&pVnode->statis.nBatchInsert);
|
pLoad->numOfBatchInsertReqs = atomic_load_64(&pVnode->statis.nBatchInsert);
|
||||||
pLoad->numOfBatchInsertSuccessReqs = atomic_load_64(&pVnode->statis.nBatchInsertSuccess);
|
pLoad->numOfBatchInsertSuccessReqs = atomic_load_64(&pVnode->statis.nBatchInsertSuccess);
|
||||||
|
|
||||||
if (isReset) {
|
|
||||||
VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nInsert, pLoad->numOfInsertReqs, 64);
|
|
||||||
VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nInsertSuccess, pLoad->numOfInsertSuccessReqs, 64);
|
|
||||||
VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nBatchInsert, pLoad->numOfBatchInsertReqs, 64);
|
|
||||||
VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nBatchInsertSuccess, pLoad->numOfBatchInsertSuccessReqs, 64);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reset the statistics value by monitor interval
|
||||||
|
*
|
||||||
|
* @param pVnode
|
||||||
|
* @param pLoad
|
||||||
|
*/
|
||||||
|
void vnodeResetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
|
||||||
|
VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nInsert, pLoad->numOfInsertReqs, 64);
|
||||||
|
VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nInsertSuccess, pLoad->numOfInsertSuccessReqs, 64);
|
||||||
|
VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nBatchInsert, pLoad->numOfBatchInsertReqs, 64);
|
||||||
|
VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nBatchInsertSuccess, pLoad->numOfBatchInsertSuccessReqs, 64);
|
||||||
|
}
|
||||||
|
|
||||||
void vnodeGetInfo(SVnode *pVnode, const char **dbname, int32_t *vgId) {
|
void vnodeGetInfo(SVnode *pVnode, const char **dbname, int32_t *vgId) {
|
||||||
if (dbname) {
|
if (dbname) {
|
||||||
*dbname = pVnode->config.dbname;
|
*dbname = pVnode->config.dbname;
|
||||||
|
|
Loading…
Reference in New Issue