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

taosdata / TDengine / #3523

06 Nov 2024 02:29AM UTC coverage: 55.861% (-2.4%) from 58.216%
#3523

push

travis-ci

web-flow
Merge pull request #28551 from taosdata/feat/TS-5215-2

test(blob): testing & fixes for blob

106075 of 245834 branches covered (43.15%)

Branch coverage included in aggregate %.

0 of 15 new or added lines in 2 files covered. (0.0%)

17003 existing lines in 254 files now uncovered.

181910 of 269703 relevant lines covered (67.45%)

1527639.59 hits per line

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

72.93
/source/dnode/mnode/impl/src/mndShow.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 "mndShow.h"
18
#include "mndPrivilege.h"
19
#include "systable.h"
20
#include "mndUser.h"
21

22
#define SHOW_STEP_SIZE            100
23
#define SHOW_COLS_STEP_SIZE       4096
24
#define SHOW_PRIVILEGES_STEP_SIZE 2048
25

26
static SShowObj *mndCreateShowObj(SMnode *pMnode, SRetrieveTableReq *pReq);
27
static void      mndFreeShowObj(SShowObj *pShow);
28
static SShowObj *mndAcquireShowObj(SMnode *pMnode, int64_t showId);
29
static void      mndReleaseShowObj(SShowObj *pShow, bool forceRemove);
30
static bool      mndCheckRetrieveFinished(SShowObj *pShow);
31
static int32_t   mndProcessRetrieveSysTableReq(SRpcMsg *pReq);
32

33
int32_t mndInitShow(SMnode *pMnode) {
716✔
34
  int32_t    code = 0;
716✔
35
  SShowMgmt *pMgmt = &pMnode->showMgmt;
716✔
36

37
  pMgmt->cache = taosCacheInit(TSDB_DATA_TYPE_INT, 5000, true, (__cache_free_fn_t)mndFreeShowObj, "show");
716✔
38
  if (pMgmt->cache == NULL) {
716!
39
    code = TSDB_CODE_OUT_OF_MEMORY;
×
40
    mError("failed to alloc show cache since %s", tstrerror(code));
×
41
    TAOS_RETURN(code);
×
42
  }
43

44
  mndSetMsgHandle(pMnode, TDMT_MND_SYSTABLE_RETRIEVE, mndProcessRetrieveSysTableReq);
716✔
45
  TAOS_RETURN(code);
716✔
46
}
47

48
void mndCleanupShow(SMnode *pMnode) {
715✔
49
  SShowMgmt *pMgmt = &pMnode->showMgmt;
715✔
50
  if (pMgmt->cache != NULL) {
715!
51
    taosCacheCleanup(pMgmt->cache);
715✔
52
    pMgmt->cache = NULL;
715✔
53
  }
54
}
715✔
55

56
static int32_t convertToRetrieveType(char *name, int32_t len) {
4,842✔
57
  int32_t type = -1;
4,842✔
58

59
  if (strncasecmp(name, TSDB_INS_TABLE_DNODES, len) == 0) {
4,842✔
60
    type = TSDB_MGMT_TABLE_DNODE;
411✔
61
  } else if (strncasecmp(name, TSDB_INS_TABLE_MNODES, len) == 0) {
4,431✔
62
    type = TSDB_MGMT_TABLE_MNODE;
97✔
63
/*
64
  } else if (strncasecmp(name, TSDB_INS_TABLE_MODULES, len) == 0) {
65
    type = TSDB_MGMT_TABLE_MODULE;
66
*/
67
  } else if (strncasecmp(name, TSDB_INS_TABLE_QNODES, len) == 0) {
4,334✔
68
    type = TSDB_MGMT_TABLE_QNODE;
22✔
69
  } else if (strncasecmp(name, TSDB_INS_TABLE_SNODES, len) == 0) {
4,312✔
70
    type = TSDB_MGMT_TABLE_SNODE;
13✔
71
  } else if (strncasecmp(name, TSDB_INS_TABLE_ANODES, len) == 0) {
4,299!
72
    type = TSDB_MGMT_TABLE_ANODE;
×
73
  } else if (strncasecmp(name, TSDB_INS_TABLE_ANODES_FULL, len) == 0) {
4,299!
74
    type = TSDB_MGMT_TABLE_ANODE_FULL;
×
75
  } else if (strncasecmp(name, TSDB_INS_TABLE_ARBGROUPS, len) == 0) {
4,299!
76
    type = TSDB_MGMT_TABLE_ARBGROUP;
×
77
  } else if (strncasecmp(name, TSDB_INS_TABLE_CLUSTER, len) == 0) {
4,299✔
78
    type = TSDB_MGMT_TABLE_CLUSTER;
6✔
79
  } else if (strncasecmp(name, TSDB_INS_TABLE_DATABASES, len) == 0) {
4,293✔
80
    type = TSDB_MGMT_TABLE_DB;
501✔
81
  } else if (strncasecmp(name, TSDB_INS_TABLE_FUNCTIONS, len) == 0) {
3,792✔
82
    type = TSDB_MGMT_TABLE_FUNC;
33✔
83
  } else if (strncasecmp(name, TSDB_INS_TABLE_INDEXES, len) == 0) {
3,759✔
84
    type = TSDB_MGMT_TABLE_INDEX;
1,191✔
85
  } else if (strncasecmp(name, TSDB_INS_TABLE_STABLES, len) == 0) {
2,568✔
86
    type = TSDB_MGMT_TABLE_STB;
260✔
87
  } else if (strncasecmp(name, TSDB_INS_TABLE_TABLES, len) == 0) {
2,308!
88
    type = TSDB_MGMT_TABLE_TABLE;
×
89
  } else if (strncasecmp(name, TSDB_INS_TABLE_TAGS, len) == 0) {
2,308!
90
    type = TSDB_MGMT_TABLE_TAG;
×
91
  } else if (strncasecmp(name, TSDB_INS_TABLE_COLS, len) == 0) {
2,308!
92
    type = TSDB_MGMT_TABLE_COL;
×
93
  } else if (strncasecmp(name, TSDB_INS_TABLE_TABLE_DISTRIBUTED, len) == 0) {
2,308!
94
    //    type = TSDB_MGMT_TABLE_DIST;
95
  } else if (strncasecmp(name, TSDB_INS_TABLE_USERS, len) == 0) {
2,308✔
96
    type = TSDB_MGMT_TABLE_USER;
34✔
97
  } else if (strncasecmp(name, TSDB_INS_TABLE_USERS_FULL, len) == 0) {
2,274!
98
    type = TSDB_MGMT_TABLE_USER_FULL;
×
99
  } else if (strncasecmp(name, TSDB_INS_TABLE_LICENCES, len) == 0) {
2,274✔
100
    type = TSDB_MGMT_TABLE_GRANTS;
6✔
101
  } else if (strncasecmp(name, TSDB_INS_TABLE_VGROUPS, len) == 0) {
2,268✔
102
    type = TSDB_MGMT_TABLE_VGROUP;
238✔
103
  } else if (strncasecmp(name, TSDB_PERFS_TABLE_CONSUMERS, len) == 0) {
2,030✔
104
    type = TSDB_MGMT_TABLE_CONSUMERS;
15✔
105
  } else if (strncasecmp(name, TSDB_INS_TABLE_SUBSCRIPTIONS, len) == 0) {
2,015✔
106
    type = TSDB_MGMT_TABLE_SUBSCRIPTIONS;
19✔
107
  } else if (strncasecmp(name, TSDB_PERFS_TABLE_TRANS, len) == 0) {
1,996✔
108
    type = TSDB_MGMT_TABLE_TRANS;
29✔
109
  } else if (strncasecmp(name, TSDB_PERFS_TABLE_SMAS, len) == 0) {
1,967!
110
    type = TSDB_MGMT_TABLE_SMAS;
×
111
  } else if (strncasecmp(name, TSDB_INS_TABLE_CONFIGS, len) == 0) {
1,967✔
112
    type = TSDB_MGMT_TABLE_CONFIGS;
7✔
113
  } else if (strncasecmp(name, TSDB_PERFS_TABLE_CONNECTIONS, len) == 0) {
1,960✔
114
    type = TSDB_MGMT_TABLE_CONNS;
34✔
115
  } else if (strncasecmp(name, TSDB_PERFS_TABLE_QUERIES, len) == 0) {
1,926✔
116
    type = TSDB_MGMT_TABLE_QUERIES;
14✔
117
  } else if (strncasecmp(name, TSDB_INS_TABLE_VNODES, len) == 0) {
1,912✔
118
    type = TSDB_MGMT_TABLE_VNODES;
17✔
119
  } else if (strncasecmp(name, TSDB_INS_TABLE_TOPICS, len) == 0) {
1,895✔
120
    type = TSDB_MGMT_TABLE_TOPICS;
20✔
121
  } else if (strncasecmp(name, TSDB_INS_TABLE_STREAMS, len) == 0) {
1,875✔
122
    type = TSDB_MGMT_TABLE_STREAMS;
153✔
123
  } else if (strncasecmp(name, TSDB_PERFS_TABLE_APPS, len) == 0) {
1,722✔
124
    type = TSDB_MGMT_TABLE_APPS;
14✔
125
  } else if (strncasecmp(name, TSDB_INS_TABLE_STREAM_TASKS, len) == 0) {
1,708✔
126
    type = TSDB_MGMT_TABLE_STREAM_TASKS;
1,640✔
127
  } else if (strncasecmp(name, TSDB_INS_TABLE_USER_PRIVILEGES, len) == 0) {
68✔
128
    type = TSDB_MGMT_TABLE_PRIVILEGES;
16✔
129
  } else if (strncasecmp(name, TSDB_INS_TABLE_VIEWS, len) == 0) {
52✔
130
    type = TSDB_MGMT_TABLE_VIEWS;
34✔
131
  } else if (strncasecmp(name, TSDB_INS_TABLE_COMPACTS, len) == 0) {
18!
132
    type = TSDB_MGMT_TABLE_COMPACT;
×
133
  } else if (strncasecmp(name, TSDB_INS_TABLE_COMPACT_DETAILS, len) == 0) {
18!
134
    type = TSDB_MGMT_TABLE_COMPACT_DETAIL;
×
135
  } else if (strncasecmp(name, TSDB_INS_TABLE_GRANTS_FULL, len) == 0) {
18✔
136
    type = TSDB_MGMT_TABLE_GRANTS_FULL;
6✔
137
  } else if (strncasecmp(name, TSDB_INS_TABLE_GRANTS_LOGS, len) == 0) {
12✔
138
    type = TSDB_MGMT_TABLE_GRANTS_LOGS;
6✔
139
  } else if (strncasecmp(name, TSDB_INS_TABLE_MACHINES, len) == 0) {
6!
140
    type = TSDB_MGMT_TABLE_MACHINES;
6✔
141
  } else if (strncasecmp(name, TSDB_INS_TABLE_ENCRYPTIONS, len) == 0) {
×
142
    type = TSDB_MGMT_TABLE_ENCRYPTIONS;
×
143
  } else if (strncasecmp(name, TSDB_INS_TABLE_TSMAS, len) == 0) {
×
144
    type = TSDB_MGMT_TABLE_TSMAS;
×
145
  } else {
146
    mError("invalid show name:%s len:%d", name, len);
×
147
  }
148

149
  return type;
4,842✔
150
}
151

152
static SShowObj *mndCreateShowObj(SMnode *pMnode, SRetrieveTableReq *pReq) {
4,842✔
153
  SShowMgmt *pMgmt = &pMnode->showMgmt;
4,842✔
154

155
  int64_t showId = atomic_add_fetch_64(&pMgmt->showId, 1);
4,842✔
156
  if (showId == 0) atomic_add_fetch_64(&pMgmt->showId, 1);
4,842!
157

158
  int32_t size = sizeof(SShowObj);
4,842✔
159

160
  SShowObj showObj = {0};
4,842✔
161

162
  showObj.id = showId;
4,842✔
163
  showObj.pMnode = pMnode;
4,842✔
164
  showObj.type = convertToRetrieveType(pReq->tb, tListLen(pReq->tb));
4,842✔
165
  (void)memcpy(showObj.db, pReq->db, TSDB_DB_FNAME_LEN);
4,842✔
166
  tstrncpy(showObj.filterTb, pReq->filterTb, TSDB_TABLE_NAME_LEN);
4,842✔
167

168
  int32_t   keepTime = tsShellActivityTimer * 6 * 1000;
4,842✔
169
  SShowObj *pShow = taosCachePut(pMgmt->cache, &showId, sizeof(int64_t), &showObj, size, keepTime);
4,842✔
170
  if (pShow == NULL) {
4,842!
171
    terrno = TSDB_CODE_OUT_OF_MEMORY;
×
172
    mError("show:0x%" PRIx64 ", failed to put into cache since %s", showId, terrstr());
×
173
    return NULL;
×
174
  }
175

176
  mTrace("show:0x%" PRIx64 ", is created, data:%p", showId, pShow);
4,842✔
177
  return pShow;
4,842✔
178
}
179

180
static void mndFreeShowObj(SShowObj *pShow) {
4,842✔
181
  SMnode    *pMnode = pShow->pMnode;
4,842✔
182
  SShowMgmt *pMgmt = &pMnode->showMgmt;
4,842✔
183

184
  ShowFreeIterFp freeFp = pMgmt->freeIterFps[pShow->type];
4,842✔
185
  if (freeFp != NULL) {
4,842✔
186
    if (pShow->pIter != NULL) {
4,823✔
187
      mTrace("show:0x%" PRIx64 ", is destroying, data:%p, pIter:%p, ", pShow->id, pShow, pShow->pIter);
3!
188

189
      (*freeFp)(pMnode, pShow->pIter);
3✔
190

191
      pShow->pIter = NULL;
3✔
192
    }
193
  }
194

195
  mTrace("show:0x%" PRIx64 ", is destroyed, data:%p", pShow->id, pShow);
4,842✔
196
}
4,842✔
197

198
static SShowObj *mndAcquireShowObj(SMnode *pMnode, int64_t showId) {
493✔
199
  SShowMgmt *pMgmt = &pMnode->showMgmt;
493✔
200

201
  SShowObj *pShow = taosCacheAcquireByKey(pMgmt->cache, &showId, sizeof(showId));
493✔
202
  if (pShow == NULL) {
493!
203
    mError("show:0x%" PRIx64 ", already destroyed", showId);
×
204
    return NULL;
×
205
  }
206

207
  mTrace("show:0x%" PRIx64 ", acquired from cache, data:%p", pShow->id, pShow);
493!
208
  return pShow;
493✔
209
}
210

211
static void mndReleaseShowObj(SShowObj *pShow, bool forceRemove) {
5,332✔
212
  if (pShow == NULL) return;
5,332!
213
  mTrace("show:0x%" PRIx64 ", released from cache, data:%p force:%d", pShow->id, pShow, forceRemove);
5,332✔
214

215
  // A bug in tcache.c
216
  forceRemove = 0;
5,332✔
217

218
  SMnode    *pMnode = pShow->pMnode;
5,332✔
219
  SShowMgmt *pMgmt = &pMnode->showMgmt;
5,332✔
220
  taosCacheRelease(pMgmt->cache, (void **)(&pShow), forceRemove);
5,332✔
221
}
222

223
static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
5,335✔
224
  int32_t    code = 0;
5,335✔
225
  SMnode    *pMnode = pReq->info.node;
5,335✔
226
  SShowMgmt *pMgmt = &pMnode->showMgmt;
5,335✔
227
  SShowObj  *pShow = NULL;
5,335✔
228
  int32_t    rowsToRead = SHOW_STEP_SIZE;
5,335✔
229
  int32_t    size = 0;
5,335✔
230
  int32_t    rowsRead = 0;
5,335✔
231
  mDebug("mndProcessRetrieveSysTableReq start");
5,335✔
232
  SRetrieveTableReq retrieveReq = {0};
5,335✔
233
  TAOS_CHECK_RETURN(tDeserializeSRetrieveTableReq(pReq->pCont, pReq->contLen, &retrieveReq));
5,335!
234

235
  mDebug("process to retrieve systable req db:%s, tb:%s", retrieveReq.db, retrieveReq.tb);
5,335✔
236

237
  if (retrieveReq.showId == 0) {
5,335✔
238
    STableMetaRsp *pMeta = taosHashGet(pMnode->infosMeta, retrieveReq.tb, strlen(retrieveReq.tb));
4,842✔
239
    if (pMeta == NULL) {
4,842✔
240
      pMeta = taosHashGet(pMnode->perfsMeta, retrieveReq.tb, strlen(retrieveReq.tb));
106✔
241
      if (pMeta == NULL) {
106!
242
        code = TSDB_CODE_PAR_TABLE_NOT_EXIST;
×
243
        mError("failed to process show-retrieve req:%p since %s", pShow, tstrerror(code));
×
244
        TAOS_RETURN(code);
×
245
      }
246
    }
247

248
    pShow = mndCreateShowObj(pMnode, &retrieveReq);
4,842✔
249
    if (pShow == NULL) {
4,842!
250
      code = terrno;
×
251
      mError("failed to process show-meta req since %s", tstrerror(code));
×
252
      TAOS_RETURN(code);
×
253
    }
254

255
    pShow->pMeta = pMeta;
4,842✔
256
    pShow->numOfColumns = pShow->pMeta->numOfColumns;
4,842✔
257
  } else {
258
    pShow = mndAcquireShowObj(pMnode, retrieveReq.showId);
493✔
259
    if (pShow == NULL) {
493!
260
      code = TSDB_CODE_MND_INVALID_SHOWOBJ;
×
261
      mError("failed to process show-retrieve req:%p since %s", pShow, tstrerror(code));
×
262
      TAOS_RETURN(code);
×
263
    }
264
  }
265

266
  if(pShow->type == TSDB_MGMT_TABLE_COL){   // expend capacity for ins_columns
5,335!
267
    rowsToRead = SHOW_COLS_STEP_SIZE;
×
268
  } else if (pShow->type == TSDB_MGMT_TABLE_PRIVILEGES) {
5,335✔
269
    rowsToRead = SHOW_PRIVILEGES_STEP_SIZE;
16✔
270
  }
271
  ShowRetrieveFp retrieveFp = pMgmt->retrieveFps[pShow->type];
5,335✔
272
  if (retrieveFp == NULL) {
5,335!
273
    mndReleaseShowObj(pShow, false);
×
274
    code = TSDB_CODE_MSG_NOT_PROCESSED;
×
275
    mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, tstrerror(code));
×
276
    TAOS_RETURN(code);
×
277
  }
278

279
  mDebug("show:0x%" PRIx64 ", start retrieve data, type:%d", pShow->id, pShow->type);
5,335✔
280
  if (retrieveReq.user[0] != 0) {
5,335!
281
    (void)memcpy(pReq->info.conn.user, retrieveReq.user, TSDB_USER_LEN);
5,335✔
282
  } else {
283
    (void)memcpy(pReq->info.conn.user, TSDB_DEFAULT_USER, strlen(TSDB_DEFAULT_USER) + 1);
×
284
  }
285
  code = -1;
5,335✔
286
  if (retrieveReq.db[0] &&
6,411✔
287
      (code = mndCheckShowPrivilege(pMnode, pReq->info.conn.user, pShow->type, retrieveReq.db)) != 0) {
1,076✔
288
    TAOS_RETURN(code);
3✔
289
  }
290
  if (pShow->type == TSDB_MGMT_TABLE_USER_FULL) {
5,332!
291
    if(strcmp(pReq->info.conn.user, "root") != 0){
×
292
      mError("The operation is not permitted, user:%s, pShow->type:%d", pReq->info.conn.user, pShow->type);
×
293
      code = TSDB_CODE_MND_NO_RIGHTS;
×
294
      TAOS_RETURN(code);
×
295
    }
296
  }
297

298
  int32_t numOfCols = pShow->pMeta->numOfColumns;
5,332✔
299

300
  SSDataBlock *pBlock = NULL;
5,332✔
301
  code = createDataBlock(&pBlock);
5,332✔
302
  if (code) {
5,332!
303
    TAOS_RETURN(code);
×
304
  }
305

306
  for (int32_t i = 0; i < numOfCols; ++i) {
89,587✔
307
    SColumnInfoData idata = {0};
84,255✔
308

309
    SSchema *p = &pShow->pMeta->pSchemas[i];
84,255✔
310

311
    idata.info.bytes = p->bytes;
84,255✔
312
    idata.info.type = p->type;
84,255✔
313
    idata.info.colId = p->colId;
84,255✔
314
    TAOS_CHECK_RETURN(blockDataAppendColInfo(pBlock, &idata));
84,255!
315
  }
316

317
  TAOS_CHECK_RETURN(blockDataEnsureCapacity(pBlock, rowsToRead));
5,332!
318

319
  if (mndCheckRetrieveFinished(pShow)) {
5,332!
320
    mDebug("show:0x%" PRIx64 ", read finished, numOfRows:%d", pShow->id, pShow->numOfRows);
×
321
    rowsRead = 0;
×
322
  } else {
323
    rowsRead = (*retrieveFp)(pReq, pShow, pBlock, rowsToRead);
5,332✔
324
    if (rowsRead < 0) {
5,332!
UNCOV
325
      code = rowsRead;
×
UNCOV
326
      mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id);
×
UNCOV
327
      mndReleaseShowObj(pShow, true);
×
UNCOV
328
      blockDataDestroy(pBlock);
×
UNCOV
329
      TAOS_RETURN(code);
×
330
    }
331

332
    pBlock->info.rows = rowsRead;
5,332✔
333
    mDebug("show:0x%" PRIx64 ", stop retrieve data, rowsRead:%d numOfRows:%d", pShow->id, rowsRead, pShow->numOfRows);
5,332✔
334
  }
335

336
  size_t dataEncodeBufSize = blockGetEncodeSize(pBlock);
5,332✔
337
  size = sizeof(SRetrieveMetaTableRsp) + sizeof(int32_t) + sizeof(SSysTableSchema) * pShow->pMeta->numOfColumns + dataEncodeBufSize;
5,332✔
338

339
  SRetrieveMetaTableRsp *pRsp = rpcMallocCont(size);
5,332✔
340
  if (pRsp == NULL) {
5,332!
341
    mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, tstrerror(code));
×
342
    code = terrno;
×
343
    goto _exit;
×
344
  }
345

346
  pRsp->handle = htobe64(pShow->id);
5,332✔
347

348
  if (rowsRead > 0) {
5,332✔
349
    char    *pStart = pRsp->data;
5,101✔
350
    SSchema *ps = pShow->pMeta->pSchemas;
5,101✔
351

352
    *(int32_t *)pStart = htonl(pShow->pMeta->numOfColumns);
5,101✔
353
    pStart += sizeof(int32_t);  // number of columns
5,101✔
354

355
    for (int32_t i = 0; i < pShow->pMeta->numOfColumns; ++i) {
86,936✔
356
      SSysTableSchema *pSchema = (SSysTableSchema *)pStart;
81,835✔
357
      pSchema->bytes = htonl(ps[i].bytes);
81,835✔
358
      pSchema->colId = htons(ps[i].colId);
81,835✔
359
      pSchema->type = ps[i].type;
81,835✔
360

361
      pStart += sizeof(SSysTableSchema);
81,835✔
362
    }
363

364
    int32_t len = blockEncode(pBlock, pStart, dataEncodeBufSize, pShow->pMeta->numOfColumns);
5,101✔
365
    if(len < 0){
5,101!
366
      mError("show:0x%" PRIx64 ", failed to retrieve data since %s", pShow->id, tstrerror(code));
×
367
      code =  terrno;
×
368
      return code;
×
369
    }
370
  }
371

372
  pRsp->numOfRows = htonl(rowsRead);
5,332✔
373
  pRsp->precision = TSDB_TIME_PRECISION_MILLI;  // millisecond time precision
5,332✔
374
  pReq->info.rsp = pRsp;
5,332✔
375
  pReq->info.rspLen = size;
5,332✔
376

377
  if (rowsRead == 0 || mndCheckRetrieveFinished(pShow)) {
5,332✔
378
    pRsp->completed = 1;
4,836✔
379
    mDebug("show:0x%" PRIx64 ", retrieve completed", pShow->id);
4,836✔
380
    mndReleaseShowObj(pShow, true);
4,836✔
381
  } else {
382
    mDebug("show:0x%" PRIx64 ", retrieve not completed yet", pShow->id);
496✔
383
    mndReleaseShowObj(pShow, false);
496✔
384
  }
385

386
  blockDataDestroy(pBlock);
5,332✔
387
  return TSDB_CODE_SUCCESS;
5,332✔
388
_exit:
×
389
  mndReleaseShowObj(pShow, false);
×
390
  blockDataDestroy(pBlock);
×
391
  if(pRsp) {
×
392
    rpcFreeCont(pRsp);
×
393
  }
394
  return code;
×
395
}
396

397
static bool mndCheckRetrieveFinished(SShowObj *pShow) {
10,433✔
398
  if (pShow->pIter == NULL && pShow->numOfRows != 0) {
10,433✔
399
    return true;
4,605✔
400
  }
401
  return false;
5,828✔
402
}
403

404
void mndAddShowRetrieveHandle(SMnode *pMnode, EShowType showType, ShowRetrieveFp fp) {
26,492✔
405
  SShowMgmt *pMgmt = &pMnode->showMgmt;
26,492✔
406
  pMgmt->retrieveFps[showType] = fp;
26,492✔
407
}
26,492✔
408

409
void mndAddShowFreeIterHandle(SMnode *pMnode, EShowType showType, ShowFreeIterFp fp) {
25,060✔
410
  SShowMgmt *pMgmt = &pMnode->showMgmt;
25,060✔
411
  pMgmt->freeIterFps[showType] = fp;
25,060✔
412
}
25,060✔
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