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

taosdata / TDengine / #4244

04 Jun 2025 05:45AM UTC coverage: 62.872% (-0.1%) from 62.995%
#4244

push

travis-ci

web-flow
add server port and mqttport in configuration file (#31277)

157271 of 319194 branches covered (49.27%)

Branch coverage included in aggregate %.

243262 of 317868 relevant lines covered (76.53%)

6692004.29 hits per line

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

46.66
/source/dnode/vnode/src/vnd/vnodeQuery.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
#include "tsdb.h"
17
#include "tutil.h"
18
#include "vnd.h"
19

20
#define VNODE_GET_LOAD_RESET_VALS(pVar, oVal, vType, tags)                                                    \
21
  do {                                                                                                        \
22
    int##vType##_t newVal = atomic_sub_fetch_##vType(&(pVar), (oVal));                                        \
23
    if (newVal < 0) {                                                                                         \
24
      vWarn("vgId:%d, %s, abnormal val:%" PRIi64 ", old val:%" PRIi64, TD_VID(pVnode), tags, newVal, (oVal)); \
25
    }                                                                                                         \
26
  } while (0)
27

28
int vnodeQueryOpen(SVnode *pVnode) {
13,820✔
29
  return qWorkerInit(NODE_TYPE_VNODE, TD_VID(pVnode), (void **)&pVnode->pQuery, &pVnode->msgCb);
13,820✔
30
}
31

32
void vnodeQueryPreClose(SVnode *pVnode) { qWorkerStopAllTasks((void *)pVnode->pQuery); }
13,831✔
33

34
void vnodeQueryClose(SVnode *pVnode) { qWorkerDestroy((void **)&pVnode->pQuery); }
13,827✔
35

36
int32_t fillTableColCmpr(SMetaReader *reader, SSchemaExt *pExt, int32_t numOfCol) {
65,544✔
37
  int8_t tblType = reader->me.type;
65,544✔
38
  if (withExtSchema(tblType)) {
65,544!
39
    SColCmprWrapper *p = &(reader->me.colCmpr);
65,546✔
40
    if (numOfCol != p->nCols) {
65,546!
41
      vError("fillTableColCmpr table type:%d, col num:%d, col cmpr num:%d mismatch", tblType, numOfCol, p->nCols);
×
42
      return TSDB_CODE_APP_ERROR;
×
43
    }
44
    for (int i = 0; i < p->nCols; i++) {
1,019,039✔
45
      SColCmpr *pCmpr = &p->pColCmpr[i];
953,493✔
46
      pExt[i].colId = pCmpr->id;
953,493✔
47
      pExt[i].compress = pCmpr->alg;
953,493✔
48
    }
49
  }
50
  return 0;
65,546✔
51
}
52

53
void vnodePrintTableMeta(STableMetaRsp *pMeta) {
65,544✔
54
  if (!(qDebugFlag & DEBUG_DEBUG)) {
65,544✔
55
    return;
33,007✔
56
  }
57

58
  qDebug("tbName:%s", pMeta->tbName);
32,537!
59
  qDebug("stbName:%s", pMeta->stbName);
32,537!
60
  qDebug("dbFName:%s", pMeta->dbFName);
32,537!
61
  qDebug("dbId:%" PRId64, pMeta->dbId);
32,537!
62
  qDebug("numOfTags:%d", pMeta->numOfTags);
32,537!
63
  qDebug("numOfColumns:%d", pMeta->numOfColumns);
32,537!
64
  qDebug("precision:%d", pMeta->precision);
32,537!
65
  qDebug("tableType:%d", pMeta->tableType);
32,537!
66
  qDebug("sversion:%d", pMeta->sversion);
32,537!
67
  qDebug("tversion:%d", pMeta->tversion);
32,537!
68
  qDebug("suid:%" PRIu64, pMeta->suid);
32,537!
69
  qDebug("tuid:%" PRIu64, pMeta->tuid);
32,537!
70
  qDebug("vgId:%d", pMeta->vgId);
32,537!
71
  qDebug("sysInfo:%d", pMeta->sysInfo);
32,537!
72
  if (pMeta->pSchemas) {
32,537!
73
    for (int32_t i = 0; i < (pMeta->numOfColumns + pMeta->numOfTags); ++i) {
656,260✔
74
      SSchema *pSchema = pMeta->pSchemas + i;
623,722✔
75
      qDebug("%d col/tag: type:%d, flags:%d, colId:%d, bytes:%d, name:%s", i, pSchema->type, pSchema->flags,
623,722!
76
             pSchema->colId, pSchema->bytes, pSchema->name);
77
    }
78
  }
79
}
80

81
int32_t fillTableColRef(SMetaReader *reader, SColRef *pRef, int32_t numOfCol) {
×
82
  int8_t tblType = reader->me.type;
×
83
  if (hasRefCol(tblType)) {
×
84
    SColRefWrapper *p = &(reader->me.colRef);
×
85
    if (numOfCol != p->nCols) {
×
86
      vError("fillTableColRef table type:%d, col num:%d, col cmpr num:%d mismatch", tblType, numOfCol, p->nCols);
×
87
      return TSDB_CODE_APP_ERROR;
×
88
    }
89
    for (int i = 0; i < p->nCols; i++) {
×
90
      SColRef *pColRef = &p->pColRef[i];
×
91
      pRef[i].hasRef = pColRef->hasRef;
×
92
      pRef[i].id = pColRef->id;
×
93
      if(pRef[i].hasRef) {
×
94
        tstrncpy(pRef[i].refDbName, pColRef->refDbName, TSDB_DB_NAME_LEN);
×
95
        tstrncpy(pRef[i].refTableName, pColRef->refTableName, TSDB_TABLE_NAME_LEN);
×
96
        tstrncpy(pRef[i].refColName, pColRef->refColName, TSDB_COL_NAME_LEN);
×
97
      }
98
    }
99
  }
100
  return 0;
×
101
}
102

103
int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
125,342✔
104
  STableInfoReq  infoReq = {0};
125,342✔
105
  STableMetaRsp  metaRsp = {0};
125,342✔
106
  SMetaReader    mer1 = {0};
125,342✔
107
  SMetaReader    mer2 = {0};
125,342✔
108
  char           tableFName[TSDB_TABLE_FNAME_LEN];
109
  bool           reqTbUid = false;
125,342✔
110
  SRpcMsg        rpcMsg = {0};
125,342✔
111
  int32_t        code = 0;
125,342✔
112
  int32_t        rspLen = 0;
125,342✔
113
  void          *pRsp = NULL;
125,342✔
114
  SSchemaWrapper schema = {0};
125,342✔
115
  SSchemaWrapper schemaTag = {0};
125,342✔
116
  uint8_t        autoCreateCtb = 0;
125,342✔
117

118
  // decode req
119
  if (tDeserializeSTableInfoReq(pMsg->pCont, pMsg->contLen, &infoReq) != 0) {
125,342!
120
    code = terrno;
×
121
    goto _exit4;
×
122
  }
123
  autoCreateCtb = infoReq.autoCreateCtb;
125,345✔
124

125
  if (infoReq.option == REQ_OPT_TBUID) reqTbUid = true;
125,345✔
126
  metaRsp.dbId = pVnode->config.dbId;
125,345✔
127
  tstrncpy(metaRsp.tbName, infoReq.tbName, TSDB_TABLE_NAME_LEN);
125,345✔
128
  (void)memcpy(metaRsp.dbFName, infoReq.dbFName, sizeof(metaRsp.dbFName));
125,345✔
129

130
  if (!reqTbUid) {
125,345✔
131
    (void)tsnprintf(tableFName, TSDB_TABLE_FNAME_LEN, "%s.%s", infoReq.dbFName, infoReq.tbName);
124,812✔
132
    code = vnodeValidateTableHash(pVnode, tableFName);
124,816✔
133
    if (code) {
124,815!
134
      goto _exit4;
×
135
    }
136
  }
137

138
  // query meta
139
  metaReaderDoInit(&mer1, pVnode->pMeta, META_READER_LOCK);
125,348✔
140
  if (reqTbUid) {
125,345✔
141
    SET_ERRNO(0);
530✔
142
    uint64_t tbUid = taosStr2UInt64(infoReq.tbName, NULL, 10);
530✔
143
    if (ERRNO == ERANGE || tbUid == 0) {
530!
144
      code = TSDB_CODE_TDB_TABLE_NOT_EXIST;
×
145
      goto _exit3;
126✔
146
    }
147
    SMetaReader mr3 = {0};
530✔
148
    metaReaderDoInit(&mr3, ((SVnode *)pVnode)->pMeta, META_READER_NOLOCK);
530✔
149
    if ((code = metaReaderGetTableEntryByUid(&mr3, tbUid)) < 0) {
530✔
150
      metaReaderClear(&mr3);
126✔
151
      TAOS_CHECK_GOTO(code, NULL, _exit3);
126!
152
    }
153
    tstrncpy(metaRsp.tbName, mr3.me.name, TSDB_TABLE_NAME_LEN);
403✔
154
    metaReaderClear(&mr3);
403✔
155
    TAOS_CHECK_GOTO(metaGetTableEntryByName(&mer1, metaRsp.tbName), NULL, _exit3);
404!
156
  } else if (metaGetTableEntryByName(&mer1, infoReq.tbName) < 0) {
124,815✔
157
    code = terrno;
59,673✔
158
    goto _exit3;
59,673✔
159
  }
160

161
  metaRsp.tableType = mer1.me.type;
65,541✔
162
  metaRsp.vgId = TD_VID(pVnode);
65,541✔
163
  metaRsp.tuid = mer1.me.uid;
65,541✔
164

165
  switch (mer1.me.type) {
65,541!
166
    case TSDB_SUPER_TABLE: {
15,336✔
167
      (void)strcpy(metaRsp.stbName, mer1.me.name);
15,336✔
168
      schema = mer1.me.stbEntry.schemaRow;
15,336✔
169
      schemaTag = mer1.me.stbEntry.schemaTag;
15,336✔
170
      metaRsp.suid = mer1.me.uid;
15,336✔
171
      break;
15,336✔
172
    }
173
    case TSDB_CHILD_TABLE:
16,196✔
174
    case TSDB_VIRTUAL_CHILD_TABLE:{
175
      metaReaderDoInit(&mer2, pVnode->pMeta, META_READER_NOLOCK);
16,196✔
176
      if (metaReaderGetTableEntryByUid(&mer2, mer1.me.ctbEntry.suid) < 0) goto _exit2;
16,198!
177

178
      (void)strcpy(metaRsp.stbName, mer2.me.name);
16,199✔
179
      metaRsp.suid = mer2.me.uid;
16,199✔
180
      schema = mer2.me.stbEntry.schemaRow;
16,199✔
181
      schemaTag = mer2.me.stbEntry.schemaTag;
16,199✔
182
      break;
16,199✔
183
    }
184
    case TSDB_NORMAL_TABLE:
34,009✔
185
    case TSDB_VIRTUAL_NORMAL_TABLE: {
186
      schema = mer1.me.ntbEntry.schemaRow;
34,009✔
187
      break;
34,009✔
188
    }
189
    default: {
×
190
      vError("vnodeGetTableMeta get invalid table type:%d", mer1.me.type);
×
191
      goto _exit3;
×
192
    }
193
  }
194

195
  metaRsp.numOfTags = schemaTag.nCols;
65,544✔
196
  metaRsp.numOfColumns = schema.nCols;
65,544✔
197
  metaRsp.precision = pVnode->config.tsdbCfg.precision;
65,544✔
198
  metaRsp.sversion = schema.version;
65,544✔
199
  metaRsp.tversion = schemaTag.version;
65,544✔
200
  metaRsp.pSchemas = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * (metaRsp.numOfColumns + metaRsp.numOfTags));
65,544!
201
  metaRsp.pSchemaExt = (SSchemaExt *)taosMemoryCalloc(metaRsp.numOfColumns, sizeof(SSchemaExt));
65,546!
202
  if (NULL == metaRsp.pSchemas || NULL == metaRsp.pSchemaExt) {
65,547!
203
    code = terrno;
×
204
    goto _exit;
×
205
  }
206
  (void)memcpy(metaRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
65,547✔
207
  if (schemaTag.nCols) {
65,547✔
208
    (void)memcpy(metaRsp.pSchemas + schema.nCols, schemaTag.pSchema, sizeof(SSchema) * schemaTag.nCols);
31,537✔
209
  }
210
  if (metaRsp.pSchemaExt) {
65,547!
211
    SMetaReader *pReader = mer1.me.type == TSDB_CHILD_TABLE ? &mer2 : &mer1;
65,547✔
212
    code = fillTableColCmpr(pReader, metaRsp.pSchemaExt, metaRsp.numOfColumns);
65,547✔
213
    if (code < 0) {
65,547!
214
      goto _exit;
×
215
    }
216
    for (int32_t i = 0; i < metaRsp.numOfColumns && pReader->me.pExtSchemas; i++) {
440,561✔
217
      metaRsp.pSchemaExt[i].typeMod = pReader->me.pExtSchemas[i].typeMod;
375,014✔
218
    }
219
  } else {
220
    code = TSDB_CODE_OUT_OF_MEMORY;
×
221
    goto _exit;
×
222
  }
223
  if (hasRefCol(mer1.me.type)) {
65,547✔
224
    metaRsp.rversion = mer1.me.colRef.version;
2✔
225
    metaRsp.pColRefs = (SColRef*)taosMemoryMalloc(sizeof(SColRef) * metaRsp.numOfColumns);
2!
226
    if (metaRsp.pColRefs) {
×
227
      code = fillTableColRef(&mer1, metaRsp.pColRefs, metaRsp.numOfColumns);
×
228
      if (code < 0) {
×
229
        goto _exit;
×
230
      }
231
    }
232
    metaRsp.numOfColRefs = metaRsp.numOfColumns;
×
233
  } else {
234
    metaRsp.pColRefs = NULL;
65,545✔
235
    metaRsp.numOfColRefs = 0;
65,545✔
236
  }
237

238
  vnodePrintTableMeta(&metaRsp);
65,545✔
239

240
  // encode and send response
241
  rspLen = tSerializeSTableMetaRsp(NULL, 0, &metaRsp);
65,544✔
242
  if (rspLen < 0) {
65,543!
243
    code = terrno;
×
244
    goto _exit;
×
245
  }
246

247
  if (direct) {
65,543✔
248
    pRsp = rpcMallocCont(rspLen);
153✔
249
  } else {
250
    pRsp = taosMemoryCalloc(1, rspLen);
65,390!
251
  }
252

253
  if (pRsp == NULL) {
65,546!
254
    code = terrno;
×
255
    goto _exit;
×
256
  }
257

258
  rspLen = tSerializeSTableMetaRsp(pRsp, rspLen, &metaRsp);
65,546✔
259
  if (rspLen < 0) {
65,546!
260
    code = terrno;
×
261
    goto _exit;
×
262
  }
263

264
_exit:
65,546✔
265
  taosMemoryFree(metaRsp.pColRefs);
65,546!
266
  taosMemoryFree(metaRsp.pSchemas);
65,547!
267
  taosMemoryFree(metaRsp.pSchemaExt);
65,547!
268
_exit2:
65,547✔
269
  metaReaderClear(&mer2);
65,547✔
270
_exit3:
125,346✔
271
  metaReaderClear(&mer1);
125,346✔
272
_exit4:
125,343✔
273
  rpcMsg.info = pMsg->info;
125,343✔
274
  rpcMsg.pCont = pRsp;
125,343✔
275
  rpcMsg.contLen = rspLen;
125,343✔
276
  rpcMsg.code = code;
125,343✔
277
  rpcMsg.msgType = pMsg->msgType;
125,343✔
278

279
  if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST && autoCreateCtb == 1) {
125,343✔
280
    code = TSDB_CODE_SUCCESS;
40,974✔
281
  }
282

283
  if (code) {
125,343✔
284
    qError("get table %s meta with %" PRIu8 " failed cause of %s", infoReq.tbName, infoReq.option, tstrerror(code));
18,821!
285
  }
286

287
  if (direct) {
125,345✔
288
    tmsgSendRsp(&rpcMsg);
1,731✔
289
  } else {
290
    *pMsg = rpcMsg;
123,614✔
291
  }
292

293
  return code;
125,344✔
294
}
295

296
int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
90✔
297
  STableCfgReq   cfgReq = {0};
90✔
298
  STableCfgRsp   cfgRsp = {0};
90✔
299
  SMetaReader    mer1 = {0};
90✔
300
  SMetaReader    mer2 = {0};
90✔
301
  char           tableFName[TSDB_TABLE_FNAME_LEN];
302
  SRpcMsg        rpcMsg = {0};
90✔
303
  int32_t        code = 0;
90✔
304
  int32_t        rspLen = 0;
90✔
305
  void          *pRsp = NULL;
90✔
306
  SSchemaWrapper schema = {0};
90✔
307
  SSchemaWrapper schemaTag = {0};
90✔
308

309
  // decode req
310
  if (tDeserializeSTableCfgReq(pMsg->pCont, pMsg->contLen, &cfgReq) != 0) {
90!
311
    code = terrno;
×
312
    goto _exit;
×
313
  }
314

315
  tstrncpy(cfgRsp.tbName, cfgReq.tbName, TSDB_TABLE_NAME_LEN);
90✔
316
  (void)memcpy(cfgRsp.dbFName, cfgReq.dbFName, sizeof(cfgRsp.dbFName));
90✔
317

318
  (void)tsnprintf(tableFName, TSDB_TABLE_FNAME_LEN, "%s.%s", cfgReq.dbFName, cfgReq.tbName);
90✔
319
  code = vnodeValidateTableHash(pVnode, tableFName);
90✔
320
  if (code) {
90!
321
    goto _exit;
×
322
  }
323

324
  // query meta
325
  metaReaderDoInit(&mer1, pVnode->pMeta, META_READER_LOCK);
90✔
326

327
  if (metaGetTableEntryByName(&mer1, cfgReq.tbName) < 0) {
90!
328
    code = terrno;
×
329
    goto _exit;
×
330
  }
331

332
  cfgRsp.tableType = mer1.me.type;
90✔
333

334
  if (mer1.me.type == TSDB_SUPER_TABLE) {
90!
335
    code = TSDB_CODE_VND_HASH_MISMATCH;
×
336
    goto _exit;
×
337
  } else if (mer1.me.type == TSDB_CHILD_TABLE || mer1.me.type == TSDB_VIRTUAL_CHILD_TABLE) {
90!
338
    metaReaderDoInit(&mer2, pVnode->pMeta, META_READER_NOLOCK);
51✔
339
    if (metaReaderGetTableEntryByUid(&mer2, mer1.me.ctbEntry.suid) < 0) goto _exit;
51!
340

341
    tstrncpy(cfgRsp.stbName, mer2.me.name, TSDB_TABLE_NAME_LEN);
51✔
342
    schema = mer2.me.stbEntry.schemaRow;
51✔
343
    schemaTag = mer2.me.stbEntry.schemaTag;
51✔
344
    cfgRsp.ttl = mer1.me.ctbEntry.ttlDays;
51✔
345
    cfgRsp.commentLen = mer1.me.ctbEntry.commentLen;
51✔
346
    if (mer1.me.ctbEntry.commentLen > 0) {
51!
347
      cfgRsp.pComment = taosStrdup(mer1.me.ctbEntry.comment);
×
348
      if (NULL == cfgRsp.pComment) {
×
349
        code = terrno;
×
350
        goto _exit;
×
351
      }
352
    }
353
    STag *pTag = (STag *)mer1.me.ctbEntry.pTags;
51✔
354
    cfgRsp.tagsLen = pTag->len;
51✔
355
    cfgRsp.pTags = taosMemoryMalloc(cfgRsp.tagsLen);
51!
356
    if (NULL == cfgRsp.pTags) {
51!
357
      code = terrno;
×
358
      goto _exit;
×
359
    }
360
    (void)memcpy(cfgRsp.pTags, pTag, cfgRsp.tagsLen);
51✔
361
  } else if (mer1.me.type == TSDB_NORMAL_TABLE || mer1.me.type == TSDB_VIRTUAL_NORMAL_TABLE) {
39!
362
    schema = mer1.me.ntbEntry.schemaRow;
39✔
363
    cfgRsp.ttl = mer1.me.ntbEntry.ttlDays;
39✔
364
    cfgRsp.commentLen = mer1.me.ntbEntry.commentLen;
39✔
365
    if (mer1.me.ntbEntry.commentLen > 0) {
39!
366
      cfgRsp.pComment = taosStrdup(mer1.me.ntbEntry.comment);
×
367
      if (NULL == cfgRsp.pComment) {
×
368
        code = terrno;
×
369
        goto _exit;
×
370
      }
371
    }
372
  } else {
373
    vError("vnodeGetTableCfg get invalid table type:%d", mer1.me.type);
×
374
    code = TSDB_CODE_APP_ERROR;
×
375
    goto _exit;
×
376
  }
377

378
  cfgRsp.numOfTags = schemaTag.nCols;
90✔
379
  cfgRsp.numOfColumns = schema.nCols;
90✔
380
  cfgRsp.virtualStb = false; // vnode don't have super table, so it's always false
90✔
381
  cfgRsp.pSchemas = (SSchema *)taosMemoryMalloc(sizeof(SSchema) * (cfgRsp.numOfColumns + cfgRsp.numOfTags));
90!
382
  cfgRsp.pSchemaExt = (SSchemaExt *)taosMemoryMalloc(cfgRsp.numOfColumns * sizeof(SSchemaExt));
90!
383
  cfgRsp.pColRefs = (SColRef *)taosMemoryMalloc(sizeof(SColRef) * cfgRsp.numOfColumns);
90!
384

385
  if (NULL == cfgRsp.pSchemas || NULL == cfgRsp.pSchemaExt || NULL == cfgRsp.pColRefs) {
90!
386
    code = terrno;
×
387
    goto _exit;
×
388
  }
389
  (void)memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
90✔
390
  if (schemaTag.nCols) {
90✔
391
    (void)memcpy(cfgRsp.pSchemas + schema.nCols, schemaTag.pSchema, sizeof(SSchema) * schemaTag.nCols);
51✔
392
  }
393

394
  SMetaReader     *pReader = (mer1.me.type == TSDB_CHILD_TABLE || mer1.me.type == TSDB_VIRTUAL_CHILD_TABLE) ? &mer2 : &mer1;
90!
395
  SColCmprWrapper *pColCmpr = &pReader->me.colCmpr;
90✔
396
  SColRefWrapper  *pColRef = &mer1.me.colRef;
90✔
397

398
  if (withExtSchema(cfgRsp.tableType)) {
90!
399
    for (int32_t i = 0; i < cfgRsp.numOfColumns; i++) {
451✔
400
      SColCmpr   *pCmpr = &pColCmpr->pColCmpr[i];
361✔
401
      SSchemaExt *pSchExt = cfgRsp.pSchemaExt + i;
361✔
402
      pSchExt->colId = pCmpr->id;
361✔
403
      pSchExt->compress = pCmpr->alg;
361✔
404
      if (pReader->me.pExtSchemas)
361✔
405
        pSchExt->typeMod = pReader->me.pExtSchemas[i].typeMod;
165✔
406
      else
407
        pSchExt->typeMod = 0;
196✔
408
    }
409
  }
410

411
  cfgRsp.virtualStb = false;
90✔
412
  if (hasRefCol(cfgRsp.tableType)) {
90!
413
    for (int32_t i = 0; i < cfgRsp.numOfColumns; i++) {
×
414
      SColRef *pRef = &pColRef->pColRef[i];
×
415
      cfgRsp.pColRefs[i].hasRef = pRef->hasRef;
×
416
      cfgRsp.pColRefs[i].id = pRef->id;
×
417
      if (cfgRsp.pColRefs[i].hasRef) {
×
418
        tstrncpy(cfgRsp.pColRefs[i].refDbName, pRef->refDbName, TSDB_DB_NAME_LEN);
×
419
        tstrncpy(cfgRsp.pColRefs[i].refTableName, pRef->refTableName, TSDB_TABLE_NAME_LEN);
×
420
        tstrncpy(cfgRsp.pColRefs[i].refColName, pRef->refColName, TSDB_COL_NAME_LEN);
×
421
      }
422
    }
423
  }
424

425
  // encode and send response
426
  rspLen = tSerializeSTableCfgRsp(NULL, 0, &cfgRsp);
90✔
427
  if (rspLen < 0) {
90!
428
    code = terrno;
×
429
    goto _exit;
×
430
  }
431

432
  if (direct) {
90!
433
    pRsp = rpcMallocCont(rspLen);
×
434
  } else {
435
    pRsp = taosMemoryCalloc(1, rspLen);
90!
436
  }
437

438
  if (pRsp == NULL) {
90!
439
    code = terrno;
×
440
    goto _exit;
×
441
  }
442

443
  rspLen = tSerializeSTableCfgRsp(pRsp, rspLen, &cfgRsp);
90✔
444
  if (rspLen < 0) {
90!
445
    code = terrno;
×
446
    goto _exit;
×
447
  }
448

449
_exit:
90✔
450
  rpcMsg.info = pMsg->info;
90✔
451
  rpcMsg.pCont = pRsp;
90✔
452
  rpcMsg.contLen = rspLen;
90✔
453
  rpcMsg.code = code;
90✔
454
  rpcMsg.msgType = pMsg->msgType;
90✔
455

456
  if (code) {
90!
457
    qError("get table %s cfg failed cause of %s", cfgReq.tbName, tstrerror(code));
×
458
  }
459

460
  if (direct) {
90!
461
    tmsgSendRsp(&rpcMsg);
×
462
  } else {
463
    *pMsg = rpcMsg;
90✔
464
  }
465

466
  tFreeSTableCfgRsp(&cfgRsp);
90✔
467
  metaReaderClear(&mer2);
90✔
468
  metaReaderClear(&mer1);
90✔
469
  return code;
90✔
470
}
471

472
static FORCE_INLINE void vnodeFreeSBatchRspMsg(void *p) {
473
  if (NULL == p) {
474
    return;
475
  }
476

477
  SBatchRspMsg *pRsp = (SBatchRspMsg *)p;
478
  rpcFreeCont(pRsp->msg);
479
}
480

481
int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
89,880✔
482
  int32_t      code = 0;
89,880✔
483
  int32_t      rspSize = 0;
89,880✔
484
  SBatchReq    batchReq = {0};
89,880✔
485
  SBatchMsg   *req = NULL;
89,880✔
486
  SBatchRspMsg rsp = {0};
89,880✔
487
  SBatchRsp    batchRsp = {0};
89,880✔
488
  SRpcMsg      reqMsg = *pMsg;
89,880✔
489
  SRpcMsg      rspMsg = {0};
89,880✔
490
  void        *pRsp = NULL;
89,880✔
491

492
  if (tDeserializeSBatchReq(pMsg->pCont, pMsg->contLen, &batchReq)) {
89,880!
493
    code = terrno;
×
494
    qError("tDeserializeSBatchReq failed");
×
495
    goto _exit;
×
496
  }
497

498
  int32_t msgNum = taosArrayGetSize(batchReq.pMsgs);
89,884✔
499
  if (msgNum >= MAX_META_MSG_IN_BATCH) {
89,882!
500
    code = TSDB_CODE_INVALID_MSG;
×
501
    qError("too many msgs %d in vnode batch meta req", msgNum);
×
502
    goto _exit;
×
503
  }
504

505
  batchRsp.pRsps = taosArrayInit(msgNum, sizeof(SBatchRspMsg));
89,882✔
506
  if (NULL == batchRsp.pRsps) {
89,884!
507
    code = terrno;
×
508
    qError("taosArrayInit %d SBatchRspMsg failed", msgNum);
×
509
    goto _exit;
×
510
  }
511

512
  for (int32_t i = 0; i < msgNum; ++i) {
216,974✔
513
    req = taosArrayGet(batchReq.pMsgs, i);
127,089✔
514
    if (req == NULL) {
127,089!
515
      code = terrno;
×
516
      goto _exit;
×
517
    }
518

519
    reqMsg.msgType = req->msgType;
127,089✔
520
    reqMsg.pCont = req->msg;
127,089✔
521
    reqMsg.contLen = req->msgLen;
127,089✔
522

523
    switch (req->msgType) {
127,089!
524
      case TDMT_VND_TABLE_META:
123,082✔
525
        // error code has been set into reqMsg, no need to handle it here.
526
        if (TSDB_CODE_SUCCESS != vnodeGetTableMeta(pVnode, &reqMsg, false)) {
123,082✔
527
          qWarn("vnodeGetBatchMeta failed, msgType:%d", req->msgType);
17,121!
528
        }
529
        break;
123,083✔
530
      case TDMT_VND_TABLE_NAME:
529✔
531
        // error code has been set into reqMsg, no need to handle it here.
532
        if (TSDB_CODE_SUCCESS != vnodeGetTableMeta(pVnode, &reqMsg, false)) {
529✔
533
          qWarn("vnodeGetBatchName failed, msgType:%d", req->msgType);
126!
534
        }
535
        break;
528✔
536
      case TDMT_VND_TABLE_CFG:
90✔
537
        // error code has been set into reqMsg, no need to handle it here.
538
        if (TSDB_CODE_SUCCESS != vnodeGetTableCfg(pVnode, &reqMsg, false)) {
90!
539
          qWarn("vnodeGetBatchMeta failed, msgType:%d", req->msgType);
×
540
        }
541
        break;
90✔
542
      case TDMT_VND_GET_STREAM_PROGRESS:
3,388✔
543
        // error code has been set into reqMsg, no need to handle it here.
544
        if (TSDB_CODE_SUCCESS != vnodeGetStreamProgress(pVnode, &reqMsg, false)) {
3,388!
545
          qWarn("vnodeGetBatchMeta failed, msgType:%d", req->msgType);
×
546
        }
547
        break;
3,388✔
548
      case TDMT_VND_VSUBTABLES_META:
×
549
        // error code has been set into reqMsg, no need to handle it here.
550
        if (TSDB_CODE_SUCCESS != vnodeGetVSubtablesMeta(pVnode, &reqMsg)) {
×
551
          qWarn("vnodeGetVSubtablesMeta failed, msgType:%d", req->msgType);
×
552
        }
553
        break;
×
554
      case TDMT_VND_VSTB_REF_DBS:
×
555
        // error code has been set into reqMsg, no need to handle it here.
556
        if (TSDB_CODE_SUCCESS != vnodeGetVStbRefDbs(pVnode, &reqMsg)) {
×
557
          qWarn("vnodeGetVStbRefDbs failed, msgType:%d", req->msgType);
×
558
        }
559
        break;
×
560
      default:
×
561
        qError("invalid req msgType %d", req->msgType);
×
562
        reqMsg.code = TSDB_CODE_INVALID_MSG;
×
563
        reqMsg.pCont = NULL;
×
564
        reqMsg.contLen = 0;
×
565
        break;
×
566
    }
567

568
    rsp.msgIdx = req->msgIdx;
127,089✔
569
    rsp.reqType = reqMsg.msgType;
127,089✔
570
    rsp.msgLen = reqMsg.contLen;
127,089✔
571
    rsp.rspCode = reqMsg.code;
127,089✔
572
    rsp.msg = reqMsg.pCont;
127,089✔
573

574
    if (NULL == taosArrayPush(batchRsp.pRsps, &rsp)) {
254,179!
575
      qError("taosArrayPush failed");
×
576
      code = terrno;
×
577
      goto _exit;
×
578
    }
579
  }
580

581
  rspSize = tSerializeSBatchRsp(NULL, 0, &batchRsp);
89,885✔
582
  if (rspSize < 0) {
89,883!
583
    qError("tSerializeSBatchRsp failed");
×
584
    code = terrno;
×
585
    goto _exit;
×
586
  }
587
  pRsp = rpcMallocCont(rspSize);
89,883✔
588
  if (pRsp == NULL) {
89,882!
589
    qError("rpcMallocCont %d failed", rspSize);
×
590
    code = terrno;
×
591
    goto _exit;
×
592
  }
593
  if (tSerializeSBatchRsp(pRsp, rspSize, &batchRsp) < 0) {
89,882!
594
    qError("tSerializeSBatchRsp %d failed", rspSize);
×
595
    code = terrno;
×
596
    goto _exit;
×
597
  }
598

599
_exit:
89,885✔
600

601
  rspMsg.info = pMsg->info;
89,885✔
602
  rspMsg.pCont = pRsp;
89,885✔
603
  rspMsg.contLen = rspSize;
89,885✔
604
  rspMsg.code = code;
89,885✔
605
  rspMsg.msgType = pMsg->msgType;
89,885✔
606

607
  if (code) {
89,885!
608
    qError("vnd get batch meta failed cause of %s", tstrerror(code));
×
609
  }
610

611
  taosArrayDestroyEx(batchReq.pMsgs, tFreeSBatchReqMsg);
89,885✔
612
  taosArrayDestroyEx(batchRsp.pRsps, tFreeSBatchRspMsg);
89,885✔
613

614
  tmsgSendRsp(&rspMsg);
89,885✔
615

616
  return code;
89,881✔
617
}
618

619
#define VNODE_DO_META_QUERY(pVnode, cmd)                 \
620
  do {                                                   \
621
    (void)taosThreadRwlockRdlock(&(pVnode)->metaRWLock); \
622
    cmd;                                                 \
623
    (void)taosThreadRwlockUnlock(&(pVnode)->metaRWLock); \
624
  } while (0)
625

626
int32_t vnodeReadVSubtables(SReadHandle* pHandle, int64_t suid, SArray** ppRes) {
×
627
  int32_t                    code = TSDB_CODE_SUCCESS;
×
628
  int32_t                    line = 0;
×
629
  SMetaReader                mr = {0};
×
630
  bool                       readerInit = false;
×
631
  SVCTableRefCols*           pTb = NULL;
×
632
  int32_t                    refColsNum = 0;
×
633
  char                       tbFName[TSDB_TABLE_FNAME_LEN];
634
  SSHashObj*                 pSrcTbls = NULL;
×
635

636
  SArray *pList = taosArrayInit(10, sizeof(uint64_t));
×
637
  QUERY_CHECK_NULL(pList, code, line, _return, terrno);
×
638

639
  QUERY_CHECK_CODE(pHandle->api.metaFn.getChildTableList(pHandle->vnode, suid, pList), line, _return);
×
640

641
  size_t num = taosArrayGetSize(pList);
×
642
  *ppRes = taosArrayInit(num, POINTER_BYTES);
×
643
  QUERY_CHECK_NULL(*ppRes, code, line, _return, terrno);
×
644
  pSrcTbls = tSimpleHashInit(10, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY));
×
645
  QUERY_CHECK_NULL(pSrcTbls, code, line, _return, terrno);
×
646

647
  for (int32_t i = 0; i < num; ++i) {
×
648
    uint64_t* id = taosArrayGet(pList, i);
×
649
    QUERY_CHECK_NULL(id, code, line, _return, terrno);
×
650
    pHandle->api.metaReaderFn.initReader(&mr, pHandle->vnode, META_READER_LOCK, &pHandle->api.metaFn);
×
651
    QUERY_CHECK_CODE(pHandle->api.metaReaderFn.getTableEntryByUid(&mr, *id), line, _return);
×
652
    readerInit = true;
×
653

654
    refColsNum = 0;
×
655
    for (int32_t j = 0; j < mr.me.colRef.nCols; j++) {
×
656
      if (mr.me.colRef.pColRef[j].hasRef) {
×
657
        refColsNum++;
×
658
      }
659
    }
660

661
    if (refColsNum <= 0) {
×
662
      pHandle->api.metaReaderFn.clearReader(&mr);
×
663
      readerInit = false;
×
664
      continue;
×
665
    }
666

667
    pTb = taosMemoryCalloc(1, refColsNum * sizeof(SRefColInfo) + sizeof(*pTb));
×
668
    QUERY_CHECK_NULL(pTb, code, line, _return, terrno);
×
669

670
    pTb->uid = mr.me.uid;
×
671
    pTb->numOfColRefs = refColsNum;
×
672
    pTb->refCols = (SRefColInfo*)(pTb + 1);
×
673

674
    refColsNum = 0;
×
675
    tSimpleHashClear(pSrcTbls);
×
676
    for (int32_t j = 0; j < mr.me.colRef.nCols; j++) {
×
677
      if (!mr.me.colRef.pColRef[j].hasRef) {
×
678
        continue;
×
679
      }
680

681
      pTb->refCols[refColsNum].colId = mr.me.colRef.pColRef[j].id;
×
682
      tstrncpy(pTb->refCols[refColsNum].refColName, mr.me.colRef.pColRef[j].refColName, TSDB_COL_NAME_LEN);
×
683
      tstrncpy(pTb->refCols[refColsNum].refTableName, mr.me.colRef.pColRef[j].refTableName, TSDB_TABLE_NAME_LEN);
×
684
      tstrncpy(pTb->refCols[refColsNum].refDbName, mr.me.colRef.pColRef[j].refDbName, TSDB_DB_NAME_LEN);
×
685

686
      snprintf(tbFName, sizeof(tbFName), "%s.%s", pTb->refCols[refColsNum].refDbName, pTb->refCols[refColsNum].refTableName);
×
687

688
      if (NULL == tSimpleHashGet(pSrcTbls, tbFName, strlen(tbFName))) {
×
689
        QUERY_CHECK_CODE(tSimpleHashPut(pSrcTbls, tbFName, strlen(tbFName), &code, sizeof(code)), line, _return);
×
690
      }
691

692
      refColsNum++;
×
693
    }
694

695
    pTb->numOfSrcTbls = tSimpleHashGetSize(pSrcTbls);
×
696
    QUERY_CHECK_NULL(taosArrayPush(*ppRes, &pTb), code, line, _return, terrno);
×
697
    pTb = NULL;
×
698

699
    pHandle->api.metaReaderFn.clearReader(&mr);
×
700
    readerInit = false;
×
701
  }
702

703
_return:
×
704

705
  if (readerInit) {
×
706
    pHandle->api.metaReaderFn.clearReader(&mr);
×
707
  }
708

709
  taosArrayDestroy(pList);
×
710
  taosMemoryFree(pTb);
×
711
  tSimpleHashCleanup(pSrcTbls);
×
712

713
  if (code) {
×
714
    qError("%s failed since %s", __func__, tstrerror(code));
×
715
  }
716
  return code;
×
717
}
718

719
int32_t vnodeReadVStbRefDbs(SReadHandle* pHandle, int64_t suid, SArray** ppRes) {
×
720
  int32_t                    code = TSDB_CODE_SUCCESS;
×
721
  int32_t                    line = 0;
×
722
  SMetaReader                mr = {0};
×
723
  bool                       readerInit = false;
×
724
  SSHashObj*                 pDbNameHash = NULL;
×
725
  SArray*                    pList = NULL;
×
726

727
  pList = taosArrayInit(10, sizeof(uint64_t));
×
728
  QUERY_CHECK_NULL(pList, code, line, _return, terrno);
×
729

730
  *ppRes = taosArrayInit(10, POINTER_BYTES);
×
731
  QUERY_CHECK_NULL(*ppRes, code, line, _return, terrno)
×
732
  
733
  // lookup in cache
734
  code = pHandle->api.metaFn.metaGetCachedRefDbs(pHandle->vnode, suid, *ppRes);
×
735
  QUERY_CHECK_CODE(code, line, _return);
×
736

737
  if (taosArrayGetSize(*ppRes) > 0) {
×
738
    // found in cache
739
    goto _return;
×
740
  } else {
741
    code = pHandle->api.metaFn.getChildTableList(pHandle->vnode, suid, pList);
×
742
    QUERY_CHECK_CODE(code, line, _return);
×
743

744
    size_t num = taosArrayGetSize(pList);
×
745
    pDbNameHash = tSimpleHashInit(10, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY));
×
746
    QUERY_CHECK_NULL(pDbNameHash, code, line, _return, terrno);
×
747

748
    for (int32_t i = 0; i < num; ++i) {
×
749
      uint64_t* id = taosArrayGet(pList, i);
×
750
      QUERY_CHECK_NULL(id, code, line, _return, terrno);
×
751

752
      pHandle->api.metaReaderFn.initReader(&mr, pHandle->vnode, META_READER_LOCK, &pHandle->api.metaFn);
×
753
      readerInit = true;
×
754

755
      code = pHandle->api.metaReaderFn.getTableEntryByUid(&mr, *id);
×
756
      QUERY_CHECK_CODE(code, line, _return);
×
757

758
      for (int32_t j = 0; j < mr.me.colRef.nCols; j++) {
×
759
        if (mr.me.colRef.pColRef[j].hasRef) {
×
760
          if (NULL == tSimpleHashGet(pDbNameHash, mr.me.colRef.pColRef[j].refDbName, strlen(mr.me.colRef.pColRef[j].refDbName))) {
×
761
            char *refDbName = taosStrdup(mr.me.colRef.pColRef[j].refDbName);
×
762
            QUERY_CHECK_NULL(refDbName, code, line, _return, terrno);
×
763

764
            QUERY_CHECK_NULL(taosArrayPush(*ppRes, &refDbName), code, line, _return, terrno);
×
765

766
            code = tSimpleHashPut(pDbNameHash, refDbName, strlen(refDbName), NULL, 0);
×
767
            QUERY_CHECK_CODE(code, line, _return);
×
768
          }
769
        }
770
      }
771

772
      pHandle->api.metaReaderFn.clearReader(&mr);
×
773
      readerInit = false;
×
774
    }
775

776
    code = pHandle->api.metaFn.metaPutRefDbsToCache(pHandle->vnode, suid, *ppRes);
×
777
    QUERY_CHECK_CODE(code, line, _return);
×
778
  }
779

780
_return:
×
781

782
  if (readerInit) {
×
783
    pHandle->api.metaReaderFn.clearReader(&mr);
×
784
  }
785

786
  taosArrayDestroy(pList);
×
787
  tSimpleHashCleanup(pDbNameHash);
×
788

789
  if (code) {
×
790
    qError("%s failed since %s", __func__, tstrerror(code));
×
791
  }
792
  return code;
×
793
}
794

795
int32_t vnodeGetVSubtablesMeta(SVnode *pVnode, SRpcMsg *pMsg) {
×
796
  int32_t        code = 0;
×
797
  int32_t        rspSize = 0;
×
798
  SVSubTablesReq req = {0};
×
799
  SVSubTablesRsp rsp = {0};
×
800
  SRpcMsg      rspMsg = {0};
×
801
  void        *pRsp = NULL;
×
802
  int32_t      line = 0;
×
803

804
  if (tDeserializeSVSubTablesReq(pMsg->pCont, pMsg->contLen, &req)) {
×
805
    code = terrno;
×
806
    qError("tDeserializeSVSubTablesReq failed");
×
807
    goto _return;
×
808
  }
809

810
  SReadHandle handle = {.vnode = pVnode};
×
811
  initStorageAPI(&handle.api);
×
812

813
  QUERY_CHECK_CODE(vnodeReadVSubtables(&handle, req.suid, &rsp.pTables), line, _return);
×
814
  rsp.vgId = TD_VID(pVnode);
×
815

816
  rspSize = tSerializeSVSubTablesRsp(NULL, 0, &rsp);
×
817
  if (rspSize < 0) {
×
818
    code = rspSize;
×
819
    qError("tSerializeSVSubTablesRsp failed, error:%d", rspSize);
×
820
    goto _return;
×
821
  }
822
  pRsp = taosMemoryCalloc(1, rspSize);
×
823
  if (pRsp == NULL) {
×
824
    code = terrno;
×
825
    qError("rpcMallocCont %d failed, error:%d", rspSize, terrno);
×
826
    goto _return;
×
827
  }
828
  rspSize = tSerializeSVSubTablesRsp(pRsp, rspSize, &rsp);
×
829
  if (rspSize < 0) {
×
830
    code = rspSize;
×
831
    qError("tSerializeSVSubTablesRsp failed, error:%d", rspSize);
×
832
    goto _return;
×
833
  }
834

835
_return:
×
836

837
  rspMsg.info = pMsg->info;
×
838
  rspMsg.pCont = pRsp;
×
839
  rspMsg.contLen = rspSize;
×
840
  rspMsg.code = code;
×
841
  rspMsg.msgType = pMsg->msgType;
×
842

843
  if (code) {
×
844
    qError("vnd get virtual subtables failed cause of %s", tstrerror(code));
×
845
  }
846

847
  *pMsg = rspMsg;
×
848
  
849
  tDestroySVSubTablesRsp(&rsp);
×
850

851
  //tmsgSendRsp(&rspMsg);
852

853
  return code;
×
854
}
855

856
int32_t vnodeGetVStbRefDbs(SVnode *pVnode, SRpcMsg *pMsg) {
×
857
  int32_t        code = 0;
×
858
  int32_t        rspSize = 0;
×
859
  SVStbRefDbsReq req = {0};
×
860
  SVStbRefDbsRsp rsp = {0};
×
861
  SRpcMsg        rspMsg = {0};
×
862
  void          *pRsp = NULL;
×
863
  int32_t        line = 0;
×
864

865
  if (tDeserializeSVStbRefDbsReq(pMsg->pCont, pMsg->contLen, &req)) {
×
866
    code = terrno;
×
867
    qError("tDeserializeSVSubTablesReq failed");
×
868
    goto _return;
×
869
  }
870

871
  SReadHandle handle = {.vnode = pVnode};
×
872
  initStorageAPI(&handle.api);
×
873

874
  code = vnodeReadVStbRefDbs(&handle, req.suid, &rsp.pDbs);
×
875
  QUERY_CHECK_CODE(code, line, _return);
×
876
  rsp.vgId = TD_VID(pVnode);
×
877

878
  rspSize = tSerializeSVStbRefDbsRsp(NULL, 0, &rsp);
×
879
  if (rspSize < 0) {
×
880
    code = rspSize;
×
881
    qError("tSerializeSVStbRefDbsRsp failed, error:%d", rspSize);
×
882
    goto _return;
×
883
  }
884
  pRsp = taosMemoryCalloc(1, rspSize);
×
885
  if (pRsp == NULL) {
×
886
    code = terrno;
×
887
    qError("rpcMallocCont %d failed, error:%d", rspSize, terrno);
×
888
    goto _return;
×
889
  }
890
  rspSize = tSerializeSVStbRefDbsRsp(pRsp, rspSize, &rsp);
×
891
  if (rspSize < 0) {
×
892
    code = rspSize;
×
893
    qError("tSerializeSVStbRefDbsRsp failed, error:%d", rspSize);
×
894
    goto _return;
×
895
  }
896

897
_return:
×
898

899
  rspMsg.info = pMsg->info;
×
900
  rspMsg.pCont = pRsp;
×
901
  rspMsg.contLen = rspSize;
×
902
  rspMsg.code = code;
×
903
  rspMsg.msgType = pMsg->msgType;
×
904

905
  if (code) {
×
906
    qError("vnd get virtual stb ref db failed cause of %s", tstrerror(code));
×
907
  }
908

909
  *pMsg = rspMsg;
×
910

911
  tDestroySVStbRefDbsRsp(&rsp);
×
912

913
  return code;
×
914
}
915

916
static void vnodeGetBufferInfo(SVnode *pVnode, int64_t *bufferSegmentUsed, int64_t *bufferSegmentSize) {
251,093✔
917
  *bufferSegmentUsed = 0;
251,093✔
918
  *bufferSegmentSize = 0;
251,093✔
919
  if (pVnode) {
251,093!
920
    taosThreadMutexLock(&pVnode->mutex);
251,093✔
921

922
    if (pVnode->inUse) {
251,093✔
923
      *bufferSegmentUsed = pVnode->inUse->size;
251,089✔
924
    }
925
    *bufferSegmentSize = pVnode->config.szBuf / VNODE_BUFPOOL_SEGMENTS;
251,093✔
926

927
    taosThreadMutexUnlock(&pVnode->mutex);
251,093✔
928
  }
929
}
251,093✔
930

931
int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
251,093✔
932
  SSyncState state = syncGetState(pVnode->sync);
251,093✔
933
  pLoad->syncAppliedIndex = pVnode->state.applied;
251,093✔
934
  syncGetCommitIndex(pVnode->sync, &pLoad->syncCommitIndex);
251,093✔
935

936
  pLoad->vgId = TD_VID(pVnode);
251,093✔
937
  pLoad->syncState = state.state;
251,093✔
938
  pLoad->syncRestore = state.restored;
251,093✔
939
  pLoad->syncTerm = state.term;
251,093✔
940
  pLoad->roleTimeMs = state.roleTimeMs;
251,093✔
941
  pLoad->startTimeMs = state.startTimeMs;
251,093✔
942
  pLoad->syncCanRead = state.canRead;
251,093✔
943
  pLoad->learnerProgress = state.progress;
251,093✔
944
  pLoad->cacheUsage = tsdbCacheGetUsage(pVnode);
251,093✔
945
  pLoad->numOfCachedTables = tsdbCacheGetElems(pVnode);
251,093✔
946
  VNODE_DO_META_QUERY(pVnode, pLoad->numOfTables = metaGetTbNum(pVnode->pMeta));
251,093✔
947
  VNODE_DO_META_QUERY(pVnode, pLoad->numOfTimeSeries = metaGetTimeSeriesNum(pVnode->pMeta, 1));
251,093✔
948
  pLoad->totalStorage = (int64_t)3 * 1073741824;
251,093✔
949
  pLoad->compStorage = (int64_t)2 * 1073741824;
251,093✔
950
  pLoad->pointsWritten = 100;
251,093✔
951
  pLoad->numOfSelectReqs = 1;
251,093✔
952
  pLoad->numOfInsertReqs = atomic_load_64(&pVnode->statis.nInsert);
251,093✔
953
  pLoad->numOfInsertSuccessReqs = atomic_load_64(&pVnode->statis.nInsertSuccess);
251,093✔
954
  pLoad->numOfBatchInsertReqs = atomic_load_64(&pVnode->statis.nBatchInsert);
251,093✔
955
  pLoad->numOfBatchInsertSuccessReqs = atomic_load_64(&pVnode->statis.nBatchInsertSuccess);
251,093✔
956
  vnodeGetBufferInfo(pVnode, &pLoad->bufferSegmentUsed, &pLoad->bufferSegmentSize);
251,093✔
957
  return 0;
251,093✔
958
}
959

960
int32_t vnodeGetLoadLite(SVnode *pVnode, SVnodeLoadLite *pLoad) {
×
961
  SSyncState syncState = syncGetState(pVnode->sync);
×
962
  if (syncState.state == TAOS_SYNC_STATE_LEADER || syncState.state == TAOS_SYNC_STATE_ASSIGNED_LEADER) {
×
963
    pLoad->vgId = TD_VID(pVnode);
×
964
    pLoad->nTimeSeries = metaGetTimeSeriesNum(pVnode->pMeta, 1);
×
965
    return 0;
×
966
  }
967
  return -1;
×
968
}
969
/**
970
 * @brief Reset the statistics value by monitor interval
971
 *
972
 * @param pVnode
973
 * @param pLoad
974
 */
975
void vnodeResetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
36✔
976
  VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nInsert, pLoad->numOfInsertReqs, 64, "nInsert");
36!
977
  VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nInsertSuccess, pLoad->numOfInsertSuccessReqs, 64, "nInsertSuccess");
36!
978
  VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nBatchInsert, pLoad->numOfBatchInsertReqs, 64, "nBatchInsert");
36!
979
  VNODE_GET_LOAD_RESET_VALS(pVnode->statis.nBatchInsertSuccess, pLoad->numOfBatchInsertSuccessReqs, 64,
36!
980
                            "nBatchInsertSuccess");
981
}
36✔
982

983
void vnodeGetInfo(void *pVnode, const char **dbname, int32_t *vgId, int64_t *numOfTables, int64_t *numOfNormalTables) {
26,586✔
984
  SVnode    *pVnodeObj = pVnode;
26,586✔
985
  SVnodeCfg *pConf = &pVnodeObj->config;
26,586✔
986

987
  if (dbname) {
26,586!
988
    *dbname = pConf->dbname;
26,597✔
989
  }
990

991
  if (vgId) {
26,586✔
992
    *vgId = TD_VID(pVnodeObj);
24,969✔
993
  }
994

995
  if (numOfTables) {
26,586!
996
    *numOfTables = pConf->vndStats.numOfNTables + pConf->vndStats.numOfCTables;
×
997
  }
998

999
  if (numOfNormalTables) {
26,586!
1000
    *numOfNormalTables = pConf->vndStats.numOfNTables;
×
1001
  }
1002
}
26,586✔
1003

1004
int32_t vnodeGetTableList(void *pVnode, int8_t type, SArray *pList) {
×
1005
  if (type == TSDB_SUPER_TABLE) {
×
1006
    return vnodeGetStbIdList(pVnode, 0, pList);
×
1007
  } else {
1008
    return TSDB_CODE_INVALID_PARA;
×
1009
  }
1010
}
1011

1012
int32_t vnodeGetAllTableList(SVnode *pVnode, uint64_t uid, SArray *list) {
×
1013
  int32_t      code = TSDB_CODE_SUCCESS;
×
1014
  SMCtbCursor *pCur = metaOpenCtbCursor(pVnode, uid, 1);
×
1015
  if (NULL == pCur) {
×
1016
    qError("vnode get all table list failed");
×
1017
    return terrno;
×
1018
  }
1019

1020
  while (1) {
×
1021
    tb_uid_t id = metaCtbCursorNext(pCur);
×
1022
    if (id == 0) {
×
1023
      break;
×
1024
    }
1025

1026
    STableKeyInfo info = {uid = id};
×
1027
    if (NULL == taosArrayPush(list, &info)) {
×
1028
      qError("taosArrayPush failed");
×
1029
      code = terrno;
×
1030
      goto _exit;
×
1031
    }
1032
  }
1033
_exit:
×
1034
  metaCloseCtbCursor(pCur);
×
1035
  return code;
×
1036
}
1037

1038
int32_t vnodeGetCtbIdListByFilter(SVnode *pVnode, int64_t suid, SArray *list, bool (*filter)(void *arg), void *arg) {
×
1039
  return 0;
×
1040
}
1041

1042
int32_t vnodeGetCtbIdList(void *pVnode, int64_t suid, SArray *list) {
747,237✔
1043
  int32_t      code = TSDB_CODE_SUCCESS;
747,237✔
1044
  SVnode      *pVnodeObj = pVnode;
747,237✔
1045
  SMCtbCursor *pCur = metaOpenCtbCursor(pVnodeObj, suid, 1);
747,237✔
1046
  if (NULL == pCur) {
748,734!
1047
    qError("vnode get all table list failed");
×
1048
    return terrno;
×
1049
  }
1050

1051
  while (1) {
2,724,982✔
1052
    tb_uid_t id = metaCtbCursorNext(pCur);
3,473,716✔
1053
    if (id == 0) {
3,473,643✔
1054
      break;
749,121✔
1055
    }
1056

1057
    if (NULL == taosArrayPush(list, &id)) {
2,724,982!
1058
      qError("taosArrayPush failed");
×
1059
      code = terrno;
×
1060
      goto _exit;
×
1061
    }
1062
  }
1063

1064
_exit:
749,121✔
1065
  metaCloseCtbCursor(pCur);
749,121✔
1066
  return code;
749,420✔
1067
}
1068

1069
int32_t vnodeGetStbIdList(SVnode *pVnode, int64_t suid, SArray *list) {
122,698✔
1070
  int32_t      code = TSDB_CODE_SUCCESS;
122,698✔
1071
  SMStbCursor *pCur = metaOpenStbCursor(pVnode->pMeta, suid);
122,698✔
1072
  if (!pCur) {
122,695!
1073
    return TSDB_CODE_OUT_OF_MEMORY;
×
1074
  }
1075

1076
  while (1) {
98,574✔
1077
    tb_uid_t id = metaStbCursorNext(pCur);
221,269✔
1078
    if (id == 0) {
221,241✔
1079
      break;
122,695✔
1080
    }
1081

1082
    if (NULL == taosArrayPush(list, &id)) {
98,574!
1083
      qError("taosArrayPush failed");
×
1084
      code = terrno;
×
1085
      goto _exit;
×
1086
    }
1087
  }
1088

1089
_exit:
122,695✔
1090
  metaCloseStbCursor(pCur);
122,695✔
1091
  return code;
122,701✔
1092
}
1093

1094
int32_t vnodeGetStbIdListByFilter(SVnode *pVnode, int64_t suid, SArray *list, bool (*filter)(void *arg, void *arg1),
59✔
1095
                                  void *arg) {
1096
  int32_t      code = TSDB_CODE_SUCCESS;
59✔
1097
  SMStbCursor *pCur = metaOpenStbCursor(pVnode->pMeta, suid);
59✔
1098
  if (!pCur) {
59!
1099
    return terrno;
×
1100
  }
1101

1102
  while (1) {
67✔
1103
    tb_uid_t id = metaStbCursorNext(pCur);
126✔
1104
    if (id == 0) {
126✔
1105
      break;
59✔
1106
    }
1107

1108
    if ((*filter) && (*filter)(arg, &id)) {
67!
1109
      continue;
67✔
1110
    }
1111

1112
    if (NULL == taosArrayPush(list, &id)) {
×
1113
      qError("taosArrayPush failed");
×
1114
      code = terrno;
×
1115
      goto _exit;
×
1116
    }
1117
  }
1118

1119
_exit:
59✔
1120
  metaCloseStbCursor(pCur);
59✔
1121
  return code;
59✔
1122
}
1123

1124
int32_t vnodeGetCtbNum(SVnode *pVnode, int64_t suid, int64_t *num) {
20,250✔
1125
  SMCtbCursor *pCur = metaOpenCtbCursor(pVnode, suid, 0);
20,250✔
1126
  if (!pCur) {
20,256!
1127
    return terrno;
×
1128
  }
1129

1130
  *num = 0;
20,257✔
1131
  while (1) {
18,823✔
1132
    tb_uid_t id = metaCtbCursorNext(pCur);
39,080✔
1133
    if (id == 0) {
39,077✔
1134
      break;
20,254✔
1135
    }
1136

1137
    ++(*num);
18,823✔
1138
  }
1139

1140
  metaCloseCtbCursor(pCur);
20,254✔
1141
  return TSDB_CODE_SUCCESS;
20,258✔
1142
}
1143

1144
int32_t vnodeGetStbColumnNum(SVnode *pVnode, tb_uid_t suid, int *num) {
20,255✔
1145
  SSchemaWrapper *pSW = metaGetTableSchema(pVnode->pMeta, suid, -1, 0, NULL);
20,255✔
1146
  if (pSW) {
20,260!
1147
    *num = pSW->nCols;
20,260!
1148
    tDeleteSchemaWrapper(pSW);
1149
  } else {
1150
    *num = 2;
×
1151
  }
1152

1153
  return TSDB_CODE_SUCCESS;
20,260✔
1154
}
1155

1156
int32_t vnodeGetStbInfo(SVnode *pVnode, tb_uid_t suid, int64_t *keep, int8_t *flags) {
20,258✔
1157
  SMetaReader mr = {0};
20,258✔
1158
  metaReaderDoInit(&mr, pVnode->pMeta, META_READER_NOLOCK);
20,258✔
1159

1160
  int32_t code = metaReaderGetTableEntryByUid(&mr, suid);
20,259✔
1161
  if (code == TSDB_CODE_SUCCESS) {
20,259!
1162
    if (keep) *keep = mr.me.stbEntry.keep;
20,259!
1163
    if (flags) *flags = mr.me.flags;
20,259!
1164
  } else {
1165
    if (keep) *keep = 0;
×
1166
    if (flags) *flags = 0;
×
1167
  }
1168

1169
  metaReaderClear(&mr);
20,259✔
1170
  return TSDB_CODE_SUCCESS;
20,259✔
1171
}
1172

1173
#ifdef TD_ENTERPRISE
1174
const char *tkLogStb[] = {"cluster_info",
1175
                          "data_dir",
1176
                          "dnodes_info",
1177
                          "d_info",
1178
                          "grants_info",
1179
                          "keeper_monitor",
1180
                          "logs",
1181
                          "log_dir",
1182
                          "log_summary",
1183
                          "m_info",
1184
                          "taosadapter_restful_http_request_fail",
1185
                          "taosadapter_restful_http_request_in_flight",
1186
                          "taosadapter_restful_http_request_summary_milliseconds",
1187
                          "taosadapter_restful_http_request_total",
1188
                          "taosadapter_system_cpu_percent",
1189
                          "taosadapter_system_mem_percent",
1190
                          "temp_dir",
1191
                          "vgroups_info",
1192
                          "vnodes_role"};
1193
const char *tkAuditStb[] = {"operations"};
1194
const int   tkLogStbNum = ARRAY_SIZE(tkLogStb);
1195
const int   tkAuditStbNum = ARRAY_SIZE(tkAuditStb);
1196

1197
// exclude stbs of taoskeeper log
1198
static int32_t vnodeGetTimeSeriesBlackList(SVnode *pVnode, int32_t *tbSize) {
122,749✔
1199
  int32_t      code = TSDB_CODE_SUCCESS;
122,749✔
1200
  int32_t      tbNum = 0;
122,749✔
1201
  const char **pTbArr = NULL;
122,749✔
1202
  const char  *dbName = NULL;
122,749✔
1203
  *tbSize = 0;
122,749✔
1204

1205
  if (!(dbName = strchr(pVnode->config.dbname, '.'))) return 0;
122,749!
1206
  if (0 == strncmp(++dbName, "log", TSDB_DB_NAME_LEN)) {
122,749✔
1207
    tbNum = tkLogStbNum;
18✔
1208
    pTbArr = (const char **)&tkLogStb;
18✔
1209
  } else if (0 == strncmp(dbName, "audit", TSDB_DB_NAME_LEN)) {
122,731✔
1210
    tbNum = tkAuditStbNum;
57✔
1211
    pTbArr = (const char **)&tkAuditStb;
57✔
1212
  }
1213
  if (tbNum && pTbArr) {
122,749!
1214
    *tbSize = metaSizeOfTbFilterCache(pVnode->pMeta, 0);
75✔
1215
    if (*tbSize < tbNum) {
75✔
1216
      for (int32_t i = 0; i < tbNum; ++i) {
238✔
1217
        tb_uid_t suid = metaGetTableEntryUidByName(pVnode->pMeta, pTbArr[i]);
232✔
1218
        if (suid != 0) {
232✔
1219
          code = metaPutTbToFilterCache(pVnode->pMeta, &suid, 0);
26✔
1220
          if (TSDB_CODE_SUCCESS != code) {
26✔
1221
            return code;
14✔
1222
          }
1223
        }
1224
      }
1225
      *tbSize = metaSizeOfTbFilterCache(pVnode->pMeta, 0);
6✔
1226
    }
1227
  }
1228

1229
  return code;
122,735✔
1230
}
1231
#endif
1232

1233
static bool vnodeTimeSeriesFilter(void *arg1, void *arg2) {
67✔
1234
  SVnode *pVnode = (SVnode *)arg1;
67✔
1235

1236
  if (metaTbInFilterCache(pVnode->pMeta, arg2, 0)) {
67!
1237
    return true;
67✔
1238
  }
1239
  return false;
×
1240
}
1241

1242
int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num) {
122,748✔
1243
  SArray *suidList = NULL;
122,748✔
1244

1245
  if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
122,748!
1246
    return terrno;
×
1247
  }
1248

1249
  int32_t tbFilterSize = 0;
122,750✔
1250
  int32_t code = TSDB_CODE_SUCCESS;
122,750✔
1251
#ifdef TD_ENTERPRISE
1252
  code = vnodeGetTimeSeriesBlackList(pVnode, &tbFilterSize);
122,750✔
1253
  if (TSDB_CODE_SUCCESS != code) {
122,749✔
1254
    goto _exit;
14✔
1255
  }
1256
#endif
1257

1258
  if ((!tbFilterSize && vnodeGetStbIdList(pVnode, 0, suidList) < 0) ||
122,735!
1259
      (tbFilterSize && vnodeGetStbIdListByFilter(pVnode, 0, suidList, vnodeTimeSeriesFilter, pVnode) < 0)) {
122,738!
1260
    qError("vgId:%d, failed to get stb id list error: %s", TD_VID(pVnode), terrstr());
×
1261
    taosArrayDestroy(suidList);
×
1262
    return terrno;
×
1263
  }
1264

1265
  *num = 0;
122,738✔
1266
  int64_t arrSize = taosArrayGetSize(suidList);
122,738✔
1267
  for (int64_t i = 0; i < arrSize; ++i) {
221,359✔
1268
    tb_uid_t suid = *(tb_uid_t *)taosArrayGet(suidList, i);
98,623✔
1269

1270
    int64_t ctbNum = 0;
98,622✔
1271
    int32_t numOfCols = 0;
98,622✔
1272
    int8_t  flags = 0;
98,622✔
1273
    code = metaGetStbStats(pVnode, suid, &ctbNum, &numOfCols, &flags);
98,622✔
1274
    if (TSDB_CODE_SUCCESS != code) {
98,622!
1275
      goto _exit;
×
1276
    }
1277
    if (!TABLE_IS_VIRTUAL(flags)) {
98,622✔
1278
      *num += ctbNum * (numOfCols - 1);
98,612✔
1279
    }
1280
  }
1281

1282
_exit:
122,736✔
1283
  taosArrayDestroy(suidList);
122,750✔
1284
  return TSDB_CODE_SUCCESS;
122,747✔
1285
}
1286

1287
int32_t vnodeGetAllCtbNum(SVnode *pVnode, int64_t *num) {
×
1288
  SMStbCursor *pCur = metaOpenStbCursor(pVnode->pMeta, 0);
×
1289
  if (!pCur) {
×
1290
    return terrno;
×
1291
  }
1292

1293
  *num = 0;
×
1294
  while (1) {
×
1295
    tb_uid_t id = metaStbCursorNext(pCur);
×
1296
    if (id == 0) {
×
1297
      break;
×
1298
    }
1299

1300
    int64_t ctbNum = 0;
×
1301
    int32_t code = vnodeGetCtbNum(pVnode, id, &ctbNum);
×
1302
    if (TSDB_CODE_SUCCESS != code) {
×
1303
      metaCloseStbCursor(pCur);
×
1304
      return code;
×
1305
    }
1306

1307
    *num += ctbNum;
×
1308
  }
1309

1310
  metaCloseStbCursor(pCur);
×
1311
  return TSDB_CODE_SUCCESS;
×
1312
}
1313

1314
void *vnodeGetIdx(void *pVnode) {
8,903✔
1315
  if (pVnode == NULL) {
8,903!
1316
    return NULL;
×
1317
  }
1318

1319
  return metaGetIdx(((SVnode *)pVnode)->pMeta);
8,903✔
1320
}
1321

1322
void *vnodeGetIvtIdx(void *pVnode) {
8,899✔
1323
  if (pVnode == NULL) {
8,899!
1324
    return NULL;
×
1325
  }
1326
  return metaGetIvtIdx(((SVnode *)pVnode)->pMeta);
8,899✔
1327
}
1328

1329
int32_t vnodeGetTableSchema(void *pVnode, int64_t uid, STSchema **pSchema, int64_t *suid) {
197✔
1330
  return tsdbGetTableSchema(((SVnode *)pVnode)->pMeta, uid, pSchema, suid);
197✔
1331
}
1332

1333
static FORCE_INLINE int32_t vnodeGetDBPrimaryInfo(SVnode *pVnode, SDbSizeStatisInfo *pInfo) {
1334
  int32_t code = 0;
36✔
1335
  char    path[TSDB_FILENAME_LEN] = {0};
36✔
1336

1337
  char   *dirName[] = {VNODE_TSDB_DIR, VNODE_WAL_DIR, VNODE_META_DIR, VNODE_TSDB_CACHE_DIR};
36✔
1338
  int64_t dirSize[4];
1339

1340
  vnodeGetPrimaryDir(pVnode->path, pVnode->diskPrimary, pVnode->pTfs, path, TSDB_FILENAME_LEN);
36✔
1341
  int32_t offset = strlen(path);
36✔
1342

1343
  for (int i = 0; i < sizeof(dirName) / sizeof(dirName[0]); i++) {
180✔
1344
    int64_t size = {0};
144✔
1345
    (void)snprintf(path + offset, TSDB_FILENAME_LEN, "%s%s", TD_DIRSEP, dirName[i]);
144✔
1346
    code = taosGetDirSize(path, &size);
144✔
1347
    if (code != 0) {
144!
1348
      return code;
×
1349
    }
1350
    path[offset] = 0;
144✔
1351
    dirSize[i] = size;
144✔
1352
  }
1353

1354
  pInfo->l1Size = 0;
36✔
1355
  pInfo->walSize = dirSize[1];
36✔
1356
  pInfo->metaSize = dirSize[2];
36✔
1357
  pInfo->cacheSize = dirSize[3];
36✔
1358
  return code;
36✔
1359
}
1360
int32_t vnodeGetDBSize(void *pVnode, SDbSizeStatisInfo *pInfo) {
36✔
1361
  int32_t code = 0;
36✔
1362
  int32_t lino = 0;
36✔
1363
  SVnode *pVnodeObj = pVnode;
36✔
1364
  if (pVnodeObj == NULL) {
36!
1365
    return TSDB_CODE_VND_NOT_EXIST;
×
1366
  }
1367
  code = vnodeGetDBPrimaryInfo(pVnode, pInfo);
36✔
1368
  if (code != 0) goto _exit;
36!
1369

1370
  code = tsdbGetFsSize(pVnodeObj->pTsdb, pInfo);
36✔
1371
_exit:
36✔
1372
  return code;
36✔
1373
}
1374

1375
int32_t vnodeGetStreamProgress(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
3,388✔
1376
  int32_t            code = 0;
3,388✔
1377
  SStreamProgressReq req;
1378
  SStreamProgressRsp rsp = {0};
3,388✔
1379
  SRpcMsg            rpcMsg = {.info = pMsg->info, .code = 0};
3,388✔
1380
  char              *buf = NULL;
3,388✔
1381
  int32_t            rspLen = 0;
3,388✔
1382
  code = tDeserializeStreamProgressReq(pMsg->pCont, pMsg->contLen, &req);
3,388✔
1383

1384
  if (code == TSDB_CODE_SUCCESS) {
3,388!
1385
    rsp.fetchIdx = req.fetchIdx;
3,388✔
1386
    rsp.subFetchIdx = req.subFetchIdx;
3,388✔
1387
    rsp.vgId = req.vgId;
3,388✔
1388
    rsp.streamId = req.streamId;
3,388✔
1389
    rspLen = tSerializeStreamProgressRsp(0, 0, &rsp);
3,388✔
1390
    if (rspLen < 0) {
3,388!
1391
      code = terrno;
×
1392
      goto _OVER;
×
1393
    }
1394
    if (direct) {
3,388!
1395
      buf = rpcMallocCont(rspLen);
×
1396
    } else {
1397
      buf = taosMemoryCalloc(1, rspLen);
3,388!
1398
    }
1399
    if (!buf) {
3,388!
1400
      code = terrno;
×
1401
      goto _OVER;
×
1402
    }
1403
  }
1404

1405
  if (code == TSDB_CODE_SUCCESS) {
3,388!
1406
    code = tqGetStreamExecInfo(pVnode, req.streamId, &rsp.progressDelay, &rsp.fillHisFinished);
3,388✔
1407
  }
1408
  if (code == TSDB_CODE_SUCCESS) {
3,388!
1409
    rspLen = tSerializeStreamProgressRsp(buf, rspLen, &rsp);
3,388✔
1410
    if (rspLen < 0) {
3,388!
1411
      code = terrno;
×
1412
      goto _OVER;
×
1413
    }
1414
    rpcMsg.pCont = buf;
3,388✔
1415
    buf = NULL;
3,388✔
1416
    rpcMsg.contLen = rspLen;
3,388✔
1417
    rpcMsg.code = code;
3,388✔
1418
    rpcMsg.msgType = pMsg->msgType;
3,388✔
1419
    if (direct) {
3,388!
1420
      tmsgSendRsp(&rpcMsg);
×
1421
    } else {
1422
      *pMsg = rpcMsg;
3,388✔
1423
    }
1424
  }
1425

1426
_OVER:
×
1427
  if (buf) {
3,388!
1428
    taosMemoryFree(buf);
×
1429
  }
1430
  return code;
3,388✔
1431
}
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