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