tconfig.c 16.0 KB
Newer Older
S
slguan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#define _DEFAULT_SOURCE
#include "os.h"
#include "tconfig.h"
S
Shengliang Guan 已提交
19
#include "ulog.h"
S
slguan 已提交
20 21
#include "tutil.h"

S
Shuduo Sang 已提交
22
SGlobalCfg tsGlobalConfig[TSDB_CFG_MAX_NUM] = {{0}};
S
slguan 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
int32_t    tsGlobalConfigNum = 0;

static char *tsGlobalUnit[] = {
  " ", 
  "(%)", 
  "(GB)", 
  "(Mb)", 
  "(byte)", 
  "(s)", 
  "(ms)"
};

char *tsCfgStatusStr[] = {
  "none", 
  "system default", 
  "config file", 
  "taos_options", 
  "program argument list"
};

static void taosReadFloatConfig(SGlobalCfg *cfg, char *input_value) {
  float  value = (float)atof(input_value);
  float *option = (float *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%f",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %f", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

T
tickduan 已提交
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
static void taosReadDoubleConfig(SGlobalCfg *cfg, char *input_value) {
  double  value = atof(input_value);
  double *option = (double *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%f",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %f", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

S
slguan 已提交
77 78 79 80 81 82 83 84 85 86 87
static void taosReadInt32Config(SGlobalCfg *cfg, char *input_value) {
  int32_t  value = atoi(input_value);
  int32_t *option = (int32_t *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%d",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
H
Hui Li 已提交
88
      uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
S
slguan 已提交
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

static void taosReadInt16Config(SGlobalCfg *cfg, char *input_value) {
  int32_t  value = atoi(input_value);
  int16_t *option = (int16_t *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%d",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = (int16_t)value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
static void taosReadUInt16Config(SGlobalCfg *cfg, char *input_value) {
  int32_t  value = atoi(input_value);
  uint16_t *option = (uint16_t *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%d",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = (uint16_t)value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

S
Shengliang Guan 已提交
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
static void taosReadInt8Config(SGlobalCfg *cfg, char *input_value) {
  int32_t  value = atoi(input_value);
  int8_t *option = (int8_t *)cfg->ptr;
  if (value < cfg->minValue || value > cfg->maxValue) {
    uError("config option:%s, input value:%s, out of range[%f, %f], use default value:%d",
           cfg->option, input_value, cfg->minValue, cfg->maxValue, *option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      *option = (int8_t)value;
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %d", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], *option);
    }
  }
}

H
Hongze Cheng 已提交
145
static bool taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
S
TD-1037  
Shengliang Guan 已提交
146
  int   length = (int)strlen(input_value);
S
slguan 已提交
147 148
  char *option = (char *)cfg->ptr;
  if (length <= 0 || length > cfg->ptrLength) {
S
TD-1767  
Shengliang Guan 已提交
149 150 151
    uError("config option:%s, input value:%s, length out of range[0, %d], use default value:%s", cfg->option,
           input_value, cfg->ptrLength, option);
    return false;
S
slguan 已提交
152 153
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
S
Shengliang Guan 已提交
154 155
      taosExpandDir(input_value, option, cfg->ptrLength);
      taosRealPath(option, cfg->ptrLength);
S
TD-1767  
Shengliang Guan 已提交
156

157
      if (taosMkDir(option) != 0) {
S
TD-1767  
Shengliang Guan 已提交
158 159 160
        uError("config option:%s, input value:%s, directory not exist, create fail:%s", cfg->option, input_value,
               strerror(errno));
        return false;
S
slguan 已提交
161 162 163 164 165 166 167
      }
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], option);
    }
  }
S
TD-1767  
Shengliang Guan 已提交
168 169

  return true;
S
slguan 已提交
170 171 172
}

static void taosReadIpStrConfig(SGlobalCfg *cfg, char *input_value) {
173
  uint32_t value = taosInetAddr(input_value);
S
slguan 已提交
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
  char *   option = (char *)cfg->ptr;
  if (value == INADDR_NONE) {
    uError("config option:%s, input value:%s, is not a valid ip address, use default value:%s",
           cfg->option, input_value, option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      strncpy(option, input_value, cfg->ptrLength);
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], option);
    }
  }
}

static void taosReadStringConfig(SGlobalCfg *cfg, char *input_value) {
S
TD-1037  
Shengliang Guan 已提交
190
  int   length = (int) strlen(input_value);
S
slguan 已提交
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
  char *option = (char *)cfg->ptr;
  if (length <= 0 || length > cfg->ptrLength) {
    uError("config option:%s, input value:%s, length out of range[0, %d], use default value:%s",
           cfg->option, input_value, cfg->ptrLength, option);
  } else {
    if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_FILE) {
      strncpy(option, input_value, cfg->ptrLength);
      cfg->cfgStatus = TAOS_CFG_CSTATUS_FILE;
    } else {
      uWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, input_value,
            tsCfgStatusStr[cfg->cfgStatus], option);
    }
  }
}

static void taosReadLogOption(char *option, char *value) {
  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
    if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_CONFIG) || !(cfg->cfgType & TSDB_CFG_CTYPE_B_LOG)) continue;
    if (strcasecmp(cfg->option, option) != 0) continue;

    switch (cfg->valType) {
      case TAOS_CFG_VTYPE_INT32:
        taosReadInt32Config(cfg, value);
S
Shengliang Guan 已提交
215 216 217
        // if (strcasecmp(cfg->option, "debugFlag") == 0) {
        //   taosSetAllDebugFlag();
        // }
S
slguan 已提交
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
        break;
      case TAOS_CFG_VTYPE_DIRECTORY:
        taosReadDirectoryConfig(cfg, value);
        break;
      default:
        break;
    }
    break;
  }
}

SGlobalCfg *taosGetConfigOption(const char *option) {
  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
    if (strcasecmp(cfg->option, option) != 0) continue;
    return cfg;
  }
  return NULL;
}

S
TD-1767  
Shengliang Guan 已提交
238
static void taosReadConfigOption(const char *option, char *value, char *value2, char *value3) {
S
slguan 已提交
239 240 241 242 243 244
  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
    if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_CONFIG)) continue;
    if (strcasecmp(cfg->option, option) != 0) continue;

    switch (cfg->valType) {
S
Shengliang Guan 已提交
245 246 247
      case TAOS_CFG_VTYPE_INT8:
        taosReadInt8Config(cfg, value);
        break;
S
slguan 已提交
248 249 250 251 252 253
      case TAOS_CFG_VTYPE_INT16:
        taosReadInt16Config(cfg, value);
        break;
      case TAOS_CFG_VTYPE_INT32:
        taosReadInt32Config(cfg, value);
        break;
254 255 256
      case TAOS_CFG_VTYPE_UINT16:
        taosReadUInt16Config(cfg, value);
        break;
S
slguan 已提交
257 258 259
      case TAOS_CFG_VTYPE_FLOAT:
        taosReadFloatConfig(cfg, value);
        break;
T
tickduan 已提交
260 261 262
      case TAOS_CFG_VTYPE_DOUBLE:
        taosReadDoubleConfig(cfg, value);
        break;
S
slguan 已提交
263 264 265 266 267 268 269 270 271
      case TAOS_CFG_VTYPE_STRING:
        taosReadStringConfig(cfg, value);
        break;
      case TAOS_CFG_VTYPE_IPSTR:
        taosReadIpStrConfig(cfg, value);
        break;
      case TAOS_CFG_VTYPE_DIRECTORY:
        taosReadDirectoryConfig(cfg, value);
        break;
S
TD-1767  
Shengliang Guan 已提交
272
      case TAOS_CFG_VTYPE_DATA_DIRCTORY:
S
TD-1767  
Shengliang Guan 已提交
273
        if (taosReadDirectoryConfig(cfg, value)) {
S
Shengliang Guan 已提交
274
          // taosReadDataDirCfg(value, value2, value3);
S
TD-1767  
Shengliang Guan 已提交
275 276
        }
        break;
S
slguan 已提交
277 278 279 280 281 282 283 284
      default:
        uError("config option:%s, input value:%s, can't be recognized", option, value);
        break;
    }
    break;
  }
}

285
void taosAddConfigOption(SGlobalCfg cfg) {
S
slguan 已提交
286 287 288 289 290 291 292 293 294
  tsGlobalConfig[tsGlobalConfigNum++] = cfg;
}

void taosReadGlobalLogCfg() {
  FILE * fp;
  char * line, *option, *value;
  int    olen, vlen;
  char   fileName[PATH_MAX] = {0};

S
Shengliang Guan 已提交
295
  taosExpandDir(configDir, configDir, PATH_MAX);
296
  taosReadLogOption("logDir", tsLogDir);
S
slguan 已提交
297 298 299 300 301 302 303
  
  sprintf(fileName, "%s/taos.cfg", configDir);
  fp = fopen(fileName, "r");
  if (fp == NULL) {
    printf("\nconfig file:%s not found, all variables are set to default\n", fileName);
    return;
  }
304 305

  ssize_t _bytes = 0;
S
slguan 已提交
306 307 308 309 310 311 312 313 314
  size_t len = 1024;
  line = calloc(1, len);
  
  while (!feof(fp)) {
    memset(line, 0, len);
    
    option = value = NULL;
    olen = vlen = 0;

315 316 317 318 319 320
    _bytes = tgetline(&line, &len, fp);
    if (_bytes < 0)
    {
      break;
    }

S
slguan 已提交
321
    line[len - 1] = 0;
322

S
slguan 已提交
323 324 325 326 327 328 329 330 331 332 333
    paGetToken(line, &option, &olen);
    if (olen == 0) continue;
    option[olen] = 0;

    paGetToken(option + olen + 1, &value, &vlen);
    if (vlen == 0) continue;
    value[vlen] = 0;

    taosReadLogOption(option, value);
  }

S
TD-1848  
Shengliang Guan 已提交
334
  tfree(line);
S
slguan 已提交
335 336 337
  fclose(fp);
}

338
int32_t taosReadCfgFromFile() {
S
TD-1767  
Shengliang Guan 已提交
339 340
  char * line, *option, *value, *value2, *value3;
  int    olen, vlen, vlen2, vlen3;
S
slguan 已提交
341 342 343
  char   fileName[PATH_MAX] = {0};

  sprintf(fileName, "%s/taos.cfg", configDir);
S
Shengliang Guan 已提交
344
  FILE *fp = fopen(fileName, "r");
345 346 347
  if (fp == NULL) {
    fp = fopen(configDir, "r");
    if (fp == NULL) {
348
      return -1;
349 350
    }
  }
351 352

  ssize_t _bytes = 0;
S
slguan 已提交
353 354 355
  size_t len = 1024;
  line = calloc(1, len);
  
356 357
  while (!feof(fp)) {
    memset(line, 0, len);
S
slguan 已提交
358

S
TD-1767  
Shengliang Guan 已提交
359 360
    option = value = value2 = value3 = NULL;
    olen = vlen = vlen2 = vlen3 = 0;
S
slguan 已提交
361

362 363 364 365 366 367
    _bytes = tgetline(&line, &len, fp);
    if (_bytes < 0)
    {
      break;
    }

368 369 370 371 372
    line[len - 1] = 0;
    
    paGetToken(line, &option, &olen);
    if (olen == 0) continue;
    option[olen] = 0;
S
slguan 已提交
373

374 375 376
    paGetToken(option + olen + 1, &value, &vlen);
    if (vlen == 0) continue;
    value[vlen] = 0;
S
slguan 已提交
377

S
TD-1767  
Shengliang Guan 已提交
378
    paGetToken(value + vlen + 1, &value2, &vlen2);
S
TD-1767  
Shengliang Guan 已提交
379 380 381 382 383
    if (vlen2 != 0) {
      value2[vlen2] = 0;
      paGetToken(value2 + vlen2 + 1, &value3, &vlen3);
      if (vlen3 != 0) value3[vlen3] = 0;
    }
S
TD-1767  
Shengliang Guan 已提交
384 385

    taosReadConfigOption(option, value, value2, value3);
S
slguan 已提交
386 387
  }

388 389
  fclose(fp);

S
TD-1848  
Shengliang Guan 已提交
390
  tfree(line);
S
TD-1663  
Shengliang Guan 已提交
391

S
Shengliang Guan 已提交
392 393 394
  // if (debugFlag & DEBUG_TRACE || debugFlag & DEBUG_DEBUG || debugFlag & DEBUG_DUMP) {
  //   taosSetAllDebugFlag();
  // }
S
TD-1663  
Shengliang Guan 已提交
395

396
  return 0;
S
slguan 已提交
397 398
}

399
void taosPrintCfg() {
400 401
  uInfo("   taos config & system info:");
  uInfo("==================================");
S
slguan 已提交
402 403 404

  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
L
Liu Jicong 已提交
405
    if (tscEmbeddedInUtil == 0 && !(cfg->cfgType & TSDB_CFG_CTYPE_B_CLIENT)) continue;
S
slguan 已提交
406 407 408 409 410 411 412 413 414 415 416
    if (cfg->cfgType & TSDB_CFG_CTYPE_B_NOT_PRINT) continue;
    
    int optionLen = (int)strlen(cfg->option);
    int blankLen = TSDB_CFG_PRINT_LEN - optionLen;
    blankLen = blankLen < 0 ? 0 : blankLen;

    char blank[TSDB_CFG_PRINT_LEN];
    memset(blank, ' ', TSDB_CFG_PRINT_LEN);
    blank[blankLen] = 0;

    switch (cfg->valType) {
S
Shengliang Guan 已提交
417 418 419
      case TAOS_CFG_VTYPE_INT8:
        uInfo(" %s:%s%d%s", cfg->option, blank, *((int8_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
slguan 已提交
420
      case TAOS_CFG_VTYPE_INT16:
421
        uInfo(" %s:%s%d%s", cfg->option, blank, *((int16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
S
slguan 已提交
422 423
        break;
      case TAOS_CFG_VTYPE_INT32:
424
        uInfo(" %s:%s%d%s", cfg->option, blank, *((int32_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
S
slguan 已提交
425
        break;
426 427 428
      case TAOS_CFG_VTYPE_UINT16:
        uInfo(" %s:%s%d%s", cfg->option, blank, *((uint16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
slguan 已提交
429
      case TAOS_CFG_VTYPE_FLOAT:
430
        uInfo(" %s:%s%f%s", cfg->option, blank, *((float *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
S
slguan 已提交
431
        break;
T
tickduan 已提交
432 433 434
      case TAOS_CFG_VTYPE_DOUBLE:
        uInfo(" %s:%s%f%s", cfg->option, blank, *((double *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
slguan 已提交
435 436 437
      case TAOS_CFG_VTYPE_STRING:
      case TAOS_CFG_VTYPE_IPSTR:
      case TAOS_CFG_VTYPE_DIRECTORY:
438
        uInfo(" %s:%s%s%s", cfg->option, blank, (char *)cfg->ptr, tsGlobalUnit[cfg->unitType]);
S
slguan 已提交
439 440 441 442 443 444 445
        break;
      default:
        break;
    }
  }

  taosPrintOsInfo();
S
TD-1767  
Shengliang Guan 已提交
446
  uInfo("==================================");
S
slguan 已提交
447
}
S
stephenkgu 已提交
448 449 450 451 452 453 454 455 456 457 458

static void taosDumpCfg(SGlobalCfg *cfg) {
    int optionLen = (int)strlen(cfg->option);
    int blankLen = TSDB_CFG_PRINT_LEN - optionLen;
    blankLen = blankLen < 0 ? 0 : blankLen;

    char blank[TSDB_CFG_PRINT_LEN];
    memset(blank, ' ', TSDB_CFG_PRINT_LEN);
    blank[blankLen] = 0;

    switch (cfg->valType) {
S
Shengliang Guan 已提交
459 460 461
      case TAOS_CFG_VTYPE_INT8:
        printf(" %s:%s%d%s\n", cfg->option, blank, *((int8_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
stephenkgu 已提交
462 463 464 465 466 467
      case TAOS_CFG_VTYPE_INT16:
        printf(" %s:%s%d%s\n", cfg->option, blank, *((int16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
      case TAOS_CFG_VTYPE_INT32:
        printf(" %s:%s%d%s\n", cfg->option, blank, *((int32_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
468 469 470
      case TAOS_CFG_VTYPE_UINT16:
        printf(" %s:%s%d%s\n", cfg->option, blank, *((uint16_t *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
S
stephenkgu 已提交
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
      case TAOS_CFG_VTYPE_FLOAT:
        printf(" %s:%s%f%s\n", cfg->option, blank, *((float *)cfg->ptr), tsGlobalUnit[cfg->unitType]);
        break;
      case TAOS_CFG_VTYPE_STRING:
      case TAOS_CFG_VTYPE_IPSTR:
      case TAOS_CFG_VTYPE_DIRECTORY:
        printf(" %s:%s%s%s\n", cfg->option, blank, (char *)cfg->ptr, tsGlobalUnit[cfg->unitType]);
        break;
      default:
        break;
    }
}

void taosDumpGlobalCfg() {
  printf("taos global config:\n");
  printf("==================================\n");
  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
L
Liu Jicong 已提交
489
    if (tscEmbeddedInUtil == 0 && !(cfg->cfgType & TSDB_CFG_CTYPE_B_CLIENT)) continue;
S
stephenkgu 已提交
490 491 492 493 494 495 496 497 498 499 500
    if (cfg->cfgType & TSDB_CFG_CTYPE_B_NOT_PRINT) continue;
    if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_SHOW)) continue;

    taosDumpCfg(cfg);
  }

  printf("\ntaos local config:\n");
  printf("==================================\n");

  for (int i = 0; i < tsGlobalConfigNum; ++i) {
    SGlobalCfg *cfg = tsGlobalConfig + i;
L
Liu Jicong 已提交
501
    if (tscEmbeddedInUtil == 0 && !(cfg->cfgType & TSDB_CFG_CTYPE_B_CLIENT)) continue;
S
stephenkgu 已提交
502 503 504 505 506 507
    if (cfg->cfgType & TSDB_CFG_CTYPE_B_NOT_PRINT) continue;
    if (cfg->cfgType & TSDB_CFG_CTYPE_B_SHOW) continue;

    taosDumpCfg(cfg);
  }
}