提交 8ffb0688 编写于 作者: G Ganlin Zhao

changed req counters fron int32_t to int64_t

上级 060ca48c
...@@ -28,8 +28,8 @@ static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); ...@@ -28,8 +28,8 @@ static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *);
static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *); static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *);
static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey); static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey);
static void * tsShellRpc = NULL; static void * tsShellRpc = NULL;
static int32_t tsQueryReqNum = 0; static int64_t tsQueryReqNum = 0;
static int32_t tsSubmitReqNum = 0; static int64_t tsSubmitReqNum = 0;
int32_t dnodeInitShell() { int32_t dnodeInitShell() {
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_SUBMIT] = dnodeDispatchToVWriteQueue; dnodeProcessShellMsgFp[TSDB_MSG_TYPE_SUBMIT] = dnodeDispatchToVWriteQueue;
...@@ -136,9 +136,9 @@ static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *pEpSet) { ...@@ -136,9 +136,9 @@ static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcEpSet *pEpSet) {
} }
if (pMsg->msgType == TSDB_MSG_TYPE_QUERY) { if (pMsg->msgType == TSDB_MSG_TYPE_QUERY) {
atomic_fetch_add_32(&tsQueryReqNum, 1); atomic_fetch_add_64(&tsQueryReqNum, 1);
} else if (pMsg->msgType == TSDB_MSG_TYPE_SUBMIT) { } else if (pMsg->msgType == TSDB_MSG_TYPE_SUBMIT) {
atomic_fetch_add_32(&tsSubmitReqNum, 1); atomic_fetch_add_64(&tsSubmitReqNum, 1);
} else {} } else {}
if ( dnodeProcessShellMsgFp[pMsg->msgType] ) { if ( dnodeProcessShellMsgFp[pMsg->msgType] ) {
...@@ -243,8 +243,8 @@ SDnodeStatisInfo dnodeGetStatisInfo() { ...@@ -243,8 +243,8 @@ SDnodeStatisInfo dnodeGetStatisInfo() {
#ifdef HTTP_EMBEDDED #ifdef HTTP_EMBEDDED
info.httpReqNum = httpGetReqCount(); info.httpReqNum = httpGetReqCount();
#endif #endif
info.queryReqNum = atomic_exchange_32(&tsQueryReqNum, 0); info.queryReqNum = atomic_exchange_64(&tsQueryReqNum, 0);
info.submitReqNum = atomic_exchange_32(&tsSubmitReqNum, 0); info.submitReqNum = atomic_exchange_64(&tsSubmitReqNum, 0);
} }
return info; return info;
......
...@@ -25,9 +25,9 @@ extern "C" { ...@@ -25,9 +25,9 @@ extern "C" {
#define MAX_HTTP_STATUS_CODE_NUM 63 #define MAX_HTTP_STATUS_CODE_NUM 63
typedef struct { typedef struct {
int32_t queryReqNum; int64_t queryReqNum;
int32_t submitReqNum; int64_t submitReqNum;
int32_t httpReqNum; int64_t httpReqNum;
} SDnodeStatisInfo; } SDnodeStatisInfo;
SDnodeStatisInfo dnodeGetStatisInfo(); SDnodeStatisInfo dnodeGetStatisInfo();
......
...@@ -23,9 +23,9 @@ extern "C" { ...@@ -23,9 +23,9 @@ extern "C" {
#include "twal.h" #include "twal.h"
typedef struct { typedef struct {
int32_t submitReqSucNum; int64_t submitReqSucNum;
int32_t submitRowNum; int64_t submitRowNum;
int32_t submitRowSucNum; int64_t submitRowSucNum;
} SVnodeStatisInfo; } SVnodeStatisInfo;
typedef struct { typedef struct {
......
...@@ -188,7 +188,7 @@ typedef struct HttpServer { ...@@ -188,7 +188,7 @@ typedef struct HttpServer {
SOCKET fd; SOCKET fd;
int32_t numOfThreads; int32_t numOfThreads;
int32_t methodScannerLen; int32_t methodScannerLen;
int32_t requestNum; int64_t requestNum;
int32_t status; int32_t status;
int32_t statusCodeErrs[HTTP_STATUS_CODE_NUM]; int32_t statusCodeErrs[HTTP_STATUS_CODE_NUM];
pthread_t thread; pthread_t thread;
......
...@@ -190,7 +190,7 @@ static void httpProcessHttpData(void *param) { ...@@ -190,7 +190,7 @@ static void httpProcessHttpData(void *param) {
} else { } else {
if (httpReadData(pContext)) { if (httpReadData(pContext)) {
(*(pThread->processData))(pContext); (*(pThread->processData))(pContext);
atomic_fetch_add_32(&pServer->requestNum, 1); atomic_fetch_add_64(&pServer->requestNum, 1);
} }
} }
} }
......
...@@ -120,8 +120,7 @@ void httpCleanUpSystem() { ...@@ -120,8 +120,7 @@ void httpCleanUpSystem() {
tsHttpServer.status = HTTP_SERVER_CLOSED; tsHttpServer.status = HTTP_SERVER_CLOSED;
} }
int32_t httpGetReqCount() { return atomic_load_32(&tsHttpServer.requestNum); } int32_t httpGetReqCount() { return atomic_exchange_64(&tsHttpServer.requestNum, 0); }
int32_t httpClearReqCount() { return atomic_exchange_32(&tsHttpServer.requestNum, 0); }
int32_t httpGetStatusCodeCount(int index) { int32_t httpGetStatusCodeCount(int index) {
return atomic_load_32(&tsHttpServer.statusCodeErrs[index]); return atomic_load_32(&tsHttpServer.statusCodeErrs[index]);
} }
......
...@@ -355,7 +355,7 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) { ...@@ -355,7 +355,7 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) {
", disk_used float, disk_total int" ", disk_used float, disk_total int"
", band_speed float" ", band_speed float"
", io_read float, io_write float" ", io_read float, io_write float"
", req_http int, req_select int, req_insert int" ", req_http bigint, req_select bigint, req_insert bigint"
") tags (dnodeid int, fqdn binary(%d))", ") tags (dnodeid int, fqdn binary(%d))",
tsMonitorDbName, TSDB_FQDN_LEN); tsMonitorDbName, TSDB_FQDN_LEN);
} else if (cmd == MON_CMD_CREATE_TB_DN) { } else if (cmd == MON_CMD_CREATE_TB_DN) {
...@@ -411,10 +411,10 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) { ...@@ -411,10 +411,10 @@ static void monBuildMonitorSql(char *sql, int32_t cmd) {
", net_in float, net_out float" ", net_in float, net_out float"
", io_read float, io_write float" ", io_read float, io_write float"
", io_read_disk float, io_write_disk float" ", io_read_disk float, io_write_disk float"
", req_http int, req_http_rate float" ", req_http bigint, req_http_rate float"
", req_select int, req_select_rate float" ", req_select bigint, req_select_rate float"
", req_insert int, req_insert_success int, req_insert_rate float" ", req_insert bigint, req_insert_success bigint, req_insert_rate float"
", req_insert_batch int, req_insert_batch_success int, req_insert_batch_rate float" ", req_insert_batch bigint, req_insert_batch_success bigint, req_insert_batch_rate float"
", errors bigint" ", errors bigint"
", vnodes_num int" ", vnodes_num int"
", masters int" ", masters int"
...@@ -564,7 +564,7 @@ static int32_t monBuildBandSql(char *sql) { ...@@ -564,7 +564,7 @@ static int32_t monBuildBandSql(char *sql) {
static int32_t monBuildReqSql(char *sql) { static int32_t monBuildReqSql(char *sql) {
SDnodeStatisInfo info = tsMonStat.dInfo; SDnodeStatisInfo info = tsMonStat.dInfo;
return snprintf(sql, SQL_LENGTH, ", %d, %d, %d)", info.httpReqNum, info.queryReqNum, info.submitReqNum); return snprintf(sql, SQL_LENGTH, ", %"PRId64", %"PRId64", %"PRId64")", info.httpReqNum, info.queryReqNum, info.submitReqNum);
} }
static int32_t monBuildIoSql(char *sql) { static int32_t monBuildIoSql(char *sql) {
...@@ -891,11 +891,11 @@ static int32_t monBuildNetworkIOSql(char *sql) { ...@@ -891,11 +891,11 @@ static int32_t monBuildNetworkIOSql(char *sql) {
} }
static int32_t monBuildDnodeReqSql(char *sql) { static int32_t monBuildDnodeReqSql(char *sql) {
int32_t queryReqNum = tsMonStat.dInfo.queryReqNum - tsMonStat.monQueryReqCnt; int64_t queryReqNum = tsMonStat.dInfo.queryReqNum - tsMonStat.monQueryReqCnt;
int32_t submitReqNum = tsMonStat.dInfo.submitReqNum; int64_t submitReqNum = tsMonStat.dInfo.submitReqNum;
int32_t submitRowNum = tsMonStat.vInfo.submitRowNum; int64_t submitRowNum = tsMonStat.vInfo.submitRowNum;
int32_t submitReqSucNum = tsMonStat.vInfo.submitReqSucNum; int64_t submitReqSucNum = tsMonStat.vInfo.submitReqSucNum;
int32_t submitRowSucNum = tsMonStat.vInfo.submitRowSucNum; int64_t submitRowSucNum = tsMonStat.vInfo.submitRowSucNum;
float interval = (float)(tsMonitorInterval * 1.0); float interval = (float)(tsMonitorInterval * 1.0);
float httpReqRate = tsMonStat.dInfo.httpReqNum / interval; float httpReqRate = tsMonStat.dInfo.httpReqNum / interval;
...@@ -903,7 +903,8 @@ static int32_t monBuildDnodeReqSql(char *sql) { ...@@ -903,7 +903,8 @@ static int32_t monBuildDnodeReqSql(char *sql) {
float submitReqRate = submitReqNum / interval; float submitReqRate = submitReqNum / interval;
float submitRowRate = submitRowNum / interval; float submitRowRate = submitRowNum / interval;
return snprintf(sql, SQL_LENGTH, ", %d, %f, %d, %f, %d, %d, %f, %d, %d, %f", tsMonStat.dInfo.httpReqNum, httpReqRate, return snprintf(sql, SQL_LENGTH, ", %"PRId64", %f, %"PRId64", %f, %"PRId64", %"PRId64", %f, %"PRId64", %"PRId64", %f",
tsMonStat.dInfo.httpReqNum, httpReqRate,
queryReqNum, queryReqRate, queryReqNum, queryReqRate,
submitRowNum, submitRowSucNum, submitRowRate, submitRowNum, submitRowSucNum, submitRowRate,
submitReqNum, submitReqSucNum, submitReqRate); submitReqNum, submitReqSucNum, submitReqRate);
......
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
#define MAX_QUEUED_MSG_NUM 100000 #define MAX_QUEUED_MSG_NUM 100000
#define MAX_QUEUED_MSG_SIZE 1024*1024*1024 //1GB #define MAX_QUEUED_MSG_SIZE 1024*1024*1024 //1GB
static int32_t tsSubmitReqSucNum = 0; static int64_t tsSubmitReqSucNum = 0;
static int32_t tsSubmitRowNum = 0; static int64_t tsSubmitRowNum = 0;
static int32_t tsSubmitRowSucNum = 0; static int64_t tsSubmitRowSucNum = 0;
extern void * tsDnodeTmr; extern void * tsDnodeTmr;
static int32_t (*vnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *, void *pCont, SRspRet *); static int32_t (*vnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *, void *pCont, SRspRet *);
...@@ -170,12 +170,12 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR ...@@ -170,12 +170,12 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR
if (tsdbInsertData(pVnode->tsdb, pCont, pRsp) < 0) { if (tsdbInsertData(pVnode->tsdb, pCont, pRsp) < 0) {
code = terrno; code = terrno;
} else { } else {
if (pRsp != NULL) atomic_fetch_add_32(&tsSubmitReqSucNum, 1); if (pRsp != NULL) atomic_fetch_add_64(&tsSubmitReqSucNum, 1);
} }
if (pRsp) { if (pRsp) {
atomic_fetch_add_32(&tsSubmitRowNum, ntohl(pRsp->numOfRows)); atomic_fetch_add_64(&tsSubmitRowNum, ntohl(pRsp->numOfRows));
atomic_fetch_add_32(&tsSubmitRowSucNum, ntohl(pRsp->affectedRows)); atomic_fetch_add_64(&tsSubmitRowSucNum, ntohl(pRsp->affectedRows));
} }
return code; return code;
...@@ -441,9 +441,9 @@ void vnodeWaitWriteCompleted(SVnodeObj *pVnode) { ...@@ -441,9 +441,9 @@ void vnodeWaitWriteCompleted(SVnodeObj *pVnode) {
SVnodeStatisInfo vnodeGetStatisInfo() { SVnodeStatisInfo vnodeGetStatisInfo() {
SVnodeStatisInfo info = {0}; SVnodeStatisInfo info = {0};
info.submitReqSucNum = atomic_exchange_32(&tsSubmitReqSucNum, 0); info.submitReqSucNum = atomic_exchange_64(&tsSubmitReqSucNum, 0);
info.submitRowNum = atomic_exchange_32(&tsSubmitRowNum, 0); info.submitRowNum = atomic_exchange_64(&tsSubmitRowNum, 0);
info.submitRowSucNum = atomic_exchange_32(&tsSubmitRowSucNum, 0); info.submitRowSucNum = atomic_exchange_64(&tsSubmitRowSucNum, 0);
return info; return info;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册