[td-225] fix bug in "show configs";
This commit is contained in:
parent
5aff8962a4
commit
3e2ea659cb
|
@ -857,13 +857,13 @@ static int32_t mnodeGetConfigMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
|
||||||
|
|
||||||
pShow->bytes[cols] = TSDB_CFG_OPTION_LEN + VARSTR_HEADER_SIZE;
|
pShow->bytes[cols] = TSDB_CFG_OPTION_LEN + VARSTR_HEADER_SIZE;
|
||||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||||
strcpy(pSchema[cols].name, "config name");
|
tstrncpy(pSchema[cols].name, "name", sizeof(pSchema[cols].name));
|
||||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
pShow->bytes[cols] = TSDB_CFG_VALUE_LEN + VARSTR_HEADER_SIZE;
|
pShow->bytes[cols] = TSDB_CFG_VALUE_LEN + VARSTR_HEADER_SIZE;
|
||||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||||
strcpy(pSchema[cols].name, "config value");
|
tstrncpy(pSchema[cols].name, "value", sizeof(pSchema[cols].name));
|
||||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
|
@ -898,27 +898,32 @@ static int32_t mnodeRetrieveConfigs(SShowObj *pShow, char *data, int32_t rows, v
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
|
|
||||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
snprintf(pWrite, TSDB_CFG_OPTION_LEN, "%s", cfg->option);
|
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, cfg->option, TSDB_CFG_OPTION_LEN);
|
||||||
|
|
||||||
cols++;
|
cols++;
|
||||||
|
int32_t t = 0;
|
||||||
|
|
||||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
switch (cfg->valType) {
|
switch (cfg->valType) {
|
||||||
case TAOS_CFG_VTYPE_INT16:
|
case TAOS_CFG_VTYPE_INT16:
|
||||||
snprintf(pWrite, TSDB_CFG_VALUE_LEN, "%d", *((int16_t *)cfg->ptr));
|
t = snprintf(varDataVal(pWrite), TSDB_CFG_VALUE_LEN, "%d", *((int16_t *)cfg->ptr));
|
||||||
|
varDataSetLen(pWrite, t);
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
break;
|
break;
|
||||||
case TAOS_CFG_VTYPE_INT32:
|
case TAOS_CFG_VTYPE_INT32:
|
||||||
snprintf(pWrite, TSDB_CFG_VALUE_LEN, "%d", *((int32_t *)cfg->ptr));
|
t = snprintf(varDataVal(pWrite), TSDB_CFG_VALUE_LEN, "%d", *((int32_t *)cfg->ptr));
|
||||||
|
varDataSetLen(pWrite, t);
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
break;
|
break;
|
||||||
case TAOS_CFG_VTYPE_FLOAT:
|
case TAOS_CFG_VTYPE_FLOAT:
|
||||||
snprintf(pWrite, TSDB_CFG_VALUE_LEN, "%f", *((float *)cfg->ptr));
|
t = snprintf(varDataVal(pWrite), TSDB_CFG_VALUE_LEN, "%f", *((float *)cfg->ptr));
|
||||||
|
varDataSetLen(pWrite, t);
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
break;
|
break;
|
||||||
case TAOS_CFG_VTYPE_STRING:
|
case TAOS_CFG_VTYPE_STRING:
|
||||||
case TAOS_CFG_VTYPE_IPSTR:
|
case TAOS_CFG_VTYPE_IPSTR:
|
||||||
case TAOS_CFG_VTYPE_DIRECTORY:
|
case TAOS_CFG_VTYPE_DIRECTORY:
|
||||||
snprintf(pWrite, TSDB_CFG_VALUE_LEN, "%s", (char *)cfg->ptr);
|
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, cfg->ptr, TSDB_CFG_VALUE_LEN);
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue