• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #5044

06 May 2026 02:35AM UTC coverage: 73.169% (+0.06%) from 73.107%
#5044

push

travis-ci

web-flow
feat: [6659794715] cpu limit (#35153)

244 of 275 new or added lines in 23 files covered. (88.73%)

526 existing lines in 141 files now uncovered.

277745 of 379596 relevant lines covered (73.17%)

133740972.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

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

16
#define _DEFAULT_SOURCE
17
#include "tdatablock.h"
18
#include "tglobal.h"
19
#include "tjson.h"
20
#include "tmisce.h"
21
#include "tcompare.h"
22

23
int32_t taosGetIpv4FromEp(const char* ep, SEp* pEp) {
113,212,062✔
24
  pEp->port = 0;
113,212,062✔
25
  memset(pEp->fqdn, 0, TSDB_FQDN_LEN);
113,212,759✔
26
  tstrncpy(pEp->fqdn, ep, TSDB_FQDN_LEN);
113,212,592✔
27

28
  char* temp = strrchr(pEp->fqdn, ':');
113,212,106✔
29
  if (temp) {
113,211,082✔
30
    *temp = 0;
13,502,092✔
31
    pEp->port = taosStr2UInt16(temp + 1, NULL, 10);
13,502,702✔
32
    if (pEp->port < 0) {
33
      return TSDB_CODE_INVALID_PARA;
34
    }
35
  }
36

37
  if (pEp->port == 0) {
113,212,043✔
38
    pEp->port = tsServerPort;
99,710,962✔
39
  }
40

41
  if (pEp->port <= 0) {
113,212,025✔
42
    return TSDB_CODE_INVALID_PARA;
×
43
  }
44
  return 0;
113,212,420✔
45
}
46

47
static int8_t isValidPort(const char* str) {
424✔
48
  if (!str || !*str) return 0;
424✔
49
  for (const char* p = str; *p; ++p) {
1,802✔
50
    if (*p < '0' || *p > '9') {
1,378✔
51
      return 0;
×
52
    }
53
  }
54
  return 1;
424✔
55
}
56

57
static int32_t taosGetDualIpFromEp(const char* ep, SEp* pEp) {
848✔
58
  memset(pEp->fqdn, 0, TSDB_FQDN_LEN);
848✔
59
  pEp->port = 0;
848✔
60
  char buf[TSDB_FQDN_LEN] = {0};
848✔
61

62
  if (ep[0] == '[') {
848✔
63
    // [IPv6]:port format
64
    const char* end = strchr(ep, ']');
212✔
65
    if (!end) return TSDB_CODE_INVALID_PARA;
212✔
66

67
    int ipLen = end - ep - 1;
212✔
68
    if (ipLen >= TSDB_FQDN_LEN) ipLen = TSDB_FQDN_LEN - 1;
212✔
69

70
    tstrncpy(pEp->fqdn, ep + 1, ipLen + 1);
212✔
71

72
    if (*(end + 1) == ':' && *(end + 2)) {
212✔
73
      pEp->port = taosStr2UInt16(end + 2, NULL, 10);
106✔
74
    }
75
  } else {
76
    // Compatible with ::1:6030, ::1, IPv4:port, hostname:port, etc.
77
    tstrncpy(buf, ep, sizeof(buf));
636✔
78

79
    char* lastColon = strrchr(buf, ':');
636✔
80
    char* firstColon = strchr(buf, ':');
636✔
81

82
    if (lastColon && firstColon != lastColon) {
954✔
83
      // Multiple colons, possibly IPv6:port or pure IPv6
84
      char* portStr = lastColon + 1;
318✔
85
      if (isValidPort(portStr) && lastColon != buf && (*(lastColon - 1) != ':')) {
318✔
86
        *lastColon = 0;
212✔
87
        tstrncpy(pEp->fqdn, buf, TSDB_FQDN_LEN);
212✔
88
        pEp->port = taosStr2UInt16(portStr, NULL, 10);
212✔
89
      } else {
90
        tstrncpy(pEp->fqdn, ep, TSDB_FQDN_LEN);
106✔
91
      }
92
    } else if (lastColon) {
318✔
93
      // Only one colon, IPv4:port or hostname:port
94
      char* portStr = lastColon + 1;
106✔
95
      if (isValidPort(portStr) && lastColon != buf) {
106✔
96
        *lastColon = 0;
106✔
97
        tstrncpy(pEp->fqdn, buf, TSDB_FQDN_LEN);
106✔
98
        pEp->port = taosStr2UInt16(portStr, NULL, 10);
106✔
99
      } else {
100
        tstrncpy(pEp->fqdn, ep, TSDB_FQDN_LEN);
×
101
      }
102
    } else {
103
      // No colon, pure hostname or IPv6 without port
104
      tstrncpy(pEp->fqdn, ep, TSDB_FQDN_LEN);
212✔
105
    }
106
  }
107

108
  if (pEp->port == 0) {
848✔
109
    pEp->port = tsServerPort;
424✔
110
  }
111

112
  if (pEp->port <= 0) {
848✔
113
    return TSDB_CODE_INVALID_PARA;
×
114
  }
115

116
  return 0;
848✔
117
}
118
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp) {
113,210,655✔
119
  if (tsEnableIpv6) {
113,210,655✔
120
    return taosGetDualIpFromEp(ep, pEp);
848✔
121
  } else {
122
    return taosGetIpv4FromEp(ep, pEp);
113,209,807✔
123
  }
124
}
125

126
int32_t addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port) {
56,553,735✔
127
  if (pEpSet == NULL || fqdn == NULL || strlen(fqdn) == 0) {
56,553,735✔
128
    return TSDB_CODE_INVALID_PARA;
×
129
  }
130

131
  int32_t index = pEpSet->numOfEps;
56,553,735✔
132
  if (index >= sizeof(pEpSet->eps) / sizeof(pEpSet->eps[0])) {
56,553,735✔
133
    return TSDB_CODE_OUT_OF_RANGE;
×
134
  }
135
  tstrncpy(pEpSet->eps[index].fqdn, fqdn, tListLen(pEpSet->eps[index].fqdn));
56,553,735✔
136
  pEpSet->eps[index].port = port;
56,553,735✔
137
  pEpSet->numOfEps += 1;
56,553,735✔
138
  return 0;
56,553,735✔
139
}
140

141
bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2) {
12,073,006✔
142
  if (s1->numOfEps != s2->numOfEps || s1->inUse != s2->inUse) {
12,073,006✔
143
    return false;
1,280,215✔
144
  }
145

146
  for (int32_t i = 0; i < s1->numOfEps; i++) {
23,144,700✔
147
    if (s1->eps[i].port != s2->eps[i].port || strncmp(s1->eps[i].fqdn, s2->eps[i].fqdn, TSDB_FQDN_LEN) != 0)
12,355,400✔
148
      return false;
3,093✔
149
  }
150
  return true;
10,789,300✔
151
}
152

153
void epsetAssign(SEpSet* pDst, const SEpSet* pSrc) {
229,798✔
154
  if (pSrc == NULL || pDst == NULL) {
229,798✔
155
    return;
×
156
  }
157

158
  pDst->inUse = pSrc->inUse;
229,798✔
159
  pDst->numOfEps = pSrc->numOfEps;
229,798✔
160
  for (int32_t i = 0; i < pSrc->numOfEps; ++i) {
874,014✔
161
    pDst->eps[i].port = pSrc->eps[i].port;
644,216✔
162
    tstrncpy(pDst->eps[i].fqdn, pSrc->eps[i].fqdn, tListLen(pSrc->eps[i].fqdn));
644,216✔
163
  }
164
}
165

166
void epAssign(SEp* pDst, SEp* pSrc) {
84,598,339✔
167
  if (pSrc == NULL || pDst == NULL) {
84,598,339✔
UNCOV
168
    return;
×
169
  }
170
  memset(pDst->fqdn, 0, tListLen(pSrc->fqdn));
84,598,430✔
171
  tstrncpy(pDst->fqdn, pSrc->fqdn, tListLen(pSrc->fqdn));
84,597,658✔
172
  pDst->port = pSrc->port;
84,599,925✔
173
}
174

175
void epsetSort(SEpSet* pDst) {
93,221,251✔
176
  if (pDst->numOfEps <= 1) {
93,221,251✔
177
    return;
68,475,184✔
178
  }
179
  int validIdx = false;
24,747,403✔
180
  SEp ep = {0};
24,747,403✔
181
  if (pDst->inUse >= 0 && pDst->inUse < pDst->numOfEps) {
24,747,178✔
182
    validIdx = true;
24,746,401✔
183
    epAssign(&ep, &pDst->eps[pDst->inUse]);
24,746,401✔
184
  }
185

186
  for (int i = 0; i < pDst->numOfEps - 1; i++) {
71,617,534✔
187
    for (int j = 0; j < pDst->numOfEps - 1 - i; j++) {
119,263,741✔
188
      SEp* f = &pDst->eps[j];
72,394,500✔
189
      SEp* s = &pDst->eps[j + 1];
72,394,278✔
190
      int  cmp = strncmp(f->fqdn, s->fqdn, sizeof(f->fqdn));
72,394,018✔
191
      if (cmp > 0 || (cmp == 0 && f->port > s->port)) {
72,396,110✔
192
        SEp ep1 = {0};
19,950,653✔
193
        epAssign(&ep1, f);
19,950,589✔
194
        epAssign(f, s);
19,950,589✔
195
        epAssign(s, &ep1);
19,950,589✔
196
      }
197
    }
198
  }
199
  if (validIdx == true)
24,748,231✔
200
    for (int i = 0; i < pDst->numOfEps; i++) {
46,669,182✔
201
      int cmp = strncmp(ep.fqdn, pDst->eps[i].fqdn, sizeof(ep.fqdn));
46,668,820✔
202
      if (cmp == 0 && ep.port == pDst->eps[i].port) {
46,666,796✔
203
        pDst->inUse = i;
24,747,615✔
204
        break;
24,747,698✔
205
      }
206
    }
207
}
208

209
void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet) {
1,284,634✔
210
  taosCorBeginWrite(&pEpSet->version);
1,284,634✔
211
  pEpSet->epSet = *pNewEpSet;
1,284,634✔
212
  taosCorEndWrite(&pEpSet->version);
1,284,634✔
213
}
1,284,634✔
214

215
SEpSet getEpSet_s(SCorEpSet* pEpSet) {
2,147,483,647✔
216
  SEpSet ep = {0};
2,147,483,647✔
217
  taosCorBeginRead(&pEpSet->version);
2,147,483,647✔
218
  ep = pEpSet->epSet;
2,147,483,647✔
219
  taosCorEndRead(&pEpSet->version);
2,147,483,647✔
220

221
  return ep;
2,147,483,647✔
222
}
223

224
int32_t epsetToStr(const SEpSet* pEpSet, char* pBuf, int32_t cap) {
1,356,052,235✔
225
  int32_t ret = 0;
1,356,052,235✔
226
  int32_t nwrite = 0;
1,356,052,235✔
227

228
  nwrite = snprintf(pBuf + nwrite, cap, "epset:{");
1,356,052,235✔
229
  if (nwrite <= 0 || nwrite >= cap) {
1,356,120,729✔
230
    return TSDB_CODE_OUT_OF_BUFFER;
62,909✔
231
  }
232
  cap -= nwrite;
1,356,060,135✔
233

234
  for (int _i = 0; (_i < pEpSet->numOfEps) && (cap > 0); _i++) {
2,147,483,647✔
235
    if (_i == pEpSet->numOfEps - 1) {
1,710,486,966✔
236
      ret = snprintf(pBuf + nwrite, cap, "%d. %s:%d", _i, pEpSet->eps[_i].fqdn, pEpSet->eps[_i].port);
1,356,079,578✔
237
    } else {
238
      ret = snprintf(pBuf + nwrite, cap, "%d. %s:%d, ", _i, pEpSet->eps[_i].fqdn, pEpSet->eps[_i].port);
354,391,275✔
239
    }
240

241
    if (ret <= 0 || ret >= cap) {
1,710,439,616✔
242
      return TSDB_CODE_OUT_OF_BUFFER;
7,078✔
243
    }
244

245
    nwrite += ret;
1,710,432,543✔
246
    cap -= ret;
1,710,432,543✔
247
  }
248

249
  if (cap <= 0) {
1,356,068,903✔
250
    return TSDB_CODE_OUT_OF_BUFFER;
×
251
  }
252

253
  ret = snprintf(pBuf + nwrite, cap, "}, inUse:%d", pEpSet->inUse);
1,356,068,903✔
254
  if (ret <= 0 || ret >= cap) {
1,356,071,956✔
255
    return TSDB_CODE_OUT_OF_BUFFER;
5✔
256
  } else {
257
    return TSDB_CODE_SUCCESS;
1,356,090,269✔
258
  }
259
}
260

261
int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t startTime) {
×
262
  int32_t code = 0;
×
263
  SJson*  pJson = tjsonCreateObject();
×
264
  if (pJson == NULL) return terrno;
×
265

266
  char tmp[4096] = {0};
×
267

268
  TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "reportVersion", 1), NULL, _exit);
×
269

270
  TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "clusterId", clusterId), NULL, _exit);
×
271
  TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "startTime", startTime), NULL, _exit);
×
272

273
  // Do NOT invoke the taosGetFqdn here.
274
  // this function may be invoked when memory exception occurs,so we should assume that it is running in a memory locked
275
  // environment. The lock operation by taosGetFqdn may cause this program deadlock.
276
  TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "fqdn", tsLocalFqdn), NULL, _exit);
×
277

278
  TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "pid", taosGetPId()), NULL, _exit);
×
279

280
  code = taosGetAppName(tmp, NULL);
×
281
  if (code != 0) {
×
282
    TAOS_CHECK_GOTO(code, NULL, _exit);
×
283
  }
284
  TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "appName", tmp), NULL, _exit);
×
285

286
  if (taosGetOsReleaseName(tmp, NULL, NULL, sizeof(tmp)) == 0) {
×
287
    TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "os", tmp), NULL, _exit);
×
288
  } else {
289
    // do nothing
290
  }
291

292
  float numOfCores = 0;
×
293
  if (taosGetCpuInfo(tmp, sizeof(tmp), &numOfCores) == 0) {
×
294
    TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "cpuModel", tmp), NULL, _exit);
×
295
    TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfCpu", numOfCores), NULL, _exit);
×
296
  } else {
297
    TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfCpu", tsNumOfCores), NULL, _exit);
×
298
  }
299

300
  int32_t nBytes = snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB);
×
301
  if (nBytes <= 9 || nBytes >= sizeof(tmp)) {
×
302
    TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_RANGE, NULL, _exit);
×
303
  }
304
  TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "memory", tmp), NULL, _exit);
×
305

306
  TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "version", td_version), NULL, _exit);
×
307
  TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "buildInfo", td_buildinfo), NULL, _exit);
×
308
  TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "gitInfo", td_gitinfo), NULL, _exit);
×
309

310
  TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "crashSig", signum), NULL, _exit);
×
311
  TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "crashTs", taosGetTimestampUs()), NULL, _exit);
×
312

313
#if 0
314
#ifdef _TD_DARWIN_64
315
  taosLogTraceToBuf(tmp, sizeof(tmp), 4);
316
#elif !defined(WINDOWS)
317
  taosLogTraceToBuf(tmp, sizeof(tmp), 3);
318
#else
319
  taosLogTraceToBuf(tmp, sizeof(tmp), 8);
320
#endif
321

322
  TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "stackInfo", tmp), NULL, _exit);
323
#endif
324
  char* pCont = tjsonToString(pJson);
×
325
  if (pCont == NULL) {
×
326
    code = terrno;
×
327
    TAOS_CHECK_GOTO(code, NULL, _exit);
×
328
    goto _exit;
×
329
  }
330

331
  tjsonDelete(pJson);
×
332
  *pMsg = pCont;
×
333
  pJson = NULL;
×
334
_exit:
×
335
  tjsonDelete(pJson);
×
336
  TAOS_RETURN(code);
×
337
}
338

339
#ifdef TD_ENTERPRISE
340
static bool showVarPrivAllowed(uint8_t showPrivMask, int8_t cfgPrivType) {
10,293,919✔
341
  switch (cfgPrivType) {
10,293,919✔
342
    case CFG_PRIV_SYSTEM:
8,061,372✔
343
      return (showPrivMask & SHOW_VAR_PRIV_SYSTEM) != 0;
8,061,372✔
344
    case CFG_PRIV_SECURITY:
534,653✔
345
      return (showPrivMask & SHOW_VAR_PRIV_SECURITY) != 0;
534,653✔
346
    case CFG_PRIV_AUDIT:
316,300✔
347
      return (showPrivMask & SHOW_VAR_PRIV_AUDIT) != 0;
316,300✔
348
    case CFG_PRIV_DEBUG:
1,381,594✔
349
      return (showPrivMask & SHOW_VAR_PRIV_DEBUG) != 0;
1,381,594✔
350
    default:
×
351
      return false;
×
352
  }
353
}
354
#endif
355

356
int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol, char* likePattern, uint8_t showPrivMask) {
48,720✔
357
  int32_t  code = 0;
48,720✔
358
  SConfig* pConf = taosGetCfg();
48,720✔
359
  if (pConf == NULL) {
48,720✔
360
    return TSDB_CODE_INVALID_CFG;
×
361
  }
362

363
  int32_t      numOfRows = 0;
48,720✔
364
  int32_t      col = startCol;
48,720✔
365
  SConfigItem* pItem = NULL;
48,720✔
366
  SConfigIter* pIter = NULL;
48,720✔
367

368
  int8_t locked = 0;
48,720✔
369

370
  size_t       exSize = 0;
48,720✔
371
  size_t       index = 0;
48,720✔
372
  SConfigItem* pDataDirItem = cfgGetItem(pConf, "dataDir");
48,720✔
373
  if (pDataDirItem) {
48,720✔
374
    exSize = TMAX(taosArrayGetSize(pDataDirItem->array), 1) - 1;
31,630✔
375
  }
376

377
  TAOS_CHECK_GOTO(blockDataEnsureCapacity(pBlock, cfgGetSize(pConf) + exSize), NULL, _exit);
48,720✔
378

379
  TAOS_CHECK_GOTO(cfgCreateIter(pConf, &pIter), NULL, _exit);
48,720✔
380

381
  cfgLock(pConf);
48,720✔
382
  locked = 1;
48,720✔
383

384
  while ((pItem = cfgNextIter(pIter)) != NULL) {
10,790,120✔
385
  _start:
10,741,400✔
386
    col = startCol;
10,741,400✔
387

388
    // GRANT_CFG_SKIP;
389
    char name[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0};
10,741,400✔
390
    if (likePattern && rawStrPatternMatch(pItem->name, likePattern) != TSDB_PATTERN_MATCH) {
10,741,400✔
391
      continue;
447,481✔
392
    }
393
#ifdef TD_ENTERPRISE
394
    if (!showVarPrivAllowed(showPrivMask, pItem->privType)) {
10,293,919✔
395
      continue;
6,083✔
396
    }
397
#endif
398
    STR_WITH_MAXSIZE_TO_VARSTR(name, pItem->name, TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE);
10,287,836✔
399

400
    SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
10,287,836✔
401
    if (pColInfo == NULL) {
10,287,836✔
402
      code = terrno;
×
403
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
404
    }
405

406
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, name, false), NULL, _exit);
10,287,836✔
407

408
    char      value[TSDB_CONFIG_PATH_LEN + VARSTR_HEADER_SIZE] = {0};
10,287,836✔
409
    int32_t   valueLen = 0;
10,287,836✔
410
    SDiskCfg* pDiskCfg = NULL;
10,287,836✔
411
    if (strcasecmp(pItem->name, "dataDir") == 0 && exSize > 0) {
10,287,836✔
412
      char* buf = &value[VARSTR_HEADER_SIZE];
×
413
      pDiskCfg = taosArrayGet(pItem->array, index);
×
414
      valueLen = snprintf(buf, TSDB_CONFIG_PATH_LEN, "%s", pDiskCfg->dir);
×
415
      index++;
×
416
    } else {
417
      TAOS_CHECK_GOTO(cfgDumpItemValue(pItem, &value[VARSTR_HEADER_SIZE], TSDB_CONFIG_PATH_LEN, &valueLen), NULL,
10,287,836✔
418
                      _exit);
419
    }
420
    varDataSetLen(value, valueLen);
10,287,836✔
421

422
    pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
10,287,836✔
423
    if (pColInfo == NULL) {
10,287,836✔
424
      code = terrno;
×
425
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
426
    }
427

428
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, value, false), NULL, _exit);
10,287,836✔
429

430
    char scope[TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE] = {0};
10,287,836✔
431
    TAOS_CHECK_GOTO(cfgDumpItemScope(pItem, &scope[VARSTR_HEADER_SIZE], TSDB_CONFIG_SCOPE_LEN, &valueLen), NULL, _exit);
10,287,836✔
432
    varDataSetLen(scope, valueLen);
10,287,836✔
433

434
    pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
10,287,836✔
435
    if (pColInfo == NULL) {
10,287,836✔
436
      code = terrno;
×
437
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
438
    }
439
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, scope, false), NULL, _exit);
10,287,836✔
440

441
    char category[TSDB_CONFIG_CATEGORY_LEN + VARSTR_HEADER_SIZE] = {0};
10,287,836✔
442
    TAOS_CHECK_GOTO(cfgDumpItemCategory(pItem, &category[VARSTR_HEADER_SIZE], TSDB_CONFIG_CATEGORY_LEN, &valueLen),
10,287,836✔
443
                    NULL, _exit);
444
    varDataSetLen(category, valueLen);
10,287,836✔
445

446
    pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
10,287,836✔
447
    if (pColInfo == NULL) {
10,287,836✔
448
      code = terrno;
×
449
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
450
    }
451
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, category, false), NULL, _exit);
10,287,836✔
452

453
    char info[TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE] = {0};
10,287,836✔
454
    if (strcasecmp(pItem->name, "dataDir") == 0 && pDiskCfg) {
10,287,836✔
455
      char* buf = &info[VARSTR_HEADER_SIZE];
×
456
      valueLen = snprintf(buf, TSDB_CONFIG_INFO_LEN, "level %d primary %d disabled %" PRIi8, pDiskCfg->level,
×
457
                          pDiskCfg->primary, pDiskCfg->disable);
×
458
    } else {
459
      valueLen = 0;
10,287,836✔
460
    }
461
    varDataSetLen(info, valueLen);
10,287,836✔
462

463
    pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
10,287,836✔
464
    if (pColInfo == NULL) {
10,287,836✔
465
      code = terrno;
×
466
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
467
    }
468
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, info, false), NULL, _exit);
10,287,836✔
469

470
    numOfRows++;
10,287,836✔
471
    if (index > 0 && index <= exSize) {
10,287,836✔
472
      goto _start;
×
473
    }
474
  }
475
  pBlock->info.rows = numOfRows;
48,720✔
476
_exit:
48,720✔
477
  if (locked) cfgUnLock(pConf);
48,720✔
478
  cfgDestroyIter(pIter);
48,720✔
479
  TAOS_RETURN(code);
48,720✔
480
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc