From bb8b91f25b050885c9f73eb053c9b8d6d8ffc97b Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Sun, 26 Apr 2020 11:00:54 +0800 Subject: [PATCH] [td-197] fix bug in taosmsg.h --- src/client/src/tscProfile.c | 11 ++++++----- src/inc/taosmsg.h | 6 ++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index e5c3a3b7f6..61fc1a19c8 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -209,15 +209,15 @@ void tscKillStream(STscObj *pObj, uint32_t killId) { } char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) { - SQqueryList *pQList = (SQqueryList *)pMsg; char * pMax = pMsg + TSDB_PAYLOAD_SIZE - 256; - - SQueryDesc *pQdesc = pQList->qdesc; + + SQqueryList *pQList = (SQqueryList *)pMsg; pQList->numOfQueries = 0; + SQueryDesc *pQdesc = (SQueryDesc*)(pMsg + sizeof(SQqueryList)); + // We extract the lock to tscBuildHeartBeatMsg function. /* pthread_mutex_lock (&pObj->mutex); */ - pMsg += sizeof(SQqueryList); SSqlObj *pSql = pObj->sqlList; while (pSql) { @@ -244,8 +244,9 @@ char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) { } SStreamList *pSList = (SStreamList *)pMsg; - SStreamDesc *pSdesc = pSList->sdesc; pSList->numOfStreams = 0; + + SStreamDesc *pSdesc = (SStreamDesc*) (pMsg + sizeof(SStreamList)); pMsg += sizeof(SStreamList); SSqlStream *pStream = pObj->streamList; diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 6ff522ae43..4573e3a6e8 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -762,14 +762,14 @@ typedef struct { } SMDCfgDnodeMsg, SCMCfgDnodeMsg; typedef struct { - char sql[TSDB_SHOW_SQL_LEN + 1]; + char sql[TSDB_SHOW_SQL_LEN]; uint32_t queryId; int64_t useconds; int64_t stime; } SQueryDesc; typedef struct { - char sql[TSDB_SHOW_SQL_LEN + 1]; + char sql[TSDB_SHOW_SQL_LEN]; uint32_t streamId; int64_t num; // number of computing/cycles int64_t useconds; @@ -781,12 +781,10 @@ typedef struct { typedef struct { int32_t numOfQueries; - SQueryDesc qdesc[]; } SQqueryList; typedef struct { int32_t numOfStreams; - SStreamDesc sdesc[]; } SStreamList; typedef struct { -- GitLab