Merge pull request #17506 from taosdata/enh/TD-19660
fix: improve test coverage
This commit is contained in:
commit
2e82fdee93
|
@ -161,10 +161,6 @@ typedef struct {
|
|||
SMonLogs log;
|
||||
} SMonMmInfo;
|
||||
|
||||
int32_t tSerializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo);
|
||||
int32_t tDeserializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo);
|
||||
void tFreeSMonMmInfo(SMonMmInfo *pInfo);
|
||||
|
||||
typedef struct {
|
||||
SArray *datadirs; // array of SMonDiskDesc
|
||||
} SMonDiskInfo;
|
||||
|
@ -176,56 +172,31 @@ typedef struct {
|
|||
SMonLogs log;
|
||||
} SMonVmInfo;
|
||||
|
||||
int32_t tSerializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo);
|
||||
int32_t tDeserializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo);
|
||||
void tFreeSMonVmInfo(SMonVmInfo *pInfo);
|
||||
|
||||
typedef struct {
|
||||
SMonSysInfo sys;
|
||||
SMonLogs log;
|
||||
SQnodeLoad load;
|
||||
} SMonQmInfo;
|
||||
|
||||
int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo);
|
||||
int32_t tDeserializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo);
|
||||
void tFreeSMonQmInfo(SMonQmInfo *pInfo);
|
||||
|
||||
typedef struct {
|
||||
SMonSysInfo sys;
|
||||
SMonLogs log;
|
||||
} SMonSmInfo;
|
||||
|
||||
int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo);
|
||||
int32_t tDeserializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo);
|
||||
void tFreeSMonSmInfo(SMonSmInfo *pInfo);
|
||||
typedef struct {
|
||||
SMonSysInfo sys;
|
||||
SMonLogs log;
|
||||
} SMonBmInfo;
|
||||
|
||||
int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo);
|
||||
int32_t tDeserializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo);
|
||||
void tFreeSMonBmInfo(SMonBmInfo *pInfo);
|
||||
|
||||
typedef struct {
|
||||
SArray *pVloads; // SVnodeLoad
|
||||
} SMonVloadInfo;
|
||||
|
||||
int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo);
|
||||
int32_t tDeserializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo);
|
||||
void tFreeSMonVloadInfo(SMonVloadInfo *pInfo);
|
||||
|
||||
typedef struct {
|
||||
int8_t isMnode;
|
||||
SMnodeLoad load;
|
||||
} SMonMloadInfo;
|
||||
|
||||
int32_t tSerializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInfo);
|
||||
int32_t tDeserializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInfo);
|
||||
|
||||
int32_t tSerializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo);
|
||||
int32_t tDeserializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo);
|
||||
|
||||
typedef struct {
|
||||
const char *server;
|
||||
uint16_t port;
|
||||
|
@ -245,6 +216,12 @@ void monSetSmInfo(SMonSmInfo *pInfo);
|
|||
void monSetBmInfo(SMonBmInfo *pInfo);
|
||||
void monSendReport();
|
||||
|
||||
void tFreeSMonMmInfo(SMonMmInfo *pInfo);
|
||||
void tFreeSMonVmInfo(SMonVmInfo *pInfo);
|
||||
void tFreeSMonQmInfo(SMonQmInfo *pInfo);
|
||||
void tFreeSMonSmInfo(SMonSmInfo *pInfo);
|
||||
void tFreeSMonBmInfo(SMonBmInfo *pInfo);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -450,17 +450,10 @@ static void monGenDiskJson(SMonInfo *pMonitor) {
|
|||
}
|
||||
|
||||
static const char *monLogLevelStr(ELogLevel level) {
|
||||
switch (level) {
|
||||
case DEBUG_ERROR:
|
||||
return "error";
|
||||
case DEBUG_INFO:
|
||||
return "info";
|
||||
case DEBUG_DEBUG:
|
||||
return "debug";
|
||||
case DEBUG_TRACE:
|
||||
return "trace";
|
||||
default:
|
||||
return "undefine";
|
||||
if (level == DEBUG_ERROR) {
|
||||
return "error";
|
||||
} else {
|
||||
return "info";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,272 +18,6 @@
|
|||
#include "tcoding.h"
|
||||
#include "tencode.h"
|
||||
|
||||
static int32_t tEncodeSMonSysInfo(SEncoder *encoder, const SMonSysInfo *pInfo) {
|
||||
if (tEncodeDouble(encoder, pInfo->cpu_engine) < 0) return -1;
|
||||
if (tEncodeDouble(encoder, pInfo->cpu_system) < 0) return -1;
|
||||
if (tEncodeFloat(encoder, pInfo->cpu_cores) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->mem_engine) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->mem_system) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->mem_total) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->disk_engine) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->disk_used) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->disk_total) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->net_in) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->net_out) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->io_read) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->io_write) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->io_read_disk) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->io_write_disk) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tDecodeSMonSysInfo(SDecoder *decoder, SMonSysInfo *pInfo) {
|
||||
if (tDecodeDouble(decoder, &pInfo->cpu_engine) < 0) return -1;
|
||||
if (tDecodeDouble(decoder, &pInfo->cpu_system) < 0) return -1;
|
||||
if (tDecodeFloat(decoder, &pInfo->cpu_cores) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->mem_engine) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->mem_system) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->mem_total) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->disk_engine) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->disk_used) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->disk_total) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->net_in) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->net_out) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->io_read) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->io_write) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->io_read_disk) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->io_write_disk) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tEncodeSMonLogs(SEncoder *encoder, const SMonLogs *pInfo) {
|
||||
if (tEncodeI32(encoder, pInfo->numOfErrorLogs) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->numOfInfoLogs) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->numOfDebugLogs) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->numOfTraceLogs) < 0) return -1;
|
||||
if (tEncodeI32(encoder, taosArrayGetSize(pInfo->logs)) < 0) return -1;
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pInfo->logs); ++i) {
|
||||
SMonLogItem *pLog = taosArrayGet(pInfo->logs, i);
|
||||
if (tEncodeI64(encoder, pLog->ts) < 0) return -1;
|
||||
if (tEncodeI8(encoder, pLog->level) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pLog->content) < 0) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tDecodeSMonLogs(SDecoder *decoder, SMonLogs *pInfo) {
|
||||
if (tDecodeI32(decoder, &pInfo->numOfErrorLogs) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->numOfInfoLogs) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->numOfDebugLogs) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->numOfTraceLogs) < 0) return -1;
|
||||
|
||||
int32_t arraySize = 0;
|
||||
if (tDecodeI32(decoder, &arraySize) < 0) return -1;
|
||||
|
||||
pInfo->logs = taosArrayInit(arraySize, sizeof(SMonLogItem));
|
||||
if (pInfo->logs == NULL) return -1;
|
||||
|
||||
for (int32_t i = 0; i < arraySize; ++i) {
|
||||
SMonLogItem desc = {0};
|
||||
if (tDecodeI64(decoder, &desc.ts) < 0) return -1;
|
||||
int8_t level = 0;
|
||||
if (tDecodeI8(decoder, &level) < 0) return -1;
|
||||
desc.level = level;
|
||||
if (tDecodeCStrTo(decoder, desc.content) < 0) return -1;
|
||||
taosArrayPush(pInfo->logs, &desc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tEncodeSMonClusterInfo(SEncoder *encoder, const SMonClusterInfo *pInfo) {
|
||||
if (tEncodeCStr(encoder, pInfo->first_ep) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->first_ep_dnode_id) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pInfo->version) < 0) return -1;
|
||||
if (tEncodeFloat(encoder, pInfo->master_uptime) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->monitor_interval) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->dbs_total) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->stbs_total) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->tbs_total) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->vgroups_total) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->vgroups_alive) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->vnodes_total) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->vnodes_alive) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pInfo->connections_total) < 0) return -1;
|
||||
if (tEncodeI32(encoder, taosArrayGetSize(pInfo->dnodes)) < 0) return -1;
|
||||
if (tEncodeI32(encoder, taosArrayGetSize(pInfo->mnodes)) < 0) return -1;
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pInfo->dnodes); ++i) {
|
||||
SMonDnodeDesc *pDesc = taosArrayGet(pInfo->dnodes, i);
|
||||
if (tEncodeI32(encoder, pDesc->dnode_id) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pDesc->dnode_ep) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pDesc->status) < 0) return -1;
|
||||
}
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pInfo->mnodes); ++i) {
|
||||
SMonMnodeDesc *pDesc = taosArrayGet(pInfo->mnodes, i);
|
||||
if (tEncodeI32(encoder, pDesc->mnode_id) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pDesc->mnode_ep) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pDesc->role) < 0) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tDecodeSMonClusterInfo(SDecoder *decoder, SMonClusterInfo *pInfo) {
|
||||
if (tDecodeCStrTo(decoder, pInfo->first_ep) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->first_ep_dnode_id) < 0) return -1;
|
||||
if (tDecodeCStrTo(decoder, pInfo->version) < 0) return -1;
|
||||
if (tDecodeFloat(decoder, &pInfo->master_uptime) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->monitor_interval) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->dbs_total) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->stbs_total) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->tbs_total) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->vgroups_total) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->vgroups_alive) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->vnodes_total) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->vnodes_alive) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pInfo->connections_total) < 0) return -1;
|
||||
|
||||
int32_t dnodesSize = 0;
|
||||
int32_t mnodesSize = 0;
|
||||
if (tDecodeI32(decoder, &dnodesSize) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &mnodesSize) < 0) return -1;
|
||||
|
||||
pInfo->dnodes = taosArrayInit(dnodesSize, sizeof(SMonDnodeDesc));
|
||||
pInfo->mnodes = taosArrayInit(mnodesSize, sizeof(SMonMnodeDesc));
|
||||
if (pInfo->dnodes == NULL || pInfo->mnodes == NULL) return -1;
|
||||
|
||||
for (int32_t i = 0; i < dnodesSize; ++i) {
|
||||
SMonDnodeDesc desc = {0};
|
||||
if (tDecodeI32(decoder, &desc.dnode_id) < 0) return -1;
|
||||
if (tDecodeCStrTo(decoder, desc.dnode_ep) < 0) return -1;
|
||||
if (tDecodeCStrTo(decoder, desc.status) < 0) return -1;
|
||||
taosArrayPush(pInfo->dnodes, &desc);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < mnodesSize; ++i) {
|
||||
SMonMnodeDesc desc = {0};
|
||||
if (tDecodeI32(decoder, &desc.mnode_id) < 0) return -1;
|
||||
if (tDecodeCStrTo(decoder, desc.mnode_ep) < 0) return -1;
|
||||
if (tDecodeCStrTo(decoder, desc.role) < 0) return -1;
|
||||
taosArrayPush(pInfo->mnodes, &desc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tEncodeSMonVgroupInfo(SEncoder *encoder, const SMonVgroupInfo *pInfo) {
|
||||
if (tEncodeI32(encoder, taosArrayGetSize(pInfo->vgroups)) < 0) return -1;
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pInfo->vgroups); ++i) {
|
||||
SMonVgroupDesc *pDesc = taosArrayGet(pInfo->vgroups, i);
|
||||
if (tEncodeI32(encoder, pDesc->vgroup_id) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pDesc->tables_num) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pDesc->database_name) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pDesc->status) < 0) return -1;
|
||||
for (int32_t j = 0; j < TSDB_MAX_REPLICA; ++j) {
|
||||
SMonVnodeDesc *pVDesc = &pDesc->vnodes[j];
|
||||
if (tEncodeI32(encoder, pVDesc->dnode_id) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pVDesc->vnode_role) < 0) return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tDecodeSMonVgroupInfo(SDecoder *decoder, SMonVgroupInfo *pInfo) {
|
||||
int32_t arraySize = 0;
|
||||
if (tDecodeI32(decoder, &arraySize) < 0) return -1;
|
||||
|
||||
pInfo->vgroups = taosArrayInit(arraySize, sizeof(SMonVgroupDesc));
|
||||
if (pInfo->vgroups == NULL) return -1;
|
||||
|
||||
for (int32_t i = 0; i < arraySize; ++i) {
|
||||
SMonVgroupDesc desc = {0};
|
||||
if (tDecodeI32(decoder, &desc.vgroup_id) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &desc.tables_num) < 0) return -1;
|
||||
if (tDecodeCStrTo(decoder, desc.database_name) < 0) return -1;
|
||||
if (tDecodeCStrTo(decoder, desc.status) < 0) return -1;
|
||||
for (int32_t j = 0; j < TSDB_MAX_REPLICA; ++j) {
|
||||
SMonVnodeDesc *pVDesc = &desc.vnodes[j];
|
||||
if (tDecodeI32(decoder, &pVDesc->dnode_id) < 0) return -1;
|
||||
if (tDecodeCStrTo(decoder, pVDesc->vnode_role) < 0) return -1;
|
||||
}
|
||||
taosArrayPush(pInfo->vgroups, &desc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tEncodeSMonStbInfo(SEncoder *encoder, const SMonStbInfo *pInfo) {
|
||||
if (tEncodeI32(encoder, taosArrayGetSize(pInfo->stbs)) < 0) return -1;
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pInfo->stbs); ++i) {
|
||||
SMonStbDesc *pDesc = taosArrayGet(pInfo->stbs, i);
|
||||
if (tEncodeCStr(encoder, pDesc->stb_name) < 0) return -1;
|
||||
if (tEncodeCStr(encoder, pDesc->database_name) < 0) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tDecodeSMonStbInfo(SDecoder *decoder, SMonStbInfo *pInfo) {
|
||||
int32_t arraySize = 0;
|
||||
if (tDecodeI32(decoder, &arraySize) < 0) return -1;
|
||||
|
||||
pInfo->stbs = taosArrayInit(arraySize, sizeof(SMonStbDesc));
|
||||
if (pInfo->stbs == NULL) return -1;
|
||||
|
||||
for (int32_t i = 0; i < arraySize; ++i) {
|
||||
SMonStbDesc desc = {0};
|
||||
if (tDecodeCStrTo(decoder, desc.stb_name) < 0) return -1;
|
||||
if (tDecodeCStrTo(decoder, desc.database_name) < 0) return -1;
|
||||
taosArrayPush(pInfo->stbs, &desc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tEncodeSMonGrantInfo(SEncoder *encoder, const SMonGrantInfo *pInfo) {
|
||||
if (tEncodeI32(encoder, pInfo->expire_time) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->timeseries_used) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pInfo->timeseries_total) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tDecodeSMonGrantInfo(SDecoder *decoder, SMonGrantInfo *pInfo) {
|
||||
if (tDecodeI32(decoder, &pInfo->expire_time) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->timeseries_used) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pInfo->timeseries_total) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeSMonClusterInfo(&encoder, &pInfo->cluster) < 0) return -1;
|
||||
if (tEncodeSMonVgroupInfo(&encoder, &pInfo->vgroup) < 0) return -1;
|
||||
if (tEncodeSMonStbInfo(&encoder, &pInfo->stb) < 0) return -1;
|
||||
if (tEncodeSMonGrantInfo(&encoder, &pInfo->grant) < 0) return -1;
|
||||
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
|
||||
if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSMonMmInfo(void *buf, int32_t bufLen, SMonMmInfo *pInfo) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeSMonClusterInfo(&decoder, &pInfo->cluster) < 0) return -1;
|
||||
if (tDecodeSMonVgroupInfo(&decoder, &pInfo->vgroup) < 0) return -1;
|
||||
if (tDecodeSMonStbInfo(&decoder, &pInfo->stb) < 0) return -1;
|
||||
if (tDecodeSMonGrantInfo(&decoder, &pInfo->grant) < 0) return -1;
|
||||
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
|
||||
if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tFreeSMonMmInfo(SMonMmInfo *pInfo) {
|
||||
taosArrayDestroy(pInfo->log.logs);
|
||||
taosArrayDestroy(pInfo->cluster.mnodes);
|
||||
|
@ -297,106 +31,6 @@ void tFreeSMonMmInfo(SMonMmInfo *pInfo) {
|
|||
pInfo->log.logs = NULL;
|
||||
}
|
||||
|
||||
int32_t tEncodeSMonDiskDesc(SEncoder *encoder, const SMonDiskDesc *pDesc) {
|
||||
if (tEncodeCStr(encoder, pDesc->name) < 0) return -1;
|
||||
if (tEncodeI8(encoder, pDesc->level) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pDesc->size.total) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pDesc->size.used) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pDesc->size.avail) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tDecodeSMonDiskDesc(SDecoder *decoder, SMonDiskDesc *pDesc) {
|
||||
if (tDecodeCStrTo(decoder, pDesc->name) < 0) return -1;
|
||||
if (tDecodeI8(decoder, &pDesc->level) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pDesc->size.total) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pDesc->size.used) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pDesc->size.avail) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tEncodeSMonDiskInfo(SEncoder *encoder, const SMonDiskInfo *pInfo) {
|
||||
if (tEncodeI32(encoder, taosArrayGetSize(pInfo->datadirs)) < 0) return -1;
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pInfo->datadirs); ++i) {
|
||||
SMonDiskDesc *pDesc = taosArrayGet(pInfo->datadirs, i);
|
||||
if (tEncodeSMonDiskDesc(encoder, pDesc) < 0) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tDecodeSMonDiskInfo(SDecoder *decoder, SMonDiskInfo *pInfo) {
|
||||
int32_t arraySize = 0;
|
||||
if (tDecodeI32(decoder, &arraySize) < 0) return -1;
|
||||
|
||||
pInfo->datadirs = taosArrayInit(arraySize, sizeof(SMonDiskDesc));
|
||||
if (pInfo->datadirs == NULL) return -1;
|
||||
|
||||
for (int32_t i = 0; i < arraySize; ++i) {
|
||||
SMonDiskDesc desc = {0};
|
||||
if (tDecodeSMonDiskDesc(decoder, &desc) < 0) return -1;
|
||||
taosArrayPush(pInfo->datadirs, &desc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tEncodeSVnodesStat(SEncoder *encoder, const SVnodesStat *pStat) {
|
||||
if (tEncodeI32(encoder, pStat->openVnodes) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pStat->totalVnodes) < 0) return -1;
|
||||
if (tEncodeI32(encoder, pStat->masterNum) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pStat->numOfSelectReqs) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pStat->numOfInsertReqs) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pStat->numOfInsertSuccessReqs) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pStat->numOfBatchInsertReqs) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pStat->numOfBatchInsertSuccessReqs) < 0) return -1;
|
||||
if (tEncodeI64(encoder, pStat->errors) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tDecodeSVnodesStat(SDecoder *decoder, SVnodesStat *pStat) {
|
||||
if (tDecodeI32(decoder, &pStat->openVnodes) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pStat->totalVnodes) < 0) return -1;
|
||||
if (tDecodeI32(decoder, &pStat->masterNum) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pStat->numOfSelectReqs) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pStat->numOfInsertReqs) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pStat->numOfInsertSuccessReqs) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pStat->numOfBatchInsertReqs) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pStat->numOfBatchInsertSuccessReqs) < 0) return -1;
|
||||
if (tDecodeI64(decoder, &pStat->errors) < 0) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeSMonDiskInfo(&encoder, &pInfo->tfs) < 0) return -1;
|
||||
if (tEncodeSVnodesStat(&encoder, &pInfo->vstat) < 0) return -1;
|
||||
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
|
||||
if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSMonVmInfo(void *buf, int32_t bufLen, SMonVmInfo *pInfo) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeSMonDiskInfo(&decoder, &pInfo->tfs) < 0) return -1;
|
||||
if (tDecodeSVnodesStat(&decoder, &pInfo->vstat) < 0) return -1;
|
||||
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
|
||||
if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tFreeSMonVmInfo(SMonVmInfo *pInfo) {
|
||||
taosArrayDestroy(pInfo->log.logs);
|
||||
taosArrayDestroy(pInfo->tfs.datadirs);
|
||||
|
@ -404,243 +38,17 @@ void tFreeSMonVmInfo(SMonVmInfo *pInfo) {
|
|||
pInfo->tfs.datadirs = NULL;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
|
||||
if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSMonQmInfo(void *buf, int32_t bufLen, SMonQmInfo *pInfo) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
|
||||
if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tFreeSMonQmInfo(SMonQmInfo *pInfo) {
|
||||
taosArrayDestroy(pInfo->log.logs);
|
||||
pInfo->log.logs = NULL;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
|
||||
if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSMonSmInfo(void *buf, int32_t bufLen, SMonSmInfo *pInfo) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
|
||||
if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tFreeSMonSmInfo(SMonSmInfo *pInfo) {
|
||||
taosArrayDestroy(pInfo->log.logs);
|
||||
pInfo->log.logs = NULL;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeSMonSysInfo(&encoder, &pInfo->sys) < 0) return -1;
|
||||
if (tEncodeSMonLogs(&encoder, &pInfo->log) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSMonBmInfo(void *buf, int32_t bufLen, SMonBmInfo *pInfo) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeSMonSysInfo(&decoder, &pInfo->sys) < 0) return -1;
|
||||
if (tDecodeSMonLogs(&decoder, &pInfo->log) < 0) return -1;
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tFreeSMonBmInfo(SMonBmInfo *pInfo) {
|
||||
taosArrayDestroy(pInfo->log.logs);
|
||||
pInfo->log.logs = NULL;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, taosArrayGetSize(pInfo->pVloads)) < 0) return -1;
|
||||
for (int32_t i = 0; i < taosArrayGetSize(pInfo->pVloads); ++i) {
|
||||
SVnodeLoad *pLoad = taosArrayGet(pInfo->pVloads, i);
|
||||
if (tEncodeI32(&encoder, pLoad->vgId) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pLoad->syncState) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pLoad->syncRestore) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->cacheUsage) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->numOfTables) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->numOfTimeSeries) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->totalStorage) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->compStorage) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->pointsWritten) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->numOfSelectReqs) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->numOfInsertReqs) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->numOfInsertSuccessReqs) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->numOfBatchInsertReqs) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pLoad->numOfBatchInsertSuccessReqs) < 0) return -1;
|
||||
}
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
|
||||
int32_t arraySize = 0;
|
||||
if (tDecodeI32(&decoder, &arraySize) < 0) return -1;
|
||||
|
||||
pInfo->pVloads = taosArrayInit(arraySize, sizeof(SVnodeLoad));
|
||||
if (pInfo->pVloads == NULL) return -1;
|
||||
|
||||
for (int32_t i = 0; i < arraySize; ++i) {
|
||||
SVnodeLoad load = {0};
|
||||
if (tDecodeI32(&decoder, &load.vgId) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &load.syncState) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &load.syncRestore) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.cacheUsage) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.numOfTables) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.numOfTimeSeries) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.totalStorage) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.compStorage) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.pointsWritten) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.numOfSelectReqs) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.numOfInsertReqs) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.numOfInsertSuccessReqs) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.numOfBatchInsertReqs) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &load.numOfBatchInsertSuccessReqs) < 0) return -1;
|
||||
taosArrayPush(pInfo->pVloads, &load);
|
||||
}
|
||||
|
||||
tEndDecode(&decoder);
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tFreeSMonVloadInfo(SMonVloadInfo *pInfo) {
|
||||
taosArrayDestroy(pInfo->pVloads);
|
||||
pInfo->pVloads = NULL;
|
||||
}
|
||||
|
||||
int32_t tSerializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInfo) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pInfo->isMnode) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pInfo->load.syncState) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pInfo->load.syncRestore) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInfo) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pInfo->isMnode) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pInfo->load.syncState) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &pInfo->load.syncRestore) < 0) return -1;
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tSerializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo) {
|
||||
SEncoder encoder = {0};
|
||||
tEncoderInit(&encoder, buf, bufLen);
|
||||
|
||||
if (tStartEncode(&encoder) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->numOfProcessedQuery) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->numOfProcessedCQuery) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->numOfProcessedFetch) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->numOfProcessedDrop) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->numOfProcessedHb) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->numOfProcessedDelete) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->cacheDataSize) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->numOfQueryInQueue) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->numOfFetchInQueue) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->timeInQueryQueue) < 0) return -1;
|
||||
if (tEncodeI64(&encoder, pInfo->timeInFetchQueue) < 0) return -1;
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
tEncoderClear(&encoder);
|
||||
return tlen;
|
||||
}
|
||||
|
||||
int32_t tDeserializeSQnodeLoad(void *buf, int32_t bufLen, SQnodeLoad *pInfo) {
|
||||
SDecoder decoder = {0};
|
||||
tDecoderInit(&decoder, buf, bufLen);
|
||||
|
||||
if (tStartDecode(&decoder) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->numOfProcessedQuery) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->numOfProcessedCQuery) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->numOfProcessedFetch) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->numOfProcessedDrop) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->numOfProcessedHb) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->numOfProcessedDelete) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->cacheDataSize) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->numOfQueryInQueue) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->numOfFetchInQueue) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->timeInQueryQueue) < 0) return -1;
|
||||
if (tDecodeI64(&decoder, &pInfo->timeInFetchQueue) < 0) return -1;
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -141,12 +141,14 @@ int32_t taosQueueItemSize(STaosQueue *queue) {
|
|||
}
|
||||
|
||||
int64_t taosQueueMemorySize(STaosQueue *queue) {
|
||||
if (queue == NULL) return 0;
|
||||
|
||||
#if 1
|
||||
return queue->memOfItems;
|
||||
#else
|
||||
taosThreadMutexLock(&queue->mutex);
|
||||
int64_t memOfItems = queue->memOfItems;
|
||||
taosThreadMutexUnlock(&queue->mutex);
|
||||
return memOfItems;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *taosAllocateQitem(int32_t size, EQItype itype) {
|
||||
|
@ -298,9 +300,6 @@ int32_t taosGetQitem(STaosQall *qall, void **ppItem) {
|
|||
return num;
|
||||
}
|
||||
|
||||
void taosResetQitems(STaosQall *qall) { qall->current = qall->start; }
|
||||
int32_t taosQallItemSize(STaosQall *qall) { return qall->numOfItems; }
|
||||
|
||||
STaosQset *taosOpenQset() {
|
||||
STaosQset *qset = taosMemoryCalloc(sizeof(STaosQset), 1);
|
||||
if (qset == NULL) {
|
||||
|
@ -405,8 +404,6 @@ void taosRemoveFromQset(STaosQset *qset, STaosQueue *queue) {
|
|||
uDebug("queue:%p is removed from qset:%p", queue, qset);
|
||||
}
|
||||
|
||||
int32_t taosGetQueueNumber(STaosQset *qset) { return qset->numOfQueues; }
|
||||
|
||||
int32_t taosReadQitemFromQset(STaosQset *qset, void **ppItem, SQueueInfo *qinfo) {
|
||||
STaosQnode *pNode = NULL;
|
||||
int32_t code = 0;
|
||||
|
@ -497,6 +494,12 @@ int32_t taosReadAllQitemsFromQset(STaosQset *qset, STaosQall *qall, SQueueInfo *
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t taosQallItemSize(STaosQall *qall) { return qall->numOfItems; }
|
||||
void taosResetQitems(STaosQall *qall) { qall->current = qall->start; }
|
||||
int32_t taosGetQueueNumber(STaosQset *qset) { return qset->numOfQueues; }
|
||||
|
||||
#if 0
|
||||
|
||||
void taosResetQsetThread(STaosQset *qset, void *pItem) {
|
||||
if (pItem == NULL) return;
|
||||
STaosQnode *pNode = (STaosQnode *)((char *)pItem - sizeof(STaosQnode));
|
||||
|
@ -507,3 +510,5 @@ void taosResetQsetThread(STaosQset *qset, void *pItem) {
|
|||
}
|
||||
taosThreadMutexUnlock(&qset->mutex);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,10 +28,7 @@ int32_t tQWorkerInit(SQWorkerPool *pool) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (taosThreadMutexInit(&pool->mutex, NULL)) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
(void)taosThreadMutexInit(&pool->mutex, NULL);
|
||||
|
||||
for (int32_t i = 0; i < pool->max; ++i) {
|
||||
SQWorker *worker = pool->workers + i;
|
||||
|
@ -97,14 +94,10 @@ static void *tQWorkerThreadFp(SQWorker *worker) {
|
|||
}
|
||||
|
||||
STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) {
|
||||
taosThreadMutexLock(&pool->mutex);
|
||||
STaosQueue *queue = taosOpenQueue();
|
||||
if (queue == NULL) {
|
||||
taosThreadMutexUnlock(&pool->mutex);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
if (queue == NULL) return NULL;
|
||||
|
||||
taosThreadMutexLock(&pool->mutex);
|
||||
taosSetQueueFp(queue, fp, NULL);
|
||||
taosAddIntoQset(pool->qset, queue, ahandle);
|
||||
|
||||
|
@ -118,7 +111,6 @@ STaosQueue *tQWorkerAllocQueue(SQWorkerPool *pool, void *ahandle, FItem fp) {
|
|||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
|
||||
if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tQWorkerThreadFp, worker) != 0) {
|
||||
uError("worker:%s:%d failed to create thread to process since %s", pool->name, worker->id, strerror(errno));
|
||||
taosCloseQueue(queue);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
queue = NULL;
|
||||
|
@ -150,10 +142,7 @@ int32_t tWWorkerInit(SWWorkerPool *pool) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (taosThreadMutexInit(&pool->mutex, NULL) != 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
(void)taosThreadMutexInit(&pool->mutex, NULL);
|
||||
|
||||
for (int32_t i = 0; i < pool->max; ++i) {
|
||||
SWWorker *worker = pool->workers + i;
|
||||
|
@ -225,48 +214,27 @@ static void *tWWorkerThreadFp(SWWorker *worker) {
|
|||
STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) {
|
||||
taosThreadMutexLock(&pool->mutex);
|
||||
SWWorker *worker = pool->workers + pool->nextId;
|
||||
int32_t code = -1;
|
||||
|
||||
STaosQueue *queue = taosOpenQueue();
|
||||
if (queue == NULL) {
|
||||
taosThreadMutexUnlock(&pool->mutex);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
if (queue == NULL) goto _OVER;
|
||||
|
||||
taosSetQueueFp(queue, NULL, fp);
|
||||
|
||||
if (worker->qset == NULL) {
|
||||
worker->qset = taosOpenQset();
|
||||
if (worker->qset == NULL) {
|
||||
taosCloseQueue(queue);
|
||||
taosThreadMutexUnlock(&pool->mutex);
|
||||
return NULL;
|
||||
}
|
||||
if (worker->qset == NULL) goto _OVER;
|
||||
|
||||
taosAddIntoQset(worker->qset, queue, ahandle);
|
||||
worker->qall = taosAllocateQall();
|
||||
if (worker->qall == NULL) {
|
||||
taosCloseQset(worker->qset);
|
||||
taosCloseQueue(queue);
|
||||
taosThreadMutexUnlock(&pool->mutex);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
if (worker->qall == NULL) goto _OVER;
|
||||
|
||||
TdThreadAttr thAttr;
|
||||
taosThreadAttrInit(&thAttr);
|
||||
taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tWWorkerThreadFp, worker) != 0) goto _OVER;
|
||||
|
||||
if (taosThreadCreate(&worker->thread, &thAttr, (ThreadFp)tWWorkerThreadFp, worker) != 0) {
|
||||
uError("worker:%s:%d failed to create thread to process since %s", pool->name, worker->id, strerror(errno));
|
||||
taosFreeQall(worker->qall);
|
||||
taosCloseQset(worker->qset);
|
||||
taosCloseQueue(queue);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
queue = NULL;
|
||||
} else {
|
||||
uDebug("worker:%s:%d is launched, max:%d", pool->name, worker->id, pool->max);
|
||||
pool->nextId = (pool->nextId + 1) % pool->max;
|
||||
}
|
||||
uDebug("worker:%s:%d is launched, max:%d", pool->name, worker->id, pool->max);
|
||||
pool->nextId = (pool->nextId + 1) % pool->max;
|
||||
|
||||
taosThreadAttrDestroy(&thAttr);
|
||||
pool->num++;
|
||||
|
@ -276,10 +244,20 @@ STaosQueue *tWWorkerAllocQueue(SWWorkerPool *pool, void *ahandle, FItems fp) {
|
|||
pool->nextId = (pool->nextId + 1) % pool->max;
|
||||
}
|
||||
|
||||
taosThreadMutexUnlock(&pool->mutex);
|
||||
uDebug("worker:%s, queue:%p is allocated, ahandle:%p", pool->name, queue, ahandle);
|
||||
code = 0;
|
||||
|
||||
return queue;
|
||||
_OVER:
|
||||
taosThreadMutexUnlock(&pool->mutex);
|
||||
|
||||
if (code == -1) {
|
||||
if (queue != NULL) taosCloseQueue(queue);
|
||||
if (worker->qset != NULL) taosCloseQset(worker->qset);
|
||||
if (worker->qall != NULL) taosFreeQall(worker->qall);
|
||||
return NULL;
|
||||
} else {
|
||||
return queue;
|
||||
}
|
||||
}
|
||||
|
||||
void tWWorkerFreeQueue(SWWorkerPool *pool, STaosQueue *queue) {
|
||||
|
@ -292,15 +270,11 @@ int32_t tSingleWorkerInit(SSingleWorker *pWorker, const SSingleWorkerCfg *pCfg)
|
|||
pPool->name = pCfg->name;
|
||||
pPool->min = pCfg->min;
|
||||
pPool->max = pCfg->max;
|
||||
if (tQWorkerInit(pPool) != 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
if (tQWorkerInit(pPool) != 0) return -1;
|
||||
|
||||
pWorker->queue = tQWorkerAllocQueue(pPool, pCfg->param, pCfg->fp);
|
||||
if (pWorker->queue == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
if (pWorker->queue == NULL) return -1;
|
||||
|
||||
pWorker->name = pCfg->name;
|
||||
return 0;
|
||||
}
|
||||
|
@ -320,15 +294,11 @@ int32_t tMultiWorkerInit(SMultiWorker *pWorker, const SMultiWorkerCfg *pCfg) {
|
|||
SWWorkerPool *pPool = &pWorker->pool;
|
||||
pPool->name = pCfg->name;
|
||||
pPool->max = pCfg->max;
|
||||
if (tWWorkerInit(pPool) != 0) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
if (tWWorkerInit(pPool) != 0) return -1;
|
||||
|
||||
pWorker->queue = tWWorkerAllocQueue(pPool, pCfg->param, pCfg->fp);
|
||||
if (pWorker->queue == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
if (pWorker->queue == NULL) return -1;
|
||||
|
||||
pWorker->name = pCfg->name;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@
|
|||
./test.sh -f tsim/table/vgroup.sim
|
||||
|
||||
# ---- stream
|
||||
./test.sh -f tsim/stream/basic0.sim
|
||||
./test.sh -f tsim/stream/basic0.sim -v
|
||||
./test.sh -f tsim/stream/basic1.sim
|
||||
./test.sh -f tsim/stream/basic2.sim
|
||||
./test.sh -f tsim/stream/drop_stream.sim
|
||||
|
|
|
@ -12,14 +12,14 @@ $tb = $tbPrefix . $i
|
|||
print =============== step1
|
||||
sql drop database -x step1
|
||||
step1:
|
||||
sql create database $db vgroups 2
|
||||
sql create database $db vgroups 2 precision 'ns'
|
||||
sql use $db
|
||||
sql create table $tb (ts timestamp, speed int)
|
||||
|
||||
$x = 0
|
||||
while $x < 10
|
||||
while $x < 110
|
||||
$cc = $x * 60000
|
||||
$ms = 1601481600000 + $cc
|
||||
$ms = 1601481600000000000 + $cc
|
||||
|
||||
sql insert into $tb values ($ms , $x )
|
||||
$x = $x + 1
|
||||
|
@ -27,9 +27,9 @@ endw
|
|||
|
||||
print =============== step 2
|
||||
$x = 0
|
||||
while $x < 5
|
||||
while $x < 110
|
||||
$cc = $x * 60000
|
||||
$ms = 1551481600000 + $cc
|
||||
$ms = 1551481600000000000 + $cc
|
||||
|
||||
sql insert into $tb values ($ms , $x )
|
||||
$x = $x + 1
|
||||
|
@ -38,8 +38,29 @@ endw
|
|||
sql select * from $tb
|
||||
|
||||
print $rows points data are retrieved
|
||||
if $rows != 15 then
|
||||
if $rows != 220 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
# error
|
||||
print $data1
|
||||
print $data[1000][1]
|
||||
print $data[1][1000]
|
||||
print $data[1000][1000]
|
||||
$a1 = 0
|
||||
$a2 = 0
|
||||
$a3 = $a1 % $a2
|
||||
print $a3
|
||||
|
||||
$val = \\\1
|
||||
print ====> $val
|
||||
|
||||
sql_slow select * from $tb
|
||||
|
||||
sql close
|
||||
sql connect
|
||||
sql close
|
||||
sql connect root
|
||||
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/cfg.sh -n dnode1 -c debugflag -v 131
|
||||
system sh/exec.sh -n dnode1 -s start -v
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print =============== create database
|
||||
|
|
|
@ -94,7 +94,7 @@ class RequestHandlerImpl(http.server.BaseHTTPRequestHandler):
|
|||
tdLog.exit("vgroup_id is null!")
|
||||
if "database_name" not in infoDict["vgroup_infos"][index] or len(infoDict["vgroup_infos"][index]["database_name"]) < 0:
|
||||
tdLog.exit("database_name is null!")
|
||||
if "tables_num" not in infoDict["vgroup_infos"][index] or infoDict["vgroup_infos"][index]["tables_num"]!= 0:
|
||||
if "tables_num" not in infoDict["vgroup_infos"][index]:
|
||||
tdLog.exit("tables_num is null!")
|
||||
if "status" not in infoDict["vgroup_infos"][index] or len(infoDict["vgroup_infos"][index]["status"]) < 0 :
|
||||
tdLog.exit("status is null!")
|
||||
|
@ -294,6 +294,10 @@ class TDTestCase:
|
|||
vgroups = "30"
|
||||
sql = "create database db3 vgroups " + vgroups
|
||||
tdSql.query(sql)
|
||||
sql = "create table db3.stb (ts timestamp, f int) tags (t int)"
|
||||
tdSql.query(sql)
|
||||
sql = "create table db3.tb using db3.stb tags (1)"
|
||||
tdSql.query(sql)
|
||||
|
||||
# create http server: bing ip/port , and request processor
|
||||
if (platform.system().lower() == 'windows' and not tdDnodes.dnodes[0].remoteIP == ""):
|
||||
|
|
|
@ -21,35 +21,20 @@ void simLogSql(char *sql, bool useSharp) {
|
|||
char filename[256];
|
||||
sprintf(filename, "%s/sim.sql", simScriptDir);
|
||||
if (pFile == NULL) {
|
||||
// fp = fopen(filename, "w");
|
||||
pFile = taosOpenFile(filename, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_STREAM);
|
||||
if (pFile == NULL) {
|
||||
fprintf(stderr, "ERROR: failed to open file: %s\n", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pFile != NULL) {
|
||||
if (useSharp) {
|
||||
taosFprintfFile(pFile, "# %s;\n", sql);
|
||||
} else {
|
||||
taosFprintfFile(pFile, "%s;\n", sql);
|
||||
}
|
||||
}
|
||||
if (useSharp) {
|
||||
taosFprintfFile(pFile, "# %s;\n", sql);
|
||||
} else {
|
||||
taosFprintfFile(pFile, "%s;\n", sql);
|
||||
}
|
||||
|
||||
taosFsyncFile(pFile);
|
||||
taosFsyncFile(pFile);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
char *simParseArbitratorName(char *varName) {
|
||||
static char hostName[140];
|
||||
#ifdef WINDOWS
|
||||
taosGetFqdn(hostName);
|
||||
sprintf(&hostName[strlen(hostName)], ":%d", 8000);
|
||||
#else
|
||||
sprintf(hostName, "%s:%d", "localhost", 8000);
|
||||
#endif
|
||||
return hostName;
|
||||
}
|
||||
#endif
|
||||
|
||||
char *simParseHostName(char *varName) {
|
||||
static char hostName[140];
|
||||
#ifdef WINDOWS
|
||||
|
@ -65,18 +50,18 @@ char *simParseHostName(char *varName) {
|
|||
}
|
||||
|
||||
static void simFindFirstNum(const char *begin, int32_t beginLen, int32_t *num) {
|
||||
if (beginLen <= 5) {
|
||||
*num = 0;
|
||||
} else {
|
||||
*num = 0;
|
||||
|
||||
if (beginLen > 5) {
|
||||
*num = atoi(begin + 5);
|
||||
}
|
||||
}
|
||||
|
||||
static void simFindSecondNum(const char *begin, int32_t beginLen, int32_t *num) {
|
||||
*num = 0;
|
||||
|
||||
const char *number = strstr(begin, "][");
|
||||
if (number == NULL) {
|
||||
*num = 0;
|
||||
} else {
|
||||
if (number != NULL) {
|
||||
*num = atoi(number + 2);
|
||||
}
|
||||
}
|
||||
|
@ -91,10 +76,10 @@ static void simFindFirstKeyVal(const char *begin, int32_t beginLen, char *key, i
|
|||
}
|
||||
|
||||
static void simFindSecondKeyNum(const char *begin, int32_t beginLen, int32_t *num) {
|
||||
*num = 0;
|
||||
|
||||
const char *number = strstr(begin, ")[");
|
||||
if (number == NULL) {
|
||||
*num = 0;
|
||||
} else {
|
||||
if (number != NULL) {
|
||||
*num = atoi(number + 2);
|
||||
}
|
||||
}
|
||||
|
@ -104,12 +89,6 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) {
|
|||
return simParseHostName(varName);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (strncmp(varName, "arbitrator", 10) == 0) {
|
||||
return simParseArbitratorName(varName);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strncmp(varName, "error", varLen) == 0) return script->error;
|
||||
|
||||
if (strncmp(varName, "rows", varLen) == 0) return script->rows;
|
||||
|
@ -153,9 +132,7 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) {
|
|||
} else if (varName[5] == '_') {
|
||||
// data2_db
|
||||
int32_t col = varName[4] - '0';
|
||||
if (col < 0 || col >= MAX_QUERY_COL_NUM) {
|
||||
return "null";
|
||||
}
|
||||
col = col % MAX_QUERY_COL_NUM;
|
||||
|
||||
char *keyName;
|
||||
int32_t keyLen;
|
||||
|
@ -171,9 +148,7 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) {
|
|||
} else if (varName[6] == '_') {
|
||||
// data21_db
|
||||
int32_t col = (varName[4] - '0') * 10 + (varName[5] - '0');
|
||||
if (col < 0 || col >= MAX_QUERY_COL_NUM) {
|
||||
return "null";
|
||||
}
|
||||
col = col % MAX_QUERY_COL_NUM;
|
||||
|
||||
char *keyName;
|
||||
int32_t keyLen;
|
||||
|
@ -185,17 +160,12 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) {
|
|||
return script->data[i][col];
|
||||
}
|
||||
}
|
||||
return "null";
|
||||
} else {
|
||||
// $data00
|
||||
int32_t row = varName[4] - '0';
|
||||
int32_t col = varName[5] - '0';
|
||||
if (row < 0 || row >= MAX_QUERY_ROW_NUM) {
|
||||
return "null";
|
||||
}
|
||||
if (col < 0 || col >= MAX_QUERY_COL_NUM) {
|
||||
return "null";
|
||||
}
|
||||
row = row % MAX_QUERY_ROW_NUM;
|
||||
col = col % MAX_QUERY_COL_NUM;
|
||||
|
||||
simDebug("script:%s, data[%d][%d]=%s", script->fileName, row, col, script->data[row][col]);
|
||||
return script->data[row][col];
|
||||
|
@ -253,9 +223,9 @@ int32_t simExecuteExpression(SScript *script, char *exp) {
|
|||
rest = paGetToken(rest, &op2, &op2Len);
|
||||
|
||||
if (var1[0] == '$')
|
||||
strcpy(t0, simGetVariable(script, var1 + 1, var1Len - 1));
|
||||
tstrncpy(t0, simGetVariable(script, var1 + 1, var1Len - 1), sizeof(t0));
|
||||
else {
|
||||
memcpy(t0, var1, var1Len);
|
||||
tstrncpy(t0, var1, var1Len);
|
||||
t0[var1Len] = 0;
|
||||
}
|
||||
|
||||
|
@ -578,6 +548,8 @@ void simVisuallizeOption(SScript *script, char *src, char *dst) {
|
|||
while (1) {
|
||||
var = strchr(src, '$');
|
||||
if (var == NULL) break;
|
||||
|
||||
#if 0
|
||||
if (var && ((var - src - 1) > 0) && *(var - 1) == '\\') {
|
||||
srcLen = (int32_t)(var - src - 1);
|
||||
memcpy(dst + dstLen, src, srcLen);
|
||||
|
@ -585,6 +557,7 @@ void simVisuallizeOption(SScript *script, char *src, char *dst) {
|
|||
src = var;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
srcLen = (int32_t)(var - src);
|
||||
memcpy(dst + dstLen, src, srcLen);
|
||||
|
@ -705,17 +678,6 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
|
|||
int32_t numOfRows = 0;
|
||||
int32_t num_fields = taos_field_count(pSql);
|
||||
if (num_fields != 0) {
|
||||
if (pSql == NULL) {
|
||||
simDebug("script:%s, taos:%p, %s failed, result is null", script->fileName, script->taos, rest);
|
||||
if (line->errorJump == SQL_JUMP_TRUE) {
|
||||
script->linePos = line->jump;
|
||||
return true;
|
||||
}
|
||||
|
||||
sprintf(script->error, "lineNum:%d. result set null, sql:%s", line->lineNum, rest);
|
||||
return false;
|
||||
}
|
||||
|
||||
TAOS_ROW row;
|
||||
|
||||
while ((row = taos_fetch_row(pSql))) {
|
||||
|
@ -942,30 +904,6 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) {
|
|||
}
|
||||
}
|
||||
|
||||
if (strncmp(rest, "connect", 7) == 0) {
|
||||
if (!simCreateTaosdConnect(script, rest)) {
|
||||
return false;
|
||||
}
|
||||
script->linePos++;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (script->taos == NULL) {
|
||||
if (!simCreateTaosdConnect(script, "connect root")) {
|
||||
if (line->errorJump == SQL_JUMP_TRUE) {
|
||||
script->linePos = line->jump;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(rest, "close", 5) == 0) {
|
||||
simCloseTaosdConnect(script);
|
||||
script->linePos++;
|
||||
return true;
|
||||
}
|
||||
|
||||
TAOS_RES *pSql = taos_query(script->taos, rest);
|
||||
int32_t ret = taos_errno(pSql);
|
||||
taos_free_result(pSql);
|
||||
|
|
|
@ -717,20 +717,12 @@ bool simParseSqlErrorCmd(char *rest, SCommand *pCmd, int32_t lineNum) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool simParseSqlSlowCmd(char *rest, SCommand *pCmd, int32_t lineNum) {
|
||||
simParseSqlCmd(rest, pCmd, lineNum);
|
||||
cmdLine[numOfLines - 1].cmdno = SIM_CMD_SQL_SLOW;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool simParseRestfulCmd(char *rest, SCommand *pCmd, int32_t lineNum) {
|
||||
simParseSqlCmd(rest, pCmd, lineNum);
|
||||
cmdLine[numOfLines - 1].cmdno = SIM_CMD_RESTFUL;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool simParseSystemCmd(char *rest, SCommand *pCmd, int32_t lineNum) {
|
||||
int32_t expLen;
|
||||
|
||||
|
@ -1058,7 +1050,6 @@ void simInitsimCmdList() {
|
|||
simCmdList[cmdno].executeCmd = simExecuteSqlErrorCmd;
|
||||
simAddCmdIntoHash(&(simCmdList[cmdno]));
|
||||
|
||||
#if 0
|
||||
cmdno = SIM_CMD_SQL_SLOW;
|
||||
simCmdList[cmdno].cmdno = cmdno;
|
||||
strcpy(simCmdList[cmdno].name, "sql_slow");
|
||||
|
@ -1067,15 +1058,6 @@ void simInitsimCmdList() {
|
|||
simCmdList[cmdno].executeCmd = simExecuteSqlSlowCmd;
|
||||
simAddCmdIntoHash(&(simCmdList[cmdno]));
|
||||
|
||||
cmdno = SIM_CMD_RESTFUL;
|
||||
simCmdList[cmdno].cmdno = cmdno;
|
||||
strcpy(simCmdList[cmdno].name, "restful");
|
||||
simCmdList[cmdno].nlen = (int16_t)strlen(simCmdList[cmdno].name);
|
||||
simCmdList[cmdno].parseCmd = simParseRestfulCmd;
|
||||
simCmdList[cmdno].executeCmd = simExecuteRestfulCmd;
|
||||
simAddCmdIntoHash(&(simCmdList[cmdno]));
|
||||
#endif
|
||||
|
||||
/* test is only an internal command */
|
||||
cmdno = SIM_CMD_TEST;
|
||||
simCmdList[cmdno].cmdno = cmdno;
|
||||
|
|
Loading…
Reference in New Issue