Add show
This commit is contained in:
parent
594bcf1007
commit
d778ada8f9
|
@ -2210,6 +2210,7 @@ typedef struct {
|
||||||
char name[TSDB_CONFIG_OPTION_LEN + 1];
|
char name[TSDB_CONFIG_OPTION_LEN + 1];
|
||||||
char value[TSDB_CONFIG_PATH_LEN + 1];
|
char value[TSDB_CONFIG_PATH_LEN + 1];
|
||||||
char scope[TSDB_CONFIG_SCOPE_LEN + 1];
|
char scope[TSDB_CONFIG_SCOPE_LEN + 1];
|
||||||
|
char category[TSDB_CONFIG_CATEGORY_LEN + 1];
|
||||||
char info[TSDB_CONFIG_INFO_LEN + 1];
|
char info[TSDB_CONFIG_INFO_LEN + 1];
|
||||||
} SVariablesInfo;
|
} SVariablesInfo;
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,12 @@ extern "C" {
|
||||||
#define SHOW_CREATE_VIEW_RESULT_FIELD1_LEN (TSDB_VIEW_FNAME_LEN + 4 + VARSTR_HEADER_SIZE)
|
#define SHOW_CREATE_VIEW_RESULT_FIELD1_LEN (TSDB_VIEW_FNAME_LEN + 4 + VARSTR_HEADER_SIZE)
|
||||||
#define SHOW_CREATE_VIEW_RESULT_FIELD2_LEN (TSDB_MAX_ALLOWED_SQL_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_CREATE_VIEW_RESULT_FIELD2_LEN (TSDB_MAX_ALLOWED_SQL_LEN + VARSTR_HEADER_SIZE)
|
||||||
|
|
||||||
#define SHOW_LOCAL_VARIABLES_RESULT_COLS 4
|
#define SHOW_LOCAL_VARIABLES_RESULT_COLS 5
|
||||||
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
|
||||||
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_PATH_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_PATH_LEN + VARSTR_HEADER_SIZE)
|
||||||
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE)
|
||||||
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD4_LEN (TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD4_LEN (TSDB_CONFIG_CATEGORY_LEN + VARSTR_HEADER_SIZE)
|
||||||
|
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD5_LEN (TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE)
|
||||||
|
|
||||||
#define COMPACT_DB_RESULT_COLS 3
|
#define COMPACT_DB_RESULT_COLS 3
|
||||||
#define COMPACT_DB_RESULT_FIELD1_LEN 32
|
#define COMPACT_DB_RESULT_FIELD1_LEN 32
|
||||||
|
|
|
@ -146,6 +146,7 @@ const char *cfgDtypeStr(ECfgDataType type);
|
||||||
|
|
||||||
int32_t cfgDumpItemValue(SConfigItem *pItem, char *buf, int32_t bufSize, int32_t *pLen);
|
int32_t cfgDumpItemValue(SConfigItem *pItem, char *buf, int32_t bufSize, int32_t *pLen);
|
||||||
int32_t cfgDumpItemScope(SConfigItem *pItem, char *buf, int32_t bufSize, int32_t *pLen);
|
int32_t cfgDumpItemScope(SConfigItem *pItem, char *buf, int32_t bufSize, int32_t *pLen);
|
||||||
|
int32_t cfgDumpItemCategory(SConfigItem *pItem, char *buf, int32_t bufSize, int32_t *pLen);
|
||||||
|
|
||||||
void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump);
|
void cfgDumpCfg(SConfig *pCfg, bool tsc, bool dump);
|
||||||
void cfgDumpCfgS3(SConfig *pCfg, bool tsc, bool dump);
|
void cfgDumpCfgS3(SConfig *pCfg, bool tsc, bool dump);
|
||||||
|
|
|
@ -190,45 +190,22 @@ typedef enum EOperatorType {
|
||||||
} EOperatorType;
|
} EOperatorType;
|
||||||
|
|
||||||
static const EOperatorType OPERATOR_ARRAY[] = {
|
static const EOperatorType OPERATOR_ARRAY[] = {
|
||||||
OP_TYPE_ADD,
|
OP_TYPE_ADD, OP_TYPE_SUB, OP_TYPE_MULTI, OP_TYPE_DIV, OP_TYPE_REM,
|
||||||
OP_TYPE_SUB,
|
|
||||||
OP_TYPE_MULTI,
|
|
||||||
OP_TYPE_DIV,
|
|
||||||
OP_TYPE_REM,
|
|
||||||
|
|
||||||
OP_TYPE_MINUS,
|
OP_TYPE_MINUS,
|
||||||
|
|
||||||
OP_TYPE_BIT_AND,
|
OP_TYPE_BIT_AND, OP_TYPE_BIT_OR,
|
||||||
OP_TYPE_BIT_OR,
|
|
||||||
|
|
||||||
OP_TYPE_GREATER_THAN,
|
OP_TYPE_GREATER_THAN, OP_TYPE_GREATER_EQUAL, OP_TYPE_LOWER_THAN, OP_TYPE_LOWER_EQUAL, OP_TYPE_EQUAL,
|
||||||
OP_TYPE_GREATER_EQUAL,
|
OP_TYPE_NOT_EQUAL, OP_TYPE_IN, OP_TYPE_NOT_IN, OP_TYPE_LIKE, OP_TYPE_NOT_LIKE, OP_TYPE_MATCH, OP_TYPE_NMATCH,
|
||||||
OP_TYPE_LOWER_THAN,
|
|
||||||
OP_TYPE_LOWER_EQUAL,
|
|
||||||
OP_TYPE_EQUAL,
|
|
||||||
OP_TYPE_NOT_EQUAL,
|
|
||||||
OP_TYPE_IN,
|
|
||||||
OP_TYPE_NOT_IN,
|
|
||||||
OP_TYPE_LIKE,
|
|
||||||
OP_TYPE_NOT_LIKE,
|
|
||||||
OP_TYPE_MATCH,
|
|
||||||
OP_TYPE_NMATCH,
|
|
||||||
|
|
||||||
OP_TYPE_IS_NULL,
|
OP_TYPE_IS_NULL, OP_TYPE_IS_NOT_NULL, OP_TYPE_IS_TRUE, OP_TYPE_IS_FALSE, OP_TYPE_IS_UNKNOWN, OP_TYPE_IS_NOT_TRUE,
|
||||||
OP_TYPE_IS_NOT_NULL,
|
OP_TYPE_IS_NOT_FALSE, OP_TYPE_IS_NOT_UNKNOWN,
|
||||||
OP_TYPE_IS_TRUE,
|
|
||||||
OP_TYPE_IS_FALSE,
|
|
||||||
OP_TYPE_IS_UNKNOWN,
|
|
||||||
OP_TYPE_IS_NOT_TRUE,
|
|
||||||
OP_TYPE_IS_NOT_FALSE,
|
|
||||||
OP_TYPE_IS_NOT_UNKNOWN,
|
|
||||||
// OP_TYPE_COMPARE_MAX_VALUE,
|
// OP_TYPE_COMPARE_MAX_VALUE,
|
||||||
|
|
||||||
OP_TYPE_JSON_GET_VALUE,
|
OP_TYPE_JSON_GET_VALUE, OP_TYPE_JSON_CONTAINS,
|
||||||
OP_TYPE_JSON_CONTAINS,
|
|
||||||
|
|
||||||
OP_TYPE_ASSIGN
|
OP_TYPE_ASSIGN};
|
||||||
};
|
|
||||||
|
|
||||||
#define OP_TYPE_CALC_MAX OP_TYPE_BIT_OR
|
#define OP_TYPE_CALC_MAX OP_TYPE_BIT_OR
|
||||||
|
|
||||||
|
@ -644,6 +621,7 @@ enum { RAND_ERR_MEMORY = 1, RAND_ERR_FILE = 2, RAND_ERR_NETWORK = 4 };
|
||||||
#define TSDB_CONFIG_NUMBER 16
|
#define TSDB_CONFIG_NUMBER 16
|
||||||
#define TSDB_CONFIG_PATH_LEN 4096
|
#define TSDB_CONFIG_PATH_LEN 4096
|
||||||
#define TSDB_CONFIG_INFO_LEN 64
|
#define TSDB_CONFIG_INFO_LEN 64
|
||||||
|
#define TSDB_CONFIG_CATEGORY_LEN 8
|
||||||
|
|
||||||
#define QUERY_ID_SIZE 20
|
#define QUERY_ID_SIZE 20
|
||||||
#define QUERY_OBJ_ID_SIZE 18
|
#define QUERY_OBJ_ID_SIZE 18
|
||||||
|
|
|
@ -47,11 +47,12 @@ enum {
|
||||||
RES_TYPE__TMQ_BATCH_META,
|
RES_TYPE__TMQ_BATCH_META,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SHOW_VARIABLES_RESULT_COLS 4
|
#define SHOW_VARIABLES_RESULT_COLS 5
|
||||||
#define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
|
||||||
#define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
|
||||||
#define SHOW_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_VARIABLES_RESULT_FIELD3_LEN (TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE)
|
||||||
#define SHOW_VARIABLES_RESULT_FIELD4_LEN (TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE)
|
#define SHOW_VARIABLES_RESULT_FIELD4_LEN (TSDB_CONFIG_CATEGORY_LEN + VARSTR_HEADER_SIZE)
|
||||||
|
#define SHOW_VARIABLES_RESULT_FIELD5_LEN (TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE)
|
||||||
|
|
||||||
#define TD_RES_QUERY(res) (*(int8_t*)(res) == RES_TYPE__QUERY)
|
#define TD_RES_QUERY(res) (*(int8_t*)(res) == RES_TYPE__QUERY)
|
||||||
#define TD_RES_TMQ(res) (*(int8_t*)(res) == RES_TYPE__TMQ)
|
#define TD_RES_TMQ(res) (*(int8_t*)(res) == RES_TYPE__TMQ)
|
||||||
|
|
|
@ -15,9 +15,10 @@
|
||||||
|
|
||||||
#include "catalog.h"
|
#include "catalog.h"
|
||||||
#include "clientInt.h"
|
#include "clientInt.h"
|
||||||
#include "clientMonitor.h"
|
|
||||||
#include "clientLog.h"
|
#include "clientLog.h"
|
||||||
|
#include "clientMonitor.h"
|
||||||
#include "cmdnodes.h"
|
#include "cmdnodes.h"
|
||||||
|
#include "command.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
#include "systable.h"
|
#include "systable.h"
|
||||||
|
@ -26,7 +27,6 @@
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
#include "tname.h"
|
#include "tname.h"
|
||||||
#include "tversion.h"
|
#include "tversion.h"
|
||||||
#include "command.h"
|
|
||||||
|
|
||||||
extern SClientHbMgr clientHbMgr;
|
extern SClientHbMgr clientHbMgr;
|
||||||
|
|
||||||
|
@ -147,7 +147,8 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
pTscObj->whiteListInfo.ver = connectRsp.whiteListVer;
|
pTscObj->whiteListInfo.ver = connectRsp.whiteListVer;
|
||||||
|
|
||||||
if (taosHashGet(appInfo.pInstMapByClusterId, &connectRsp.clusterId, LONG_BYTES) == NULL) {
|
if (taosHashGet(appInfo.pInstMapByClusterId, &connectRsp.clusterId, LONG_BYTES) == NULL) {
|
||||||
if(taosHashPut(appInfo.pInstMapByClusterId, &connectRsp.clusterId, LONG_BYTES, &pTscObj->pAppInfo, POINTER_BYTES) != 0){
|
if (taosHashPut(appInfo.pInstMapByClusterId, &connectRsp.clusterId, LONG_BYTES, &pTscObj->pAppInfo,
|
||||||
|
POINTER_BYTES) != 0) {
|
||||||
tscError("failed to put appInfo into appInfo.pInstMapByClusterId");
|
tscError("failed to put appInfo into appInfo.pInstMapByClusterId");
|
||||||
} else {
|
} else {
|
||||||
MonitorSlowLogData data = {0};
|
MonitorSlowLogData data = {0};
|
||||||
|
@ -545,6 +546,10 @@ static int32_t buildShowVariablesBlock(SArray* pVars, SSDataBlock** block) {
|
||||||
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD4_LEN;
|
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD4_LEN;
|
||||||
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
|
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
|
||||||
|
|
||||||
|
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||||
|
infoData.info.bytes = SHOW_VARIABLES_RESULT_FIELD5_LEN;
|
||||||
|
TSDB_CHECK_NULL(taosArrayPush(pBlock->pDataBlock, &infoData), code, line, END, terrno);
|
||||||
|
|
||||||
int32_t numOfCfg = taosArrayGetSize(pVars);
|
int32_t numOfCfg = taosArrayGetSize(pVars);
|
||||||
code = blockDataEnsureCapacity(pBlock, numOfCfg);
|
code = blockDataEnsureCapacity(pBlock, numOfCfg);
|
||||||
TSDB_CHECK_CODE(code, line, END);
|
TSDB_CHECK_CODE(code, line, END);
|
||||||
|
@ -574,6 +579,13 @@ static int32_t buildShowVariablesBlock(SArray* pVars, SSDataBlock** block) {
|
||||||
code = colDataSetVal(pColInfo, i, scope, false);
|
code = colDataSetVal(pColInfo, i, scope, false);
|
||||||
TSDB_CHECK_CODE(code, line, END);
|
TSDB_CHECK_CODE(code, line, END);
|
||||||
|
|
||||||
|
char category[TSDB_CONFIG_CATEGORY_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
STR_WITH_MAXSIZE_TO_VARSTR(category, pInfo->category, TSDB_CONFIG_CATEGORY_LEN + VARSTR_HEADER_SIZE);
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
|
||||||
|
TSDB_CHECK_NULL(pColInfo, code, line, END, terrno);
|
||||||
|
code = colDataSetVal(pColInfo, i, category, false);
|
||||||
|
TSDB_CHECK_CODE(code, line, END);
|
||||||
|
|
||||||
char info[TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE] = {0};
|
char info[TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(info, pInfo->info, TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE);
|
STR_WITH_MAXSIZE_TO_VARSTR(info, pInfo->info, TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, c++);
|
||||||
|
@ -805,7 +817,6 @@ _exit:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t processCompactDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
int32_t processCompactDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
SRequestObj* pRequest = param;
|
SRequestObj* pRequest = param;
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
|
|
@ -2310,7 +2310,6 @@ int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnal
|
||||||
int32_t lino;
|
int32_t lino;
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
|
|
||||||
int32_t numOfAlgos = 0;
|
int32_t numOfAlgos = 0;
|
||||||
int32_t nameLen;
|
int32_t nameLen;
|
||||||
int32_t type;
|
int32_t type;
|
||||||
|
@ -5710,6 +5709,7 @@ int32_t tEncodeSVariablesInfo(SEncoder *pEncoder, SVariablesInfo *pInfo) {
|
||||||
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->name));
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->name));
|
||||||
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->value));
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->value));
|
||||||
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->scope));
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->scope));
|
||||||
|
TAOS_CHECK_RETURN(tEncodeCStr(pEncoder, pInfo->category));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5717,6 +5717,7 @@ int32_t tDecodeSVariablesInfo(SDecoder *pDecoder, SVariablesInfo *pInfo) {
|
||||||
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->name));
|
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->name));
|
||||||
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->value));
|
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->value));
|
||||||
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->scope));
|
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->scope));
|
||||||
|
TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, pInfo->category));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,6 +329,7 @@ static const SSysDbTableSchema variablesSchema[] = {
|
||||||
{.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "name", .bytes = TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
{.name = "value", .bytes = TSDB_CONFIG_PATH_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "value", .bytes = TSDB_CONFIG_PATH_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
{.name = "scope", .bytes = TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "scope", .bytes = TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
|
{.name = "category", .bytes = TSDB_CONFIG_CATEGORY_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
{.name = "info", .bytes = TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "info", .bytes = TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2709,7 +2709,7 @@ int32_t globalConfigSerialize(int32_t version, SArray *array, char **serialized)
|
||||||
char buf[30];
|
char buf[30];
|
||||||
cJSON *json = cJSON_CreateObject();
|
cJSON *json = cJSON_CreateObject();
|
||||||
if (json == NULL) goto _exit;
|
if (json == NULL) goto _exit;
|
||||||
json = cJSON_AddNumberToObject(json, "version", version);
|
if (cJSON_AddNumberToObject(json, "version", version) == NULL) goto _exit;
|
||||||
if (json == NULL) goto _exit;
|
if (json == NULL) goto _exit;
|
||||||
int sz = taosArrayGetSize(array);
|
int sz = taosArrayGetSize(array);
|
||||||
|
|
||||||
|
@ -2725,38 +2725,31 @@ int32_t globalConfigSerialize(int32_t version, SArray *array, char **serialized)
|
||||||
case CFG_DTYPE_NONE:
|
case CFG_DTYPE_NONE:
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_BOOL:
|
case CFG_DTYPE_BOOL:
|
||||||
cField = cJSON_AddBoolToObject(cField, item->name, item->bval);
|
if (cJSON_AddBoolToObject(cField, item->name, item->bval) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_INT32:
|
case CFG_DTYPE_INT32:
|
||||||
cField = cJSON_AddNumberToObject(cField, item->name, item->i32);
|
if (cJSON_AddNumberToObject(cField, item->name, item->i32) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_INT64:
|
case CFG_DTYPE_INT64:
|
||||||
(void)sprintf(buf, "%" PRId64, item->i64);
|
(void)sprintf(buf, "%" PRId64, item->i64);
|
||||||
cField = cJSON_AddStringToObject(cField, item->name, buf);
|
if (cJSON_AddStringToObject(cField, item->name, buf) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_FLOAT:
|
case CFG_DTYPE_FLOAT:
|
||||||
case CFG_DTYPE_DOUBLE:
|
case CFG_DTYPE_DOUBLE:
|
||||||
(void)sprintf(buf, "%f", item->fval);
|
(void)sprintf(buf, "%f", item->fval);
|
||||||
cField = cJSON_AddStringToObject(cField, item->name, buf);
|
if (cJSON_AddStringToObject(cField, item->name, buf) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_STRING:
|
case CFG_DTYPE_STRING:
|
||||||
case CFG_DTYPE_DIR:
|
case CFG_DTYPE_DIR:
|
||||||
case CFG_DTYPE_LOCALE:
|
case CFG_DTYPE_LOCALE:
|
||||||
case CFG_DTYPE_CHARSET:
|
case CFG_DTYPE_CHARSET:
|
||||||
case CFG_DTYPE_TIMEZONE:
|
case CFG_DTYPE_TIMEZONE:
|
||||||
cField = cJSON_AddStringToObject(cField, item->name, item->str);
|
if (cJSON_AddStringToObject(cField, item->name, item->str) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cJSON_AddItemToObject(json, "configs", cField)) {
|
if (!cJSON_AddItemToObject(json, "configs", cField)) goto _exit;
|
||||||
goto _exit;
|
|
||||||
}
|
|
||||||
*serialized = cJSON_Print(json);
|
*serialized = cJSON_Print(json);
|
||||||
_exit:
|
_exit:
|
||||||
if (terrno != TSDB_CODE_SUCCESS) {
|
if (terrno != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -2784,31 +2777,26 @@ int32_t localConfigSerialize(SArray *array, char **serialized) {
|
||||||
case CFG_DTYPE_NONE:
|
case CFG_DTYPE_NONE:
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_BOOL:
|
case CFG_DTYPE_BOOL:
|
||||||
cField = cJSON_AddBoolToObject(cField, item->name, item->bval);
|
if (cJSON_AddBoolToObject(cField, item->name, item->bval) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_INT32:
|
case CFG_DTYPE_INT32:
|
||||||
cField = cJSON_AddNumberToObject(cField, item->name, item->i32);
|
if (cJSON_AddNumberToObject(cField, item->name, item->i32) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_INT64:
|
case CFG_DTYPE_INT64:
|
||||||
(void)sprintf(buf, "%" PRId64, item->i64);
|
(void)sprintf(buf, "%" PRId64, item->i64);
|
||||||
cField = cJSON_AddStringToObject(cField, item->name, buf);
|
if (cJSON_AddStringToObject(cField, item->name, buf) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_FLOAT:
|
case CFG_DTYPE_FLOAT:
|
||||||
case CFG_DTYPE_DOUBLE:
|
case CFG_DTYPE_DOUBLE:
|
||||||
(void)sprintf(buf, "%f", item->fval);
|
(void)sprintf(buf, "%f", item->fval);
|
||||||
cField = cJSON_AddStringToObject(cField, item->name, buf);
|
if (cJSON_AddStringToObject(cField, item->name, buf) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
case CFG_DTYPE_STRING:
|
case CFG_DTYPE_STRING:
|
||||||
case CFG_DTYPE_DIR:
|
case CFG_DTYPE_DIR:
|
||||||
case CFG_DTYPE_LOCALE:
|
case CFG_DTYPE_LOCALE:
|
||||||
case CFG_DTYPE_CHARSET:
|
case CFG_DTYPE_CHARSET:
|
||||||
case CFG_DTYPE_TIMEZONE:
|
case CFG_DTYPE_TIMEZONE:
|
||||||
cField = cJSON_AddStringToObject(cField, item->name, item->str);
|
if (cJSON_AddStringToObject(cField, item->name, item->str) == NULL) goto _exit;
|
||||||
if (cField == NULL) goto _exit;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2846,7 +2834,7 @@ int32_t taosPersistGlobalConfig(SArray *array, const char *path, int32_t version
|
||||||
char *serialized = NULL;
|
char *serialized = NULL;
|
||||||
TAOS_CHECK_GOTO(globalConfigSerialize(version, array, &serialized), &lino, _exit);
|
TAOS_CHECK_GOTO(globalConfigSerialize(version, array, &serialized), &lino, _exit);
|
||||||
|
|
||||||
if (taosWriteFile(pConfigFile, serialized, strlen(serialized) < 0)) {
|
if (taosWriteFile(pConfigFile, serialized, strlen(serialized)) < 0) {
|
||||||
lino = __LINE__;
|
lino = __LINE__;
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
uError("failed to write file:%s since %s", filename, tstrerror(code));
|
uError("failed to write file:%s since %s", filename, tstrerror(code));
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "tmisce.h"
|
|
||||||
#include "tdatablock.h"
|
#include "tdatablock.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
#include "tjson.h"
|
#include "tjson.h"
|
||||||
|
#include "tmisce.h"
|
||||||
|
|
||||||
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp) {
|
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp) {
|
||||||
pEp->port = 0;
|
pEp->port = 0;
|
||||||
|
@ -330,6 +330,18 @@ _start:
|
||||||
}
|
}
|
||||||
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, scope, false), NULL, _exit);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, scope, false), NULL, _exit);
|
||||||
|
|
||||||
|
char category[TSDB_CONFIG_CATEGORY_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
TAOS_CHECK_GOTO(cfgDumpItemCategory(pItem, &category[VARSTR_HEADER_SIZE], TSDB_CONFIG_CATEGORY_LEN, &valueLen),
|
||||||
|
NULL, _exit);
|
||||||
|
varDataSetLen(category, valueLen);
|
||||||
|
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
|
||||||
|
if (pColInfo == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
TAOS_CHECK_GOTO(code, NULL, _exit);
|
||||||
|
}
|
||||||
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, category, false), NULL, _exit);
|
||||||
|
|
||||||
char info[TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE] = {0};
|
char info[TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
if (strcasecmp(pItem->name, "dataDir") == 0 && pDiskCfg) {
|
if (strcasecmp(pItem->name, "dataDir") == 0 && pDiskCfg) {
|
||||||
char* buf = &info[VARSTR_HEADER_SIZE];
|
char* buf = &info[VARSTR_HEADER_SIZE];
|
||||||
|
|
|
@ -1079,6 +1079,78 @@ static void getSlowLogScopeString(int32_t scope, char *result) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SArray *initVariablesFromItems(SArray *pItems) {
|
||||||
|
if (pItems == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t sz = taosArrayGetSize(pItems);
|
||||||
|
|
||||||
|
SArray *pInfos = taosArrayInit(sz, sizeof(SVariablesInfo));
|
||||||
|
for (int32_t i = 0; i < sz; ++i) {
|
||||||
|
SConfigItem *pItem = taosArrayGet(pItems, i);
|
||||||
|
SVariablesInfo info = {0};
|
||||||
|
strcpy(info.name, pItem->name);
|
||||||
|
|
||||||
|
// init info value
|
||||||
|
switch (pItem->dtype) {
|
||||||
|
case CFG_DTYPE_NONE:
|
||||||
|
break;
|
||||||
|
case CFG_DTYPE_BOOL:
|
||||||
|
sprintf(info.value, "%d", pItem->bval);
|
||||||
|
break;
|
||||||
|
case CFG_DTYPE_INT32:
|
||||||
|
sprintf(info.value, "%d", pItem->i32);
|
||||||
|
break;
|
||||||
|
case CFG_DTYPE_INT64:
|
||||||
|
sprintf(info.value, "%" PRId64, pItem->i64);
|
||||||
|
break;
|
||||||
|
case CFG_DTYPE_FLOAT:
|
||||||
|
case CFG_DTYPE_DOUBLE:
|
||||||
|
sprintf(info.value, "%f", pItem->fval);
|
||||||
|
break;
|
||||||
|
case CFG_DTYPE_STRING:
|
||||||
|
case CFG_DTYPE_DIR:
|
||||||
|
case CFG_DTYPE_LOCALE:
|
||||||
|
case CFG_DTYPE_CHARSET:
|
||||||
|
case CFG_DTYPE_TIMEZONE:
|
||||||
|
sprintf(info.value, "%s", pItem->str);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// init info scope
|
||||||
|
switch (pItem->scope) {
|
||||||
|
case CFG_SCOPE_SERVER:
|
||||||
|
strcpy(info.scope, "server");
|
||||||
|
break;
|
||||||
|
case CFG_SCOPE_CLIENT:
|
||||||
|
strcpy(info.scope, "client");
|
||||||
|
break;
|
||||||
|
case CFG_SCOPE_BOTH:
|
||||||
|
strcpy(info.scope, "both");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(info.scope, "unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// init info category
|
||||||
|
switch (pItem->category) {
|
||||||
|
case CFG_CATEGORY_GLOBAL:
|
||||||
|
strcpy(info.category, "global");
|
||||||
|
break;
|
||||||
|
case CFG_CATEGORY_LOCAL:
|
||||||
|
strcpy(info.category, "local");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
strcpy(info.category, "unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
taosArrayPush(pInfos, &info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pInfos;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -1087,90 +1159,13 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
rsp.variables = taosArrayInit(16, sizeof(SVariablesInfo));
|
|
||||||
if (NULL == rsp.variables) {
|
|
||||||
mError("failed to alloc SVariablesInfo array while process show variables req");
|
|
||||||
code = terrno;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
SVariablesInfo info = {0};
|
SVariablesInfo info = {0};
|
||||||
|
|
||||||
(void)strcpy(info.name, "statusInterval");
|
rsp.variables = initVariablesFromItems(taosGetGlobalCfg(tsCfg));
|
||||||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsStatusInterval);
|
if (rsp.variables == NULL) {
|
||||||
(void)strcpy(info.scope, "server");
|
|
||||||
// fill info.info
|
|
||||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
|
||||||
code = terrno;
|
code = terrno;
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)strcpy(info.name, "timezone");
|
|
||||||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", tsTimezoneStr);
|
|
||||||
(void)strcpy(info.scope, "both");
|
|
||||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
|
||||||
code = terrno;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)strcpy(info.name, "locale");
|
|
||||||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", tsLocale);
|
|
||||||
(void)strcpy(info.scope, "both");
|
|
||||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
|
||||||
code = terrno;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)strcpy(info.name, "charset");
|
|
||||||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", tsCharset);
|
|
||||||
(void)strcpy(info.scope, "both");
|
|
||||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
|
||||||
code = terrno;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)strcpy(info.name, "monitor");
|
|
||||||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsEnableMonitor);
|
|
||||||
(void)strcpy(info.scope, "server");
|
|
||||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
|
||||||
code = terrno;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)strcpy(info.name, "monitorInterval");
|
|
||||||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsMonitorInterval);
|
|
||||||
(void)strcpy(info.scope, "server");
|
|
||||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
|
||||||
code = terrno;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)strcpy(info.name, "slowLogThreshold");
|
|
||||||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogThreshold);
|
|
||||||
(void)strcpy(info.scope, "server");
|
|
||||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
|
||||||
code = terrno;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)strcpy(info.name, "slowLogMaxLen");
|
|
||||||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%d", tsSlowLogMaxLen);
|
|
||||||
(void)strcpy(info.scope, "server");
|
|
||||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
|
||||||
code = terrno;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
char scopeStr[64] = {0};
|
|
||||||
getSlowLogScopeString(tsSlowLogScope, scopeStr);
|
|
||||||
(void)strcpy(info.name, "slowLogScope");
|
|
||||||
(void)snprintf(info.value, TSDB_CONFIG_VALUE_LEN, "%s", scopeStr);
|
|
||||||
(void)strcpy(info.scope, "server");
|
|
||||||
if (taosArrayPush(rsp.variables, &info) == NULL) {
|
|
||||||
code = terrno;
|
|
||||||
goto _OVER;
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
||||||
|
|
|
@ -960,6 +960,12 @@ static int32_t buildLocalVariablesResultDataBlock(SSDataBlock** pOutput) {
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||||
|
infoData.info.bytes = SHOW_LOCAL_VARIABLES_RESULT_FIELD5_LEN;
|
||||||
|
if (taosArrayPush(pBlock->pDataBlock, &infoData) == NULL) {
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
*pOutput = pBlock;
|
*pOutput = pBlock;
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "parTranslater.h"
|
|
||||||
#include "parInt.h"
|
#include "parInt.h"
|
||||||
|
#include "parTranslater.h"
|
||||||
#include "tdatablock.h"
|
#include "tdatablock.h"
|
||||||
|
|
||||||
#include "catalog.h"
|
#include "catalog.h"
|
||||||
|
@ -1876,9 +1876,8 @@ static EDealRes translateColumnInGroupByClause(STranslateContext* pCxt, SColumnN
|
||||||
} else {
|
} else {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
res = translateColumnWithoutPrefix(pCxt, pCol);
|
res = translateColumnWithoutPrefix(pCxt, pCol);
|
||||||
if (!(*pCol)->node.asParam &&
|
if (!(*pCol)->node.asParam && res != DEAL_RES_CONTINUE && res != DEAL_RES_END &&
|
||||||
res != DEAL_RES_CONTINUE &&
|
pCxt->errCode != TSDB_CODE_PAR_AMBIGUOUS_COLUMN) {
|
||||||
res != DEAL_RES_END && pCxt->errCode != TSDB_CODE_PAR_AMBIGUOUS_COLUMN) {
|
|
||||||
res = translateColumnUseAlias(pCxt, pCol, &found);
|
res = translateColumnUseAlias(pCxt, pCol, &found);
|
||||||
*translateAsAlias = true;
|
*translateAsAlias = true;
|
||||||
}
|
}
|
||||||
|
@ -3321,9 +3320,11 @@ static int32_t selectCommonType(SDataType* commonType, const SDataType* newType)
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((resultType == TSDB_DATA_TYPE_VARCHAR) && (IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) {
|
if ((resultType == TSDB_DATA_TYPE_VARCHAR) &&
|
||||||
|
(IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) {
|
||||||
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN);
|
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN);
|
||||||
} else if ((resultType == TSDB_DATA_TYPE_NCHAR) && (IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) {
|
} else if ((resultType == TSDB_DATA_TYPE_NCHAR) &&
|
||||||
|
(IS_MATHABLE_TYPE(commonType->type) || IS_MATHABLE_TYPE(newType->type))) {
|
||||||
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN * TSDB_NCHAR_SIZE);
|
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), QUERY_NUMBER_MAX_DISPLAY_LEN * TSDB_NCHAR_SIZE);
|
||||||
} else {
|
} else {
|
||||||
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]);
|
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]);
|
||||||
|
@ -5528,8 +5529,7 @@ static int32_t translateGroupByList(STranslateContext* pCxt, SSelectStmt* pSelec
|
||||||
if (NULL == pSelect->pGroupByList) {
|
if (NULL == pSelect->pGroupByList) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
SReplaceGroupByAliasCxt cxt = {
|
SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
||||||
.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
|
||||||
nodesRewriteExprsPostOrder(pSelect->pGroupByList, translateGroupPartitionByImpl, &cxt);
|
nodesRewriteExprsPostOrder(pSelect->pGroupByList, translateGroupPartitionByImpl, &cxt);
|
||||||
|
|
||||||
return pCxt->errCode;
|
return pCxt->errCode;
|
||||||
|
@ -5540,8 +5540,7 @@ static int32_t translatePartitionByList(STranslateContext* pCxt, SSelectStmt* pS
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SReplaceGroupByAliasCxt cxt = {
|
SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
||||||
.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
|
||||||
nodesRewriteExprsPostOrder(pSelect->pPartitionByList, translateGroupPartitionByImpl, &cxt);
|
nodesRewriteExprsPostOrder(pSelect->pPartitionByList, translateGroupPartitionByImpl, &cxt);
|
||||||
|
|
||||||
return pCxt->errCode;
|
return pCxt->errCode;
|
||||||
|
@ -10521,7 +10520,8 @@ static void getSourceDatabase(SNode* pStmt, int32_t acctId, char* pDbFName) {
|
||||||
(void)tNameGetFullDbName(&name, pDbFName);
|
(void)tNameGetFullDbName(&name, pDbFName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* aliasName, int32_t len, char* defaultName[]) {
|
static void getStreamQueryFirstProjectAliasName(SHashObj* pUserAliasSet, char* aliasName, int32_t len,
|
||||||
|
char* defaultName[]) {
|
||||||
for (int32_t i = 0; defaultName[i] != NULL; i++) {
|
for (int32_t i = 0; defaultName[i] != NULL; i++) {
|
||||||
if (NULL == taosHashGet(pUserAliasSet, defaultName[i], strlen(defaultName[i]))) {
|
if (NULL == taosHashGet(pUserAliasSet, defaultName[i], strlen(defaultName[i]))) {
|
||||||
snprintf(aliasName, len, "%s", defaultName[i]);
|
snprintf(aliasName, len, "%s", defaultName[i]);
|
||||||
|
@ -10547,8 +10547,8 @@ static int32_t setColumnDefNodePrimaryKey(SColumnDefNode* pNode, bool isPk) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t addIrowTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect,
|
static int32_t addIrowTsToCreateStreamQueryImpl(STranslateContext* pCxt, SSelectStmt* pSelect, SHashObj* pUserAliasSet,
|
||||||
SHashObj* pUserAliasSet, SNodeList* pCols, SCMCreateStreamReq* pReq) {
|
SNodeList* pCols, SCMCreateStreamReq* pReq) {
|
||||||
SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0);
|
SNode* pProj = nodesListGetNode(pSelect->pProjectionList, 0);
|
||||||
if (!pSelect->hasInterpFunc ||
|
if (!pSelect->hasInterpFunc ||
|
||||||
(QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_irowts", ((SFunctionNode*)pProj)->functionName))) {
|
(QUERY_NODE_FUNCTION == nodeType(pProj) && 0 == strcmp("_irowts", ((SFunctionNode*)pProj)->functionName))) {
|
||||||
|
@ -10990,20 +10990,17 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm
|
||||||
|
|
||||||
if (pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) {
|
if (pStmt->pOptions->triggerType == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) {
|
||||||
if (pStmt->pOptions->fillHistory) {
|
if (pStmt->pOptions->fillHistory) {
|
||||||
return generateSyntaxErrMsgExt(
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
||||||
&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
|
||||||
"When trigger was force window close, Stream unsupported Fill history");
|
"When trigger was force window close, Stream unsupported Fill history");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pStmt->pOptions->ignoreExpired != 1) {
|
if (pStmt->pOptions->ignoreExpired != 1) {
|
||||||
return generateSyntaxErrMsgExt(
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
||||||
&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
|
||||||
"When trigger was force window close, Stream must not set ignore expired 0");
|
"When trigger was force window close, Stream must not set ignore expired 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pStmt->pOptions->ignoreUpdate != 1) {
|
if (pStmt->pOptions->ignoreUpdate != 1) {
|
||||||
return generateSyntaxErrMsgExt(
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
||||||
&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
|
||||||
"When trigger was force window close, Stream must not set ignore update 0");
|
"When trigger was force window close, Stream must not set ignore update 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13146,8 +13143,12 @@ static int32_t extractShowVariablesResultSchema(int32_t* numOfCols, SSchema** pS
|
||||||
strcpy((*pSchema)[2].name, "scope");
|
strcpy((*pSchema)[2].name, "scope");
|
||||||
|
|
||||||
(*pSchema)[3].type = TSDB_DATA_TYPE_BINARY;
|
(*pSchema)[3].type = TSDB_DATA_TYPE_BINARY;
|
||||||
(*pSchema)[3].bytes = TSDB_CONFIG_INFO_LEN;
|
(*pSchema)[3].bytes = TSDB_CONFIG_CATEGORY_LEN;
|
||||||
strcpy((*pSchema)[3].name, "info");
|
strcpy((*pSchema)[3].name, "category");
|
||||||
|
|
||||||
|
(*pSchema)[4].type = TSDB_DATA_TYPE_BINARY;
|
||||||
|
(*pSchema)[4].bytes = TSDB_CONFIG_INFO_LEN;
|
||||||
|
strcpy((*pSchema)[4].name, "info");
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -822,6 +822,32 @@ int32_t cfgDumpItemScope(SConfigItem *pItem, char *buf, int32_t bufSize, int32_t
|
||||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t cfgDumpItemCategory(SConfigItem *pItem, char *buf, int32_t bufSize, int32_t *pLen) {
|
||||||
|
int32_t len = 0;
|
||||||
|
switch (pItem->category) {
|
||||||
|
case CFG_CATEGORY_LOCAL:
|
||||||
|
len = tsnprintf(buf, bufSize, "local");
|
||||||
|
break;
|
||||||
|
case CFG_CATEGORY_GLOBAL:
|
||||||
|
len = tsnprintf(buf, bufSize, "global");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
uError("invalid category:%d", pItem->category);
|
||||||
|
TAOS_RETURN(TSDB_CODE_INVALID_CFG);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len < 0) {
|
||||||
|
TAOS_RETURN(TAOS_SYSTEM_ERROR(errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len > bufSize) {
|
||||||
|
len = bufSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pLen = len;
|
||||||
|
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
void cfgDumpCfgArrayS3(SArray *array, bool tsc, bool dump) {
|
void cfgDumpCfgArrayS3(SArray *array, bool tsc, bool dump) {
|
||||||
char src[CFG_SRC_PRINT_LEN + 1] = {0};
|
char src[CFG_SRC_PRINT_LEN + 1] = {0};
|
||||||
char name[CFG_NAME_PRINT_LEN + 1] = {0};
|
char name[CFG_NAME_PRINT_LEN + 1] = {0};
|
||||||
|
|
Loading…
Reference in New Issue