fix:add monitor result for show cluster variables
This commit is contained in:
parent
d0ca79ddca
commit
596121431c
|
@ -573,7 +573,7 @@ enum {
|
||||||
#define TSDB_CONFIG_OPTION_LEN 32
|
#define TSDB_CONFIG_OPTION_LEN 32
|
||||||
#define TSDB_CONFIG_VALUE_LEN 64
|
#define TSDB_CONFIG_VALUE_LEN 64
|
||||||
#define TSDB_CONFIG_SCOPE_LEN 8
|
#define TSDB_CONFIG_SCOPE_LEN 8
|
||||||
#define TSDB_CONFIG_NUMBER 8
|
#define TSDB_CONFIG_NUMBER 16
|
||||||
|
|
||||||
#define QUERY_ID_SIZE 20
|
#define QUERY_ID_SIZE 20
|
||||||
#define QUERY_OBJ_ID_SIZE 18
|
#define QUERY_OBJ_ID_SIZE 18
|
||||||
|
|
|
@ -933,6 +933,32 @@ _OVER:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void getSlowLogScopeString(int32_t scope, char* result){
|
||||||
|
if(scope == SLOW_LOG_TYPE_NULL) {
|
||||||
|
strcat(result, "NONE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while(scope > 0){
|
||||||
|
if(scope & SLOW_LOG_TYPE_QUERY) {
|
||||||
|
strcat(result, "QUERY");
|
||||||
|
scope &= ~SLOW_LOG_TYPE_QUERY;
|
||||||
|
} else if(scope & SLOW_LOG_TYPE_INSERT) {
|
||||||
|
strcat(result, "INSERT");
|
||||||
|
scope &= ~SLOW_LOG_TYPE_INSERT;
|
||||||
|
} else if(scope & SLOW_LOG_TYPE_OTHERS) {
|
||||||
|
strcat(result, "OTHERS");
|
||||||
|
scope &= ~SLOW_LOG_TYPE_OTHERS;
|
||||||
|
} else{
|
||||||
|
printf("invalid slow log scope:%d", scope);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(scope > 0) {
|
||||||
|
strcat(result, "|");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
||||||
SShowVariablesRsp rsp = {0};
|
SShowVariablesRsp rsp = {0};
|
||||||
int32_t code = -1;
|
int32_t code = -1;
|
||||||
|
@ -941,7 +967,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsp.variables = taosArrayInit(4, sizeof(SVariablesInfo));
|
rsp.variables = taosArrayInit(16, sizeof(SVariablesInfo));
|
||||||
if (NULL == rsp.variables) {
|
if (NULL == rsp.variables) {
|
||||||
mError("failed to alloc SVariablesInfo array while process show variables req");
|
mError("failed to alloc SVariablesInfo array while process show variables req");
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -970,6 +996,33 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
||||||
strcpy(info.scope, "both");
|
strcpy(info.scope, "both");
|
||||||
taosArrayPush(rsp.variables, &info);
|
taosArrayPush(rsp.variables, &info);
|
||||||
|
|
||||||
|
strcpy(info.name, "monitor");
|
||||||
|
snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsEnableMonitor);
|
||||||
|
strcpy(info.scope, "server");
|
||||||
|
taosArrayPush(rsp.variables, &info);
|
||||||
|
|
||||||
|
strcpy(info.name, "monitorInterval");
|
||||||
|
snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsMonitorInterval);
|
||||||
|
strcpy(info.scope, "server");
|
||||||
|
taosArrayPush(rsp.variables, &info);
|
||||||
|
|
||||||
|
strcpy(info.name, "slowLogThreshold");
|
||||||
|
snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogThreshold);
|
||||||
|
strcpy(info.scope, "server");
|
||||||
|
taosArrayPush(rsp.variables, &info);
|
||||||
|
|
||||||
|
strcpy(info.name, "slowLogMaxLen");
|
||||||
|
snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogMaxLen);
|
||||||
|
strcpy(info.scope, "server");
|
||||||
|
taosArrayPush(rsp.variables, &info);
|
||||||
|
|
||||||
|
char scopeStr[64] = {0};
|
||||||
|
getSlowLogScopeString(tsSlowLogScope, scopeStr);
|
||||||
|
strcpy(info.name, "slowLogScope");
|
||||||
|
snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", scopeStr);
|
||||||
|
strcpy(info.scope, "server");
|
||||||
|
taosArrayPush(rsp.variables, &info);
|
||||||
|
|
||||||
int32_t rspLen = tSerializeSShowVariablesRsp(NULL, 0, &rsp);
|
int32_t rspLen = tSerializeSShowVariablesRsp(NULL, 0, &rsp);
|
||||||
void *pRsp = rpcMallocCont(rspLen);
|
void *pRsp = rpcMallocCont(rspLen);
|
||||||
if (pRsp == NULL) {
|
if (pRsp == NULL) {
|
||||||
|
@ -1488,32 +1541,6 @@ static int32_t mndProcessCreateEncryptKeyRsp(SRpcMsg *pRsp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getSlowLogScopeString(int32_t scope, char* result){
|
|
||||||
if(scope == SLOW_LOG_TYPE_NULL) {
|
|
||||||
strcat(result, "NONE");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
while(scope > 0){
|
|
||||||
if(scope & SLOW_LOG_TYPE_QUERY) {
|
|
||||||
strcat(result, "QUERY");
|
|
||||||
scope &= ~SLOW_LOG_TYPE_QUERY;
|
|
||||||
} else if(scope & SLOW_LOG_TYPE_INSERT) {
|
|
||||||
strcat(result, "INSERT");
|
|
||||||
scope &= ~SLOW_LOG_TYPE_INSERT;
|
|
||||||
} else if(scope & SLOW_LOG_TYPE_OTHERS) {
|
|
||||||
strcat(result, "OTHERS");
|
|
||||||
scope &= ~SLOW_LOG_TYPE_OTHERS;
|
|
||||||
} else{
|
|
||||||
printf("invalid slow log scope:%d", scope);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(scope > 0) {
|
|
||||||
strcat(result, "|");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
|
||||||
SMnode *pMnode = pReq->info.node;
|
SMnode *pMnode = pReq->info.node;
|
||||||
int32_t totalRows = 0;
|
int32_t totalRows = 0;
|
||||||
|
@ -1551,16 +1578,16 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogThreshold);
|
snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogThreshold);
|
||||||
totalRows++;
|
totalRows++;
|
||||||
|
|
||||||
|
cfgOpts[totalRows] = "slowLogMaxLen";
|
||||||
|
snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogMaxLen);
|
||||||
|
totalRows++;
|
||||||
|
|
||||||
char scopeStr[64] = {0};
|
char scopeStr[64] = {0};
|
||||||
getSlowLogScopeString(tsSlowLogScope, scopeStr);
|
getSlowLogScopeString(tsSlowLogScope, scopeStr);
|
||||||
cfgOpts[totalRows] = "slowLogScope";
|
cfgOpts[totalRows] = "slowLogScope";
|
||||||
snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%s", scopeStr);
|
snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%s", scopeStr);
|
||||||
totalRows++;
|
totalRows++;
|
||||||
|
|
||||||
cfgOpts[totalRows] = "slowLogMaxLen";
|
|
||||||
snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogMaxLen);
|
|
||||||
totalRows++;
|
|
||||||
|
|
||||||
char buf[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0};
|
char buf[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
char bufVal[TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE] = {0};
|
char bufVal[TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue