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

taosdata / TDengine / #4829

30 Oct 2025 09:25AM UTC coverage: 49.734% (-11.3%) from 61.071%
#4829

push

travis-ci

web-flow
Merge pull request #33435 from taosdata/3.0

merge 3.0

123072 of 323930 branches covered (37.99%)

Branch coverage included in aggregate %.

7 of 25 new or added lines in 3 files covered. (28.0%)

35232 existing lines in 327 files now uncovered.

172062 of 269495 relevant lines covered (63.85%)

70709785.06 hits per line

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

48.14
/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) {
7,614,145✔
24
  pEp->port = 0;
7,614,145✔
25
  memset(pEp->fqdn, 0, TSDB_FQDN_LEN);
7,614,413!
26
  tstrncpy(pEp->fqdn, ep, TSDB_FQDN_LEN);
7,612,274!
27

28
  char* temp = strrchr(pEp->fqdn, ':');
7,614,151!
29
  if (temp) {
7,613,594✔
30
    *temp = 0;
7,336,973✔
31
    pEp->port = taosStr2UInt16(temp + 1, NULL, 10);
7,337,509✔
32
    if (pEp->port < 0) {
33
      return TSDB_CODE_INVALID_PARA;
34
    }
35
  }
36

37
  if (pEp->port == 0) {
7,613,869✔
38
    pEp->port = tsServerPort;
277,167✔
39
  }
40

41
  if (pEp->port <= 0) {
7,613,600!
42
    return TSDB_CODE_INVALID_PARA;
×
43
  }
44
  return 0;
7,613,708✔
45
}
46

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

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

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

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

UNCOV
70
    strncpy(pEp->fqdn, ep + 1, ipLen);
×
UNCOV
71
    pEp->fqdn[ipLen] = '\0';
×
72

UNCOV
73
    if (*(end + 1) == ':' && *(end + 2)) {
×
UNCOV
74
      pEp->port = taosStr2UInt16(end + 2, NULL, 10);
×
75
    }
76
  } else {
77
    // Compatible with ::1:6030, ::1, IPv4:port, hostname:port, etc.
UNCOV
78
    strncpy(buf, ep, TSDB_FQDN_LEN - 1);
×
UNCOV
79
    buf[TSDB_FQDN_LEN - 1] = 0;
×
80

UNCOV
81
    char* lastColon = strrchr(buf, ':');
×
UNCOV
82
    char* firstColon = strchr(buf, ':');
×
83

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

UNCOV
110
  if (pEp->port == 0) {
×
UNCOV
111
    pEp->port = tsServerPort;
×
112
  }
113

UNCOV
114
  if (pEp->port <= 0) {
×
115
    return TSDB_CODE_INVALID_PARA;
×
116
  }
117

UNCOV
118
  return 0;
×
119
}
120
int32_t taosGetFqdnPortFromEp(const char* ep, SEp* pEp) {
7,614,412✔
121
  if (tsEnableIpv6) {
7,614,412!
UNCOV
122
    return taosGetDualIpFromEp(ep, pEp);
×
123
  } else {
124
    return taosGetIpv4FromEp(ep, pEp);
7,614,412✔
125
  }
126
}
127

128
int32_t addEpIntoEpSet(SEpSet* pEpSet, const char* fqdn, uint16_t port) {
9,567,372✔
129
  if (pEpSet == NULL || fqdn == NULL || strlen(fqdn) == 0) {
9,567,372!
130
    return TSDB_CODE_INVALID_PARA;
×
131
  }
132

133
  int32_t index = pEpSet->numOfEps;
9,567,372✔
134
  if (index >= sizeof(pEpSet->eps) / sizeof(pEpSet->eps[0])) {
9,567,372!
135
    return TSDB_CODE_OUT_OF_RANGE;
×
136
  }
137
  tstrncpy(pEpSet->eps[index].fqdn, fqdn, tListLen(pEpSet->eps[index].fqdn));
9,567,372!
138
  pEpSet->eps[index].port = port;
9,567,372✔
139
  pEpSet->numOfEps += 1;
9,567,372✔
140
  return 0;
9,567,372✔
141
}
142

143
bool isEpsetEqual(const SEpSet* s1, const SEpSet* s2) {
2,030,411✔
144
  if (s1->numOfEps != s2->numOfEps || s1->inUse != s2->inUse) {
2,030,411✔
145
    return false;
1,378,125✔
146
  }
147

148
  for (int32_t i = 0; i < s1->numOfEps; i++) {
1,893,394✔
149
    if (s1->eps[i].port != s2->eps[i].port || strncmp(s1->eps[i].fqdn, s2->eps[i].fqdn, TSDB_FQDN_LEN) != 0)
1,241,684!
150
      return false;
576✔
151
  }
152
  return true;
651,710✔
153
}
154

155
void epsetAssign(SEpSet* pDst, const SEpSet* pSrc) {
194,076✔
156
  if (pSrc == NULL || pDst == NULL) {
194,076!
157
    return;
×
158
  }
159

160
  pDst->inUse = pSrc->inUse;
194,076✔
161
  pDst->numOfEps = pSrc->numOfEps;
194,076✔
162
  for (int32_t i = 0; i < pSrc->numOfEps; ++i) {
751,968✔
163
    pDst->eps[i].port = pSrc->eps[i].port;
557,892✔
164
    tstrncpy(pDst->eps[i].fqdn, pSrc->eps[i].fqdn, tListLen(pSrc->eps[i].fqdn));
557,892!
165
  }
166
}
167

168
void epAssign(SEp* pDst, SEp* pSrc) {
3,302,556✔
169
  if (pSrc == NULL || pDst == NULL) {
3,302,556!
170
    return;
4✔
171
  }
172
  memset(pDst->fqdn, 0, tListLen(pSrc->fqdn));
3,302,552!
173
  tstrncpy(pDst->fqdn, pSrc->fqdn, tListLen(pSrc->fqdn));
3,302,552!
174
  pDst->port = pSrc->port;
3,303,227✔
175
}
176

177
void epsetSort(SEpSet* pDst) {
15,275,189✔
178
  if (pDst->numOfEps <= 1) {
15,275,189✔
179
    return;
12,546,943✔
180
  }
181
  int validIdx = false;
2,728,277✔
182
  SEp ep = {0};
2,728,277✔
183
  if (pDst->inUse >= 0 && pDst->inUse < pDst->numOfEps) {
2,728,052!
184
    validIdx = true;
2,727,602✔
185
    epAssign(&ep, &pDst->eps[pDst->inUse]);
2,727,602✔
186
  }
187

188
  for (int i = 0; i < pDst->numOfEps - 1; i++) {
8,044,156✔
189
    for (int j = 0; j < pDst->numOfEps - 1 - i; j++) {
13,244,417✔
190
      SEp* f = &pDst->eps[j];
7,926,741✔
191
      SEp* s = &pDst->eps[j + 1];
7,925,616✔
192
      int  cmp = strncmp(f->fqdn, s->fqdn, sizeof(f->fqdn));
7,926,512!
193
      if (cmp > 0 || (cmp == 0 && f->port > s->port)) {
7,927,634!
194
        SEp ep1 = {0};
192,097✔
195
        epAssign(&ep1, f);
191,650✔
196
        epAssign(f, s);
191,650✔
197
        epAssign(s, &ep1);
191,650✔
198
      }
199
    }
200
  }
201
  if (validIdx == true)
2,728,276!
202
    for (int i = 0; i < pDst->numOfEps; i++) {
5,496,131✔
203
      int cmp = strncmp(ep.fqdn, pDst->eps[i].fqdn, sizeof(ep.fqdn));
5,496,802!
204
      if (cmp == 0 && ep.port == pDst->eps[i].port) {
5,495,906✔
205
        pDst->inUse = i;
2,727,827✔
206
        break;
2,727,828✔
207
      }
208
    }
209
}
210

211
void updateEpSet_s(SCorEpSet* pEpSet, SEpSet* pNewEpSet) {
1,378,701✔
212
  taosCorBeginWrite(&pEpSet->version);
1,378,701!
213
  pEpSet->epSet = *pNewEpSet;
1,378,701✔
214
  taosCorEndWrite(&pEpSet->version);
1,378,701✔
215
}
1,378,701✔
216

217
SEpSet getEpSet_s(SCorEpSet* pEpSet) {
542,889,205✔
218
  SEpSet ep = {0};
542,889,205✔
219
  taosCorBeginRead(&pEpSet->version);
542,889,205!
220
  ep = pEpSet->epSet;
542,924,969✔
221
  taosCorEndRead(&pEpSet->version);
542,927,453!
222

223
  return ep;
542,919,776✔
224
}
225

226
int32_t epsetToStr(const SEpSet* pEpSet, char* pBuf, int32_t cap) {
221,306,726✔
227
  int32_t ret = 0;
221,306,726✔
228
  int32_t nwrite = 0;
221,306,726✔
229

230
  nwrite = snprintf(pBuf + nwrite, cap, "epset:{");
221,306,726!
231
  if (nwrite <= 0 || nwrite >= cap) {
221,316,130✔
232
    return TSDB_CODE_OUT_OF_BUFFER;
3,180✔
233
  }
234
  cap -= nwrite;
221,312,982✔
235

236
  for (int _i = 0; (_i < pEpSet->numOfEps) && (cap > 0); _i++) {
451,967,118✔
237
    if (_i == pEpSet->numOfEps - 1) {
230,662,281✔
238
      ret = snprintf(pBuf + nwrite, cap, "%d. %s:%d", _i, pEpSet->eps[_i].fqdn, pEpSet->eps[_i].port);
221,306,666!
239
    } else {
240
      ret = snprintf(pBuf + nwrite, cap, "%d. %s:%d, ", _i, pEpSet->eps[_i].fqdn, pEpSet->eps[_i].port);
9,354,565!
241
    }
242

243
    if (ret <= 0 || ret >= cap) {
230,654,099✔
244
      return TSDB_CODE_OUT_OF_BUFFER;
2✔
245
    }
246

247
    nwrite += ret;
230,654,136✔
248
    cap -= ret;
230,654,136✔
249
  }
250

251
  if (cap <= 0) {
221,309,657!
252
    return TSDB_CODE_OUT_OF_BUFFER;
×
253
  }
254

255
  ret = snprintf(pBuf + nwrite, cap, "}, inUse:%d", pEpSet->inUse);
221,309,657!
256
  if (ret <= 0 || ret >= cap) {
221,313,568!
257
    return TSDB_CODE_OUT_OF_BUFFER;
3✔
258
  } else {
259
    return TSDB_CODE_SUCCESS;
221,313,627✔
260
  }
261
}
262

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

268
  char tmp[4096] = {0};
×
269

270
  TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "reportVersion", 1), NULL, _exit);
×
271

272
  TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "clusterId", clusterId), NULL, _exit);
×
273
  TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "startTime", startTime), NULL, _exit);
×
274

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

280
  TAOS_CHECK_GOTO(tjsonAddIntegerToObject(pJson, "pid", taosGetPId()), NULL, _exit);
×
281

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

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

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

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

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

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

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

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

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

341
int32_t dumpConfToDataBlock(SSDataBlock* pBlock, int32_t startCol, char* likePattern) {
16,658✔
342
  int32_t  code = 0;
16,658✔
343
  SConfig* pConf = taosGetCfg();
16,658✔
344
  if (pConf == NULL) {
16,658!
345
    return TSDB_CODE_INVALID_CFG;
×
346
  }
347

348
  int32_t      numOfRows = 0;
16,658✔
349
  int32_t      col = startCol;
16,658✔
350
  SConfigItem* pItem = NULL;
16,658✔
351
  SConfigIter* pIter = NULL;
16,658✔
352

353
  int8_t locked = 0;
16,658✔
354

355
  size_t       exSize = 0;
16,658✔
356
  size_t       index = 0;
16,658✔
357
  SConfigItem* pDataDirItem = cfgGetItem(pConf, "dataDir");
16,658✔
358
  if (pDataDirItem) {
16,658✔
359
    exSize = TMAX(taosArrayGetSize(pDataDirItem->array), 1) - 1;
6,423✔
360
  }
361

362
  TAOS_CHECK_GOTO(blockDataEnsureCapacity(pBlock, cfgGetSize(pConf) + exSize), NULL, _exit);
16,658!
363

364
  TAOS_CHECK_GOTO(cfgCreateIter(pConf, &pIter), NULL, _exit);
16,658!
365

366
  cfgLock(pConf);
16,658✔
367
  locked = 1;
16,658✔
368

369
  while ((pItem = cfgNextIter(pIter)) != NULL) {
2,520,268✔
370
  _start:
2,503,610✔
371
    col = startCol;
2,503,610✔
372

373
    // GRANT_CFG_SKIP;
374
    char name[TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE] = {0};
2,503,610✔
375
    if (likePattern && rawStrPatternMatch(pItem->name, likePattern) != TSDB_PATTERN_MATCH) {
2,503,610✔
376
      continue;
167,253✔
377
    }
378
    STR_WITH_MAXSIZE_TO_VARSTR(name, pItem->name, TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE);
2,336,357!
379

380
    SColumnInfoData* pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
2,336,357✔
381
    if (pColInfo == NULL) {
2,336,357!
382
      code = terrno;
×
383
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
384
    }
385

386
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, name, false), NULL, _exit);
2,336,357!
387

388
    char      value[TSDB_CONFIG_PATH_LEN + VARSTR_HEADER_SIZE] = {0};
2,336,357✔
389
    int32_t   valueLen = 0;
2,336,357✔
390
    SDiskCfg* pDiskCfg = NULL;
2,336,357✔
391
    if (strcasecmp(pItem->name, "dataDir") == 0 && exSize > 0) {
2,336,357!
392
      char* buf = &value[VARSTR_HEADER_SIZE];
×
393
      pDiskCfg = taosArrayGet(pItem->array, index);
×
394
      valueLen = tsnprintf(buf, TSDB_CONFIG_PATH_LEN, "%s", pDiskCfg->dir);
×
395
      index++;
×
396
    } else {
397
      TAOS_CHECK_GOTO(cfgDumpItemValue(pItem, &value[VARSTR_HEADER_SIZE], TSDB_CONFIG_PATH_LEN, &valueLen), NULL,
2,336,357!
398
                      _exit);
399
    }
400
    varDataSetLen(value, valueLen);
2,336,357✔
401

402
    pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
2,336,357✔
403
    if (pColInfo == NULL) {
2,336,357!
404
      code = terrno;
×
405
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
406
    }
407

408
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, value, false), NULL, _exit);
2,336,357!
409

410
    char scope[TSDB_CONFIG_SCOPE_LEN + VARSTR_HEADER_SIZE] = {0};
2,336,357✔
411
    TAOS_CHECK_GOTO(cfgDumpItemScope(pItem, &scope[VARSTR_HEADER_SIZE], TSDB_CONFIG_SCOPE_LEN, &valueLen), NULL, _exit);
2,336,357!
412
    varDataSetLen(scope, valueLen);
2,336,357✔
413

414
    pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
2,336,357✔
415
    if (pColInfo == NULL) {
2,336,357!
416
      code = terrno;
×
417
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
418
    }
419
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, scope, false), NULL, _exit);
2,336,357!
420

421
    char category[TSDB_CONFIG_CATEGORY_LEN + VARSTR_HEADER_SIZE] = {0};
2,336,357✔
422
    TAOS_CHECK_GOTO(cfgDumpItemCategory(pItem, &category[VARSTR_HEADER_SIZE], TSDB_CONFIG_CATEGORY_LEN, &valueLen),
2,336,357!
423
                    NULL, _exit);
424
    varDataSetLen(category, valueLen);
2,336,357✔
425

426
    pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
2,336,357✔
427
    if (pColInfo == NULL) {
2,336,357!
428
      code = terrno;
×
429
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
430
    }
431
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, category, false), NULL, _exit);
2,336,357!
432

433
    char info[TSDB_CONFIG_INFO_LEN + VARSTR_HEADER_SIZE] = {0};
2,336,357✔
434
    if (strcasecmp(pItem->name, "dataDir") == 0 && pDiskCfg) {
2,336,357!
435
      char* buf = &info[VARSTR_HEADER_SIZE];
×
436
      valueLen = tsnprintf(buf, TSDB_CONFIG_INFO_LEN, "level %d primary %d disabled %" PRIi8, pDiskCfg->level,
×
437
                           pDiskCfg->primary, pDiskCfg->disable);
×
438
    } else {
439
      valueLen = 0;
2,336,357✔
440
    }
441
    varDataSetLen(info, valueLen);
2,336,357✔
442

443
    pColInfo = taosArrayGet(pBlock->pDataBlock, col++);
2,336,357✔
444
    if (pColInfo == NULL) {
2,336,357!
445
      code = terrno;
×
446
      TAOS_CHECK_GOTO(code, NULL, _exit);
×
447
    }
448
    TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, info, false), NULL, _exit);
2,336,357!
449

450
    numOfRows++;
2,336,357✔
451
    if (index > 0 && index <= exSize) {
2,336,357!
452
      goto _start;
×
453
    }
454
  }
455
  pBlock->info.rows = numOfRows;
16,658✔
456
_exit:
16,658✔
457
  if (locked) cfgUnLock(pConf);
16,658!
458
  cfgDestroyIter(pIter);
16,658✔
459
  TAOS_RETURN(code);
16,658✔
460
}
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