[td-1655]
This commit is contained in:
parent
ef1dc64667
commit
b120f8ce71
|
@ -242,6 +242,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
|
||||||
pQdesc->stime = htobe64(pSql->stime);
|
pQdesc->stime = htobe64(pSql->stime);
|
||||||
pQdesc->queryId = htonl(pSql->queryId);
|
pQdesc->queryId = htonl(pSql->queryId);
|
||||||
pQdesc->useconds = htobe64(pSql->res.useconds);
|
pQdesc->useconds = htobe64(pSql->res.useconds);
|
||||||
|
pQdesc->qHandle = htobe64(pSql->res.qhandle);
|
||||||
|
|
||||||
pHeartbeat->numOfQueries++;
|
pHeartbeat->numOfQueries++;
|
||||||
pQdesc++;
|
pQdesc++;
|
||||||
|
|
|
@ -282,7 +282,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf
|
||||||
#define TSDB_SHELL_VNODE_BITS 24
|
#define TSDB_SHELL_VNODE_BITS 24
|
||||||
#define TSDB_SHELL_SID_MASK 0xFF
|
#define TSDB_SHELL_SID_MASK 0xFF
|
||||||
#define TSDB_HTTP_TOKEN_LEN 20
|
#define TSDB_HTTP_TOKEN_LEN 20
|
||||||
#define TSDB_SHOW_SQL_LEN 64
|
#define TSDB_SHOW_SQL_LEN 512
|
||||||
#define TSDB_SLOW_QUERY_SQL_LEN 512
|
#define TSDB_SLOW_QUERY_SQL_LEN 512
|
||||||
|
|
||||||
#define TSDB_MQTT_HOSTNAME_LEN 64
|
#define TSDB_MQTT_HOSTNAME_LEN 64
|
||||||
|
|
|
@ -740,6 +740,7 @@ typedef struct {
|
||||||
uint32_t queryId;
|
uint32_t queryId;
|
||||||
int64_t useconds;
|
int64_t useconds;
|
||||||
int64_t stime;
|
int64_t stime;
|
||||||
|
uint64_t qHandle;
|
||||||
} SQueryDesc;
|
} SQueryDesc;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -24,15 +24,9 @@
|
||||||
#include "mnode.h"
|
#include "mnode.h"
|
||||||
#include "mnodeDef.h"
|
#include "mnodeDef.h"
|
||||||
#include "mnodeInt.h"
|
#include "mnodeInt.h"
|
||||||
#include "mnodeAcct.h"
|
|
||||||
#include "mnodeDnode.h"
|
|
||||||
#include "mnodeDb.h"
|
|
||||||
#include "mnodeMnode.h"
|
|
||||||
#include "mnodeProfile.h"
|
#include "mnodeProfile.h"
|
||||||
#include "mnodeShow.h"
|
#include "mnodeShow.h"
|
||||||
#include "mnodeTable.h"
|
|
||||||
#include "mnodeUser.h"
|
#include "mnodeUser.h"
|
||||||
#include "mnodeVgroup.h"
|
|
||||||
#include "mnodeWrite.h"
|
#include "mnodeWrite.h"
|
||||||
|
|
||||||
#define CONN_KEEP_TIME (tsShellActivityTimer * 3)
|
#define CONN_KEEP_TIME (tsShellActivityTimer * 3)
|
||||||
|
@ -299,7 +293,7 @@ static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
|
||||||
|
|
||||||
pShow->bytes[cols] = QUERY_ID_SIZE + VARSTR_HEADER_SIZE;
|
pShow->bytes[cols] = QUERY_ID_SIZE + VARSTR_HEADER_SIZE;
|
||||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||||
strcpy(pSchema[cols].name, "queryId");
|
strcpy(pSchema[cols].name, "query_id");
|
||||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
|
@ -315,9 +309,15 @@ static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
|
||||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
|
pShow->bytes[cols] = 24;
|
||||||
|
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||||
|
strcpy(pSchema[cols].name, "qhandle");
|
||||||
|
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||||
|
cols++;
|
||||||
|
|
||||||
pShow->bytes[cols] = 8;
|
pShow->bytes[cols] = 8;
|
||||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||||
strcpy(pSchema[cols].name, "created time");
|
strcpy(pSchema[cols].name, "created_time");
|
||||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
|
||||||
SConnObj *pConnObj = NULL;
|
SConnObj *pConnObj = NULL;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
char * pWrite;
|
char * pWrite;
|
||||||
char ipStr[TSDB_IPv4ADDR_LEN + 6];
|
char str[TSDB_IPv4ADDR_LEN + 6] = {0};
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
|
pShow->pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
|
||||||
|
@ -362,9 +362,9 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
|
||||||
SQueryDesc *pDesc = pConnObj->pQueries + i;
|
SQueryDesc *pDesc = pConnObj->pQueries + i;
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
||||||
snprintf(ipStr, QUERY_ID_SIZE + 1, "%u:%u", pConnObj->connId, htonl(pDesc->queryId));
|
snprintf(str, QUERY_ID_SIZE + 1, "%u:%u", pConnObj->connId, htonl(pDesc->queryId));
|
||||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]);
|
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
|
@ -372,8 +372,15 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port);
|
snprintf(str, tListLen(str), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port);
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]);
|
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->bytes[cols]);
|
||||||
|
cols++;
|
||||||
|
|
||||||
|
char handleBuf[24] = {0};
|
||||||
|
snprintf(handleBuf, tListLen(handleBuf), "%p", (void*)htobe64(pDesc->qHandle));
|
||||||
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
|
|
||||||
|
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, handleBuf, pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
|
@ -393,8 +400,7 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
|
||||||
}
|
}
|
||||||
|
|
||||||
pShow->numOfReads += numOfRows;
|
pShow->numOfReads += numOfRows;
|
||||||
const int32_t NUM_OF_COLUMNS = 6;
|
mnodeVacuumResult(data, cols, numOfRows, rows, pShow);
|
||||||
mnodeVacuumResult(data, NUM_OF_COLUMNS, numOfRows, rows, pShow);
|
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue