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

taosdata / TDengine / #4988

16 Mar 2026 12:26PM UTC coverage: 75.821% (+1.9%) from 73.883%
#4988

push

travis-ci

web-flow
feat: support secure delete option. (#34591)

274 of 464 new or added lines in 29 files covered. (59.05%)

4404 existing lines in 23 files now uncovered.

337108 of 444611 relevant lines covered (75.82%)

146708292.94 hits per line

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

73.55
/source/libs/qcom/src/querymsg.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 "query.h"
17
#include "queryInt.h"
18
#include "streamMsg.h"
19
#include "systable.h"
20
#include "tmsg.h"
21
#include "trpc.h"
22

23
#pragma GCC diagnostic push
24
#ifdef COMPILER_SUPPORTS_CXX13
25
#pragma GCC diagnostic ignored "-Wformat-truncation"
26
#endif
27

28
int32_t (*queryBuildMsg[TDMT_MAX])(void *input, char **msg, int32_t msgSize, int32_t *msgLen,
29
                                   void *(*mallocFp)(int64_t), void (*freeFp)(void *)) = {0};
30
int32_t (*queryProcessMsgRsp[TDMT_MAX])(void *output, char *msg, int32_t msgSize) = {0};
31

32
int32_t queryBuildUseDbOutput(SUseDbOutput *pOut, SUseDbRsp *usedbRsp) {
221,428,522✔
33
  QUERY_PARAM_CHECK(pOut);
221,428,522✔
34
  QUERY_PARAM_CHECK(usedbRsp);
221,428,522✔
35
  memcpy(pOut->db, usedbRsp->db, TSDB_DB_FNAME_LEN);
221,428,522✔
36
  pOut->dbId = usedbRsp->uid;
221,428,410✔
37

38
  pOut->dbVgroup = taosMemoryCalloc(1, sizeof(SDBVgInfo));
221,429,010✔
39
  if (NULL == pOut->dbVgroup) {
221,536,802✔
40
    return terrno;
×
41
  }
42

43
  pOut->dbVgroup->vgVersion = usedbRsp->vgVersion;
221,536,802✔
44
  pOut->dbVgroup->hashMethod = usedbRsp->hashMethod;
221,536,108✔
45
  pOut->dbVgroup->hashPrefix = usedbRsp->hashPrefix;
221,536,802✔
46
  pOut->dbVgroup->hashSuffix = usedbRsp->hashSuffix;
221,536,108✔
47
  pOut->dbVgroup->stateTs = usedbRsp->stateTs;
221,536,202✔
48
  pOut->dbVgroup->flags = usedbRsp->flags;
221,536,202✔
49

50
  qDebug("db:%s, get %d vgroup, vgVersion:%d, stateTs:%" PRId64, usedbRsp->db, usedbRsp->vgNum, usedbRsp->vgVersion,
221,536,108✔
51
         usedbRsp->stateTs);
52

53
  if (usedbRsp->vgNum <= 0) {
221,465,184✔
54
    return TSDB_CODE_SUCCESS;
171,058,718✔
55
  }
56

57
  pOut->dbVgroup->vgHash =
100,812,932✔
58
      taosHashInit(usedbRsp->vgNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
100,407,390✔
59
  if (NULL == pOut->dbVgroup->vgHash) {
50,406,466✔
60
    return terrno;
×
61
  }
62

63
  for (int32_t i = 0; i < usedbRsp->vgNum; ++i) {
176,517,574✔
64
    SVgroupInfo *pVgInfo = taosArrayGet(usedbRsp->pVgroupInfos, i);
126,111,108✔
65
    pOut->dbVgroup->numOfTable += pVgInfo->numOfTable;
126,111,108✔
66
    qDebug("db:%s, vgId:%d, epNum:%d, current ep:%s:%u", usedbRsp->db, pVgInfo->vgId, pVgInfo->epSet.numOfEps,
126,111,108✔
67
           pVgInfo->epSet.eps[pVgInfo->epSet.inUse].fqdn, pVgInfo->epSet.eps[pVgInfo->epSet.inUse].port);
68
    if (0 != taosHashPut(pOut->dbVgroup->vgHash, &pVgInfo->vgId, sizeof(int32_t), pVgInfo, sizeof(SVgroupInfo))) {
126,111,108✔
69
      return terrno;
×
70
    }
71
  }
72

73
  return TSDB_CODE_SUCCESS;
50,406,466✔
74
}
75

76
int32_t queryBuildTableMetaReqMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen,
96,034,942✔
77
                                  void *(*mallcFp)(int64_t), void (*freeFp)(void *)) {
78
  QUERY_PARAM_CHECK(input);
96,034,942✔
79
  QUERY_PARAM_CHECK(msg);
96,034,942✔
80
  QUERY_PARAM_CHECK(msgLen);
96,034,942✔
81
  SBuildTableInput *pInput = input;
96,034,942✔
82

83
  STableInfoReq infoReq = {0};
96,034,942✔
84
  infoReq.option = pInput->option;
96,035,050✔
85
  infoReq.header.vgId = pInput->vgId;
96,035,050✔
86
  infoReq.autoCreateCtb = pInput->autoCreateCtb;
96,034,840✔
87

88
  if (pInput->dbFName) {
96,035,028✔
89
    tstrncpy(infoReq.dbFName, pInput->dbFName, TSDB_DB_FNAME_LEN);
96,035,024✔
90
  }
91
  tstrncpy(infoReq.tbName, pInput->tbName, TSDB_TABLE_NAME_LEN);
96,034,944✔
92

93
  int32_t bufLen = tSerializeSTableInfoReq(NULL, 0, &infoReq);
96,035,050✔
94
  void   *pBuf = (*mallcFp)(bufLen);
96,033,986✔
95
  if (NULL == pBuf) {
96,034,934✔
96
    return terrno;
×
97
  }
98
  int32_t ret = tSerializeSTableInfoReq(pBuf, bufLen, &infoReq);
96,034,934✔
99
  if (ret < 0) {
96,034,798✔
100
    if (freeFp) (*freeFp)(pBuf);
×
101
    return ret;
×
102
  }
103

104
  *msg = pBuf;
96,034,798✔
105
  *msgLen = bufLen;
96,034,798✔
106

107
  return TSDB_CODE_SUCCESS;
96,033,160✔
108
}
109

110
int32_t queryBuildUseDbMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
46,853,334✔
111
                           void (*freeFp)(void *)) {
112
  QUERY_PARAM_CHECK(input);
46,853,334✔
113
  QUERY_PARAM_CHECK(msg);
46,853,334✔
114
  QUERY_PARAM_CHECK(msgLen);
46,853,334✔
115
  SBuildUseDBInput *pInput = input;
46,853,334✔
116

117
  SUseDbReq usedbReq = {0};
46,853,334✔
118
  tstrncpy(usedbReq.db, pInput->db, TSDB_DB_FNAME_LEN);
46,853,334✔
119
  usedbReq.db[sizeof(usedbReq.db) - 1] = 0;
46,853,334✔
120
  usedbReq.vgVersion = pInput->vgVersion;
46,853,334✔
121
  usedbReq.dbId = pInput->dbId;
46,853,334✔
122
  usedbReq.numOfTable = pInput->numOfTable;
46,853,334✔
123
  usedbReq.stateTs = pInput->stateTs;
46,853,334✔
124

125
  int32_t bufLen = tSerializeSUseDbReq(NULL, 0, &usedbReq);
46,853,334✔
126
  void   *pBuf = (*mallcFp)(bufLen);
46,853,258✔
127
  if (NULL == pBuf) {
46,853,258✔
128
    return terrno;
×
129
  }
130
  int32_t ret = tSerializeSUseDbReq(pBuf, bufLen, &usedbReq);
46,853,258✔
131
  if (ret < 0) {
46,853,334✔
132
    if (freeFp) (*freeFp)(pBuf);
×
133
    return ret;
×
134
  }
135

136
  *msg = pBuf;
46,853,334✔
137
  *msgLen = bufLen;
46,853,334✔
138

139
  return TSDB_CODE_SUCCESS;
46,853,334✔
140
}
141

142
int32_t queryBuildQnodeListMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t), 
103,278✔
143
                               void (*freeFp)(void *)) {
144
  QUERY_PARAM_CHECK(msg);
103,278✔
145
  QUERY_PARAM_CHECK(msgLen);
103,278✔
146

147
  SQnodeListReq qnodeListReq = {0};
103,278✔
148
  qnodeListReq.rowNum = -1;
103,278✔
149

150
  int32_t bufLen = tSerializeSQnodeListReq(NULL, 0, &qnodeListReq);
103,278✔
151
  void   *pBuf = (*mallcFp)(bufLen);
103,278✔
152
  if (NULL == pBuf) {
103,278✔
153
    return terrno;
×
154
  }
155

156
  int32_t ret = tSerializeSQnodeListReq(pBuf, bufLen, &qnodeListReq);
103,278✔
157
  if (ret < 0) {
103,278✔
158
    if (freeFp) (*freeFp)(pBuf);
×
159
    return ret;
×
160
  }
161

162
  *msg = pBuf;
103,278✔
163
  *msgLen = bufLen;
103,278✔
164

165
  return TSDB_CODE_SUCCESS;
103,278✔
166
}
167

168
int32_t queryBuildDnodeListMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
80,086✔
169
                               void (*freeFp)(void *)) {
170
  QUERY_PARAM_CHECK(msg);
80,086✔
171
  QUERY_PARAM_CHECK(msgLen);
80,086✔
172

173
  SDnodeListReq dnodeListReq = {0};
80,086✔
174
  dnodeListReq.rowNum = -1;
80,086✔
175

176
  int32_t bufLen = tSerializeSDnodeListReq(NULL, 0, &dnodeListReq);
80,086✔
177
  void   *pBuf = (*mallcFp)(bufLen);
80,086✔
178
  if (NULL == pBuf) {
80,086✔
179
    return terrno;
×
180
  }
181
  int32_t ret = tSerializeSDnodeListReq(pBuf, bufLen, &dnodeListReq);
80,086✔
182
  if (ret < 0) {
80,086✔
183
    if (freeFp) (*freeFp)(pBuf);
×
184
    return ret;
×
185
  }
186

187
  *msg = pBuf;
80,086✔
188
  *msgLen = bufLen;
80,086✔
189

190
  return TSDB_CODE_SUCCESS;
80,086✔
191
}
192

193
int32_t queryBuildGetSerVerMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
204✔
194
                               void (*freeFp)(void *)) {
195
  QUERY_PARAM_CHECK(msg);
204✔
196
  QUERY_PARAM_CHECK(msgLen);
204✔
197

198
  SServerVerReq req = {0};
204✔
199

200
  int32_t bufLen = tSerializeSServerVerReq(NULL, 0, &req);
204✔
201
  void   *pBuf = (*mallcFp)(bufLen);
204✔
202
  if (NULL == pBuf) {
204✔
203
    return terrno;
×
204
  }
205
  int32_t ret = tSerializeSServerVerReq(pBuf, bufLen, &req);
204✔
206
  if (ret < 0) {
204✔
207
    if (freeFp) (*freeFp)(pBuf);
×
208
    return ret;
×
209
  }
210

211
  *msg = pBuf;
204✔
212
  *msgLen = bufLen;
204✔
213

214
  return TSDB_CODE_SUCCESS;
204✔
215
}
216

217
int32_t queryBuildGetDBCfgMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t), 
10,032,128✔
218
                              void (*freeFp)(void *)) {
219
  QUERY_PARAM_CHECK(input);
10,032,128✔
220
  QUERY_PARAM_CHECK(msg);
10,032,128✔
221
  QUERY_PARAM_CHECK(msgLen);
10,032,128✔
222

223
  SDbCfgReq dbCfgReq = {0};
10,032,128✔
224
  tstrncpy(dbCfgReq.db, input, TSDB_DB_FNAME_LEN);
10,032,128✔
225

226
  int32_t bufLen = tSerializeSDbCfgReq(NULL, 0, &dbCfgReq);
10,032,128✔
227
  void   *pBuf = (*mallcFp)(bufLen);
10,032,128✔
228
  if (NULL == pBuf) {
10,032,128✔
229
    return terrno;
×
230
  }
231
  int32_t ret = tSerializeSDbCfgReq(pBuf, bufLen, &dbCfgReq);
10,032,128✔
232
  if (ret < 0) {
10,032,128✔
233
    if (freeFp) (*freeFp)(pBuf);
×
234
    return ret;
×
235
  }
236

237
  *msg = pBuf;
10,032,128✔
238
  *msgLen = bufLen;
10,032,128✔
239

240
  return TSDB_CODE_SUCCESS;
10,032,128✔
241
}
242

243
int32_t queryBuildGetIndexMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t), 
204✔
244
                              void (*freeFp)(void *)) {
245
  QUERY_PARAM_CHECK(input);
204✔
246
  QUERY_PARAM_CHECK(msg);
204✔
247
  QUERY_PARAM_CHECK(msgLen);
204✔
248

249
  SUserIndexReq indexReq = {0};
204✔
250
  tstrncpy(indexReq.indexFName, input, TSDB_INDEX_FNAME_LEN);
204✔
251

252
  int32_t bufLen = tSerializeSUserIndexReq(NULL, 0, &indexReq);
204✔
253
  void   *pBuf = (*mallcFp)(bufLen);
204✔
254
  if (NULL == pBuf) {
204✔
255
    return terrno;
×
256
  }
257
  int32_t ret = tSerializeSUserIndexReq(pBuf, bufLen, &indexReq);
204✔
258
  if (ret < 0) {
204✔
259
    if (freeFp) (*freeFp)(pBuf);
×
260
    return ret;
×
261
  }
262

263
  *msg = pBuf;
204✔
264
  *msgLen = bufLen;
204✔
265

266
  return TSDB_CODE_SUCCESS;
204✔
267
}
268

269
int32_t queryBuildRetrieveFuncMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen,
295,532✔
270
                                  void *(*mallcFp)(int64_t), void (*freeFp)(void *)) {
271
  QUERY_PARAM_CHECK(input);
295,532✔
272
  QUERY_PARAM_CHECK(msg);
295,532✔
273
  QUERY_PARAM_CHECK(msgLen);
295,532✔
274

275
  SRetrieveFuncReq funcReq = {0};
295,532✔
276
  funcReq.numOfFuncs = 1;
295,532✔
277
  funcReq.ignoreCodeComment = true;
295,532✔
278
  funcReq.pFuncNames = taosArrayInit(1, strlen(input) + 1);
295,532✔
279
  if (NULL == funcReq.pFuncNames) {
295,532✔
280
    return terrno;
×
281
  }
282
  if (taosArrayPush(funcReq.pFuncNames, input) == NULL) {
591,064✔
283
    taosArrayDestroy(funcReq.pFuncNames);
×
284
    return terrno;
×
285
  }
286

287
  int32_t bufLen = tSerializeSRetrieveFuncReq(NULL, 0, &funcReq);
295,532✔
288
  void   *pBuf = (*mallcFp)(bufLen);
295,532✔
289
  if (NULL == pBuf) {
295,532✔
290
    taosArrayDestroy(funcReq.pFuncNames);
×
291
    return terrno;
×
292
  }
293
  int32_t ret = tSerializeSRetrieveFuncReq(pBuf, bufLen, &funcReq);
295,532✔
294
  if (ret < 0) {
295,532✔
295
    taosArrayDestroy(funcReq.pFuncNames);
×
296
    if (freeFp) (*freeFp)(pBuf);
×
297
    return ret;
×
298
  }
299

300
  taosArrayDestroy(funcReq.pFuncNames);
295,532✔
301

302
  *msg = pBuf;
295,532✔
303
  *msgLen = bufLen;
295,532✔
304

305
  return TSDB_CODE_SUCCESS;
295,532✔
306
}
307

308
int32_t queryBuildGetUserAuthMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
12,276,630✔
309
                                 void (*freeFp)(void *)) {
310
  QUERY_PARAM_CHECK(input);
12,276,630✔
311
  QUERY_PARAM_CHECK(msg);
12,276,630✔
312
  QUERY_PARAM_CHECK(msgLen);
12,276,630✔
313

314
  SGetUserAuthReq req = {0};
12,276,630✔
315
  tstrncpy(req.user, input, TSDB_USER_LEN);
12,276,712✔
316

317
  int32_t bufLen = tSerializeSGetUserAuthReq(NULL, 0, &req);
12,276,712✔
318
  void   *pBuf = (*mallcFp)(bufLen);
12,276,712✔
319
  if (NULL == pBuf) {
12,276,712✔
320
    return terrno;
×
321
  }
322
  int32_t ret = tSerializeSGetUserAuthReq(pBuf, bufLen, &req);
12,276,712✔
323
  if (ret < 0) {
12,276,712✔
324
    if (freeFp) (*freeFp)(pBuf);
×
325
    return ret;
×
326
  }
327

328
  *msg = pBuf;
12,276,712✔
329
  *msgLen = bufLen;
12,276,712✔
330

331
  return TSDB_CODE_SUCCESS;
12,276,712✔
332
}
333

334
int32_t queryBuildGetTbIndexMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
204✔
335
                                void (*freeFp)(void *)) {
336
  QUERY_PARAM_CHECK(input);
204✔
337
  QUERY_PARAM_CHECK(msg);
204✔
338
  QUERY_PARAM_CHECK(msgLen);
204✔
339

340
  STableIndexReq indexReq = {0};
204✔
341
  tstrncpy(indexReq.tbFName, input, TSDB_TABLE_FNAME_LEN);
204✔
342

343
  int32_t bufLen = tSerializeSTableIndexReq(NULL, 0, &indexReq);
204✔
344
  void   *pBuf = (*mallcFp)(bufLen);
204✔
345
  if (NULL == pBuf) {
204✔
346
    return terrno;
×
347
  }
348
  int32_t ret = tSerializeSTableIndexReq(pBuf, bufLen, &indexReq);
204✔
349
  if (ret < 0) {
204✔
350
    if (freeFp) (*freeFp)(pBuf);
×
351
    return ret;
×
352
  }
353

354
  *msg = pBuf;
204✔
355
  *msgLen = bufLen;
204✔
356

357
  return TSDB_CODE_SUCCESS;
204✔
358
}
359

360
int32_t queryBuildGetTbCfgMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
190,648✔
361
                              void (*freeFp)(void *)) {
362
  QUERY_PARAM_CHECK(input);
190,648✔
363
  QUERY_PARAM_CHECK(msg);
190,648✔
364
  QUERY_PARAM_CHECK(msgLen);
190,648✔
365

366
  SBuildTableInput *pInput = input;
190,648✔
367
  STableCfgReq      cfgReq = {0};
190,648✔
368
  cfgReq.header.vgId = pInput->vgId;
190,648✔
369
  tstrncpy(cfgReq.dbFName, pInput->dbFName, TSDB_DB_FNAME_LEN);
190,648✔
370
  tstrncpy(cfgReq.tbName, pInput->tbName, TSDB_TABLE_NAME_LEN);
190,648✔
371

372
  int32_t bufLen = tSerializeSTableCfgReq(NULL, 0, &cfgReq);
190,648✔
373
  void   *pBuf = (*mallcFp)(bufLen);
190,648✔
374
  if (NULL == pBuf) {
190,648✔
375
    return terrno;
×
376
  }
377
  int32_t ret = tSerializeSTableCfgReq(pBuf, bufLen, &cfgReq);
190,648✔
378
  if (ret < 0) {
190,648✔
379
    if (freeFp) (*freeFp)(pBuf);
×
380
    return ret;
×
381
  }
382

383
  *msg = pBuf;
190,648✔
384
  *msgLen = bufLen;
190,648✔
385

386
  return TSDB_CODE_SUCCESS;
190,648✔
387
}
388

389
int32_t queryBuildGetViewMetaMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
37,491,286✔
390
                                 void (*freeFp)(void *)) {
391
  QUERY_PARAM_CHECK(input);
37,491,286✔
392
  QUERY_PARAM_CHECK(msg);
37,491,286✔
393
  QUERY_PARAM_CHECK(msgLen);
37,491,286✔
394

395
  SViewMetaReq req = {0};
37,491,286✔
396
  tstrncpy(req.fullname, input, TSDB_VIEW_FNAME_LEN);
37,491,264✔
397

398
  int32_t bufLen = tSerializeSViewMetaReq(NULL, 0, &req);
37,491,264✔
399
  void   *pBuf = (*mallcFp)(bufLen);
37,491,186✔
400
  if (NULL == pBuf) {
37,491,286✔
401
    return terrno;
×
402
  }
403
  int32_t ret = tSerializeSViewMetaReq(pBuf, bufLen, &req);
37,491,286✔
404
  if (ret < 0) {
37,491,286✔
405
    if (freeFp) (*freeFp)(pBuf);
×
406
    return ret;
×
407
  }
408

409
  *msg = pBuf;
37,491,286✔
410
  *msgLen = bufLen;
37,491,286✔
411

412
  return TSDB_CODE_SUCCESS;
37,491,286✔
413
}
414

415
int32_t queryBuildGetTableTSMAMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
18,172✔
416
                                  void (*freeFp)(void *)) {
417
  QUERY_PARAM_CHECK(input);
18,172✔
418
  QUERY_PARAM_CHECK(msg);
18,172✔
419
  QUERY_PARAM_CHECK(msgLen);
18,172✔
420

421
  STableTSMAInfoReq req = {0};
18,172✔
422
  tstrncpy(req.name, input, TSDB_TABLE_FNAME_LEN);
18,172✔
423

424
  int32_t bufLen = tSerializeTableTSMAInfoReq(NULL, 0, &req);
18,172✔
425
  void *  pBuf = (*mallcFp)(bufLen);
18,172✔
426
  if (NULL == pBuf) {
18,172✔
427
    return terrno;
×
428
  }
429
  int32_t ret = tSerializeTableTSMAInfoReq(pBuf, bufLen, &req);
18,172✔
430
  if (ret < 0) {
18,172✔
431
    if (freeFp) (*freeFp)(pBuf);
×
432
    return ret;
×
433
  }
434

435
  *msg = pBuf;
18,172✔
436
  *msgLen = bufLen;
18,172✔
437
  return TSDB_CODE_SUCCESS;
18,172✔
438
}
439

440
int32_t queryBuildGetTSMAMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
2,710✔
441
                             void (*freeFp)(void *)) {
442
  QUERY_PARAM_CHECK(input);
2,710✔
443
  QUERY_PARAM_CHECK(msg);
2,710✔
444
  QUERY_PARAM_CHECK(msgLen);
2,710✔
445

446
  STableTSMAInfoReq req = {0};
2,710✔
447
  req.fetchingWithTsmaName = true;
2,710✔
448
  tstrncpy(req.name, input, TSDB_TABLE_FNAME_LEN);
2,710✔
449

450
  int32_t bufLen = tSerializeTableTSMAInfoReq(NULL, 0, &req);
2,710✔
451
  void   *pBuf = (*mallcFp)(bufLen);
2,710✔
452
  if (pBuf == NULL) {
2,710✔
453
    return terrno;
×
454
  }
455
  int32_t ret = tSerializeTableTSMAInfoReq(pBuf, bufLen, &req);
2,710✔
456
  if (ret < 0) {
2,710✔
457
    if (freeFp) (*freeFp)(pBuf);
×
458
    return ret;
×
459
  }
460

461
  *msg = pBuf;
2,710✔
462
  *msgLen = bufLen;
2,710✔
463
  return TSDB_CODE_SUCCESS;
2,710✔
464
}
465

466
static int32_t queryBuildGetRsmaMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen,
47,466✔
467
                                    void *(*mallcFp)(int64_t), void (*freeFp)(void *)) {
468
  QUERY_PARAM_CHECK(input);
47,466✔
469
  QUERY_PARAM_CHECK(msg);
47,466✔
470
  QUERY_PARAM_CHECK(msgLen);
47,466✔
471

472
  SRsmaInfoReq req = {.withColName = 1};
47,466✔
473
  (void)snprintf(req.name, sizeof(req.name), "%s", (const char *)input);
47,466✔
474

475
  int32_t bufLen = tSerializeRsmaInfoReq(NULL, 0, &req);
47,466✔
476
  void   *pBuf = (*mallcFp)(bufLen);
47,466✔
477
  if (pBuf == NULL) {
47,466✔
478
    return terrno;
×
479
  }
480
  int32_t ret = tSerializeRsmaInfoReq(pBuf, bufLen, &req);
47,466✔
481
  if (ret < 0) {
47,466✔
482
    if (freeFp) (*freeFp)(pBuf);
×
483
    return ret;
×
484
  }
485

486
  *msg = pBuf;
47,466✔
487
  *msgLen = bufLen;
47,466✔
488
  return TSDB_CODE_SUCCESS;
47,466✔
489
}
490

491
int32_t queryBuildGetStreamProgressMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen,
11,092✔
492
                                       void *(*mallcFp)(int64_t), void (*freeFp)(void *)) {
493
  QUERY_PARAM_CHECK(input);
11,092✔
494
  QUERY_PARAM_CHECK(msg);
11,092✔
495
  QUERY_PARAM_CHECK(msgLen);
11,092✔
496

497
  int32_t len = tSerializeStreamProgressReq(NULL, 0, input);
11,092✔
498
  void* pBuf = (*mallcFp)(len);
11,092✔
499
  if (NULL == pBuf) {
11,092✔
500
    return terrno;
×
501
  }
502

503
  int32_t ret = tSerializeStreamProgressReq(pBuf, len, input);
11,092✔
504
  if (ret < 0) {
11,092✔
505
    if (freeFp) (*freeFp)(pBuf);
×
506
    return ret;
×
507
  }
508

509
  *msg = pBuf;
11,092✔
510
  *msgLen = len;
11,092✔
511
  return TSDB_CODE_SUCCESS;
11,092✔
512
}
513

514
int32_t queryBuildVSubTablesMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
×
515
                                void (*freeFp)(void *)) {
516
  QUERY_PARAM_CHECK(input);
×
517
  QUERY_PARAM_CHECK(msg);
×
518
  QUERY_PARAM_CHECK(msgLen);
×
519

520
  SVSubTablesReq req = {0};
×
521
  req.suid = *(int64_t*)input;
×
522

523
  int32_t bufLen = tSerializeSVSubTablesReq(NULL, 0, &req);
×
524
  void   *pBuf = (*mallcFp)(bufLen);
×
525
  if (NULL == pBuf) {
×
526
    return terrno;
×
527
  }
528
  if (tSerializeSVSubTablesReq(pBuf, bufLen, &req) < 0) {
×
529
    if (freeFp) (*freeFp)(pBuf);
×
530
    return TSDB_CODE_TSC_INVALID_INPUT;
×
531
  }
532

533
  *msg = pBuf;
×
534
  *msgLen = bufLen;
×
535

536
  return TSDB_CODE_SUCCESS;
×
537
}
538

539
int32_t queryBuildVStbRefDBsMsg(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void *(*mallcFp)(int64_t),
12,490,838✔
540
                                void (*freeFp)(void *)) {
541
  QUERY_PARAM_CHECK(input);
12,490,838✔
542
  QUERY_PARAM_CHECK(msg);
12,490,838✔
543
  QUERY_PARAM_CHECK(msgLen);
12,490,838✔
544

545
  SVStbRefDbsReq req = {0};
12,490,838✔
546
  req.suid = *(int64_t*)input;
12,490,838✔
547

548
  int32_t bufLen = tSerializeSVStbRefDbsReq(NULL, 0, &req);
12,490,838✔
549
  void   *pBuf = (*mallcFp)(bufLen);
12,490,838✔
550
  if (NULL == pBuf) {
12,490,838✔
551
    return terrno;
×
552
  }
553
  if (tSerializeSVStbRefDbsReq(pBuf, bufLen, &req) < 0) {
12,490,838✔
554
    if (freeFp) (*freeFp)(pBuf);
×
555
    return TSDB_CODE_TSC_INVALID_INPUT;
×
556
  }
557

558
  *msg = pBuf;
12,490,838✔
559
  *msgLen = bufLen;
12,490,838✔
560

561
  return TSDB_CODE_SUCCESS;
12,490,838✔
562
}
563

564
int32_t queryProcessUseDBRsp(void *output, char *msg, int32_t msgSize) {
46,614,462✔
565
  SUseDbOutput *pOut = output;
46,614,462✔
566
  SUseDbRsp     usedbRsp = {0};
46,614,462✔
567
  int32_t       code = -1;
46,614,462✔
568

569
  if (NULL == output || NULL == msg || msgSize <= 0) {
46,614,462✔
570
    code = TSDB_CODE_TSC_INVALID_INPUT;
×
571
    qError("invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
572
    goto PROCESS_USEDB_OVER;
×
573
  }
574

575
  if (tDeserializeSUseDbRsp(msg, msgSize, &usedbRsp) != 0) {
46,614,462✔
576
    qError("invalid use db rsp msg, msgSize:%d", msgSize);
×
577
    code = TSDB_CODE_INVALID_MSG;
×
578
    goto PROCESS_USEDB_OVER;
×
579
  }
580

581
  if (usedbRsp.vgNum < 0) {
46,614,462✔
582
    qError("invalid db[%s] vgroup number[%d]", usedbRsp.db, usedbRsp.vgNum);
×
583
    code = TSDB_CODE_TSC_INVALID_VALUE;
×
584
    goto PROCESS_USEDB_OVER;
×
585
  }
586

587
  qTrace("db:%s, usedbRsp received, numOfVgroups:%d", usedbRsp.db, usedbRsp.vgNum);
46,614,462✔
588
  for (int32_t i = 0; i < usedbRsp.vgNum; ++i) {
155,844,284✔
589
    SVgroupInfo *pInfo = taosArrayGet(usedbRsp.pVgroupInfos, i);
109,229,822✔
590
    qTrace("vgId:%d, numOfEps:%d inUse:%d ", pInfo->vgId, pInfo->epSet.numOfEps, pInfo->epSet.inUse);
109,229,822✔
591
    for (int32_t j = 0; j < pInfo->epSet.numOfEps; ++j) {
222,739,042✔
592
      qTrace("vgId:%d, index:%d epset:%s:%u", pInfo->vgId, j, pInfo->epSet.eps[j].fqdn, pInfo->epSet.eps[j].port);
113,509,220✔
593
    }
594
  }
595

596
  code = queryBuildUseDbOutput(pOut, &usedbRsp);
46,614,462✔
597

598
PROCESS_USEDB_OVER:
46,614,462✔
599

600
  if (code != 0) {
46,614,462✔
601
    if (pOut) {
×
602
      if (pOut->dbVgroup) taosHashCleanup(pOut->dbVgroup->vgHash);
×
603
      taosMemoryFreeClear(pOut->dbVgroup);
×
604
    }
605
    qError("failed to process usedb rsp since %s", terrstr());
×
606
  }
607

608
  tFreeSUsedbRsp(&usedbRsp);
46,614,462✔
609
  return code;
46,614,462✔
610
}
611

612
static int32_t queryConvertTableMetaMsg(STableMetaRsp *pMetaMsg) {
75,380,940✔
613
  QUERY_PARAM_CHECK(pMetaMsg);
75,380,940✔
614
  if (pMetaMsg->numOfTags < 0 || pMetaMsg->numOfTags > TSDB_MAX_TAGS) {
75,380,940✔
615
    qError("invalid numOfTags[%d] in table meta rsp msg", pMetaMsg->numOfTags);
5,248✔
616
    return TSDB_CODE_TSC_INVALID_VALUE;
×
617
  }
618

619
  if (pMetaMsg->numOfColumns > TSDB_MAX_COLUMNS || pMetaMsg->numOfColumns <= 0) {
75,377,004✔
620
    qError("invalid numOfColumns[%d] in table meta rsp msg", pMetaMsg->numOfColumns);
1,958✔
621
    return TSDB_CODE_TSC_INVALID_VALUE;
×
622
  }
623

624
  if (pMetaMsg->tableType != TSDB_SUPER_TABLE && pMetaMsg->tableType != TSDB_CHILD_TABLE &&
75,377,670✔
625
      pMetaMsg->tableType != TSDB_NORMAL_TABLE && pMetaMsg->tableType != TSDB_SYSTEM_TABLE &&
11,342,426✔
626
      pMetaMsg->tableType != TSDB_VIRTUAL_NORMAL_TABLE && pMetaMsg->tableType != TSDB_VIRTUAL_CHILD_TABLE) {
664,838✔
627
    qError("invalid tableType[%d] in table meta rsp msg", pMetaMsg->tableType);
×
628
    return TSDB_CODE_TSC_INVALID_VALUE;
×
629
  }
630

631
  if (pMetaMsg->sversion < 0) {
75,384,752✔
632
    qError("invalid sversion[%d] in table meta rsp msg", pMetaMsg->sversion);
×
633
    return TSDB_CODE_TSC_INVALID_VALUE;
×
634
  }
635

636
  if (pMetaMsg->tversion < 0) {
75,377,670✔
637
    qError("invalid tversion[%d] in table meta rsp msg", pMetaMsg->tversion);
×
638
    return TSDB_CODE_TSC_INVALID_VALUE;
×
639
  }
640

641
  if (pMetaMsg->rversion < 0) {
75,378,982✔
642
    qError("invalid rversion[%d] in table meta rsp msg", pMetaMsg->rversion);
×
643
    return TSDB_CODE_TSC_INVALID_VALUE;
×
644
  }
645

646
  if (pMetaMsg->pSchemas[0].colId != PRIMARYKEY_TIMESTAMP_COL_ID) {
75,377,670✔
647
    qError("invalid colId[%" PRIi16 "] for the first column in table meta rsp msg", pMetaMsg->pSchemas[0].colId);
×
648
    return TSDB_CODE_TSC_INVALID_VALUE;
×
649
  }
650

651
  return TSDB_CODE_SUCCESS;
75,380,940✔
652
}
653

654
int32_t queryCreateCTableMetaFromMsg(STableMetaRsp *msg, SCTableMeta *pMeta) {
115,000,162✔
655
  QUERY_PARAM_CHECK(msg);
115,000,162✔
656
  QUERY_PARAM_CHECK(pMeta);
115,000,162✔
657
  pMeta->vgId = msg->vgId;
115,000,162✔
658
  pMeta->tableType = msg->tableType;
114,973,342✔
659
  pMeta->uid = msg->tuid;
114,985,088✔
660
  pMeta->suid = msg->suid;
114,963,852✔
661

662
  qDebug("ctb:%s, uid:0x%" PRIx64 " meta returned, type:%d vgId:%d db:%s suid:%" PRIx64, msg->tbName, pMeta->uid,
114,976,652✔
663
         pMeta->tableType, pMeta->vgId, msg->dbFName, pMeta->suid);
664

665
  return TSDB_CODE_SUCCESS;
114,964,666✔
666
}
667

668
int32_t queryCreateVCTableMetaFromMsg(STableMetaRsp *msg, SVCTableMeta **pMeta) {
906,128✔
669
  QUERY_PARAM_CHECK(msg);
906,128✔
670
  QUERY_PARAM_CHECK(pMeta);
906,128✔
671
  QUERY_PARAM_CHECK(msg->pColRefs);
906,128✔
672

673
  int32_t pColRefSize = sizeof(SColRef) * msg->numOfColRefs;
906,128✔
674

675
  SVCTableMeta *pTableMeta = taosMemoryCalloc(1, sizeof(SVCTableMeta) + pColRefSize);
906,128✔
676
  if (NULL == pTableMeta) {
906,128✔
677
    qError("calloc size[%d] failed", (int32_t)sizeof(SVCTableMeta) + pColRefSize);
×
678
    return terrno;
×
679
  }
680

681
  pTableMeta->vgId = msg->vgId;
906,128✔
682
  pTableMeta->tableType = msg->tableType;
906,128✔
683
  pTableMeta->uid = msg->tuid;
906,128✔
684
  pTableMeta->suid = msg->suid;
906,128✔
685
  pTableMeta->numOfColRefs = msg->numOfColRefs;
906,128✔
686
  pTableMeta->rversion = msg->rversion;
906,128✔
687

688
  pTableMeta->colRef = (SColRef *)((char *)pTableMeta + sizeof(SVCTableMeta));
906,128✔
689
  memcpy(pTableMeta->colRef, msg->pColRefs, pColRefSize);
906,128✔
690

691
  qDebug("ctable %s uid %" PRIx64 " meta returned, type %d vgId:%d db %s suid %" PRIx64, msg->tbName, (pTableMeta)->uid,
906,128✔
692
         (pTableMeta)->tableType, (pTableMeta)->vgId, msg->dbFName, (pTableMeta)->suid);
693

694
  *pMeta = pTableMeta;
906,128✔
695
  return TSDB_CODE_SUCCESS;
906,128✔
696
}
697

698
int32_t queryCreateTableMetaFromMsg(STableMetaRsp *msg, bool isStb, STableMeta **pMeta) {
109,942,394✔
699
  QUERY_PARAM_CHECK(msg);
109,942,394✔
700
  QUERY_PARAM_CHECK(pMeta);
109,942,394✔
701
  int32_t total = msg->numOfColumns + msg->numOfTags;
109,942,394✔
702
  int32_t metaSize = sizeof(STableMeta) + sizeof(SSchema) * total;
109,941,016✔
703
  int32_t schemaExtSize = (withExtSchema(msg->tableType) && msg->pSchemaExt) ? sizeof(SSchemaExt) * msg->numOfColumns : 0;
109,941,016✔
704
  int32_t pColRefSize = (hasRefCol(msg->tableType) && msg->pColRefs && !isStb) ? sizeof(SColRef) * msg->numOfColRefs : 0;
109,941,664✔
705

706
  STableMeta *pTableMeta = taosMemoryCalloc(1, metaSize + schemaExtSize + pColRefSize);
109,941,082✔
707
  if (NULL == pTableMeta) {
109,939,770✔
708
    qError("calloc size[%d] failed", metaSize);
×
709
    return terrno;
×
710
  }
711
  SSchemaExt *pSchemaExt = (SSchemaExt *)((char *)pTableMeta + metaSize);
109,939,770✔
712
  SColRef    *pColRef = (SColRef *)((char *)pTableMeta + metaSize + schemaExtSize);
109,941,082✔
713

714
  pTableMeta->vgId = isStb ? 0 : msg->vgId;
109,941,082✔
715
  pTableMeta->tableType = isStb ? TSDB_SUPER_TABLE : msg->tableType;
109,940,352✔
716
  pTableMeta->uid = isStb ? msg->suid : msg->tuid;
109,940,352✔
717
  pTableMeta->suid = msg->suid;
109,940,352✔
718
  pTableMeta->sversion = msg->sversion;
109,939,040✔
719
  pTableMeta->tversion = msg->tversion;
109,941,598✔
720
  pTableMeta->rversion = msg->rversion;
109,939,038✔
721
  pTableMeta->ownerId = msg->ownerId;
109,937,728✔
722
  pTableMeta->flag = msg->flag;
109,940,352✔
723
  pTableMeta->secureDelete = msg->secureDelete;
109,939,040✔
724
  if (msg->virtualStb) {
109,940,352✔
725
    pTableMeta->virtualStb = 1;
967,446✔
726
    pTableMeta->numOfColRefs = 0;
967,446✔
727
  } else {
728
    if (msg->tableType == TSDB_VIRTUAL_CHILD_TABLE && isStb) {
108,969,698✔
729
      pTableMeta->virtualStb = 1;
393,172✔
730
      pTableMeta->numOfColRefs = 0;
393,172✔
731
    } else {
732
      pTableMeta->virtualStb = 0;
108,580,980✔
733
      pTableMeta->numOfColRefs = msg->numOfColRefs;
108,580,464✔
734
    }
735
  }
736

737
  pTableMeta->tableInfo.numOfTags = msg->numOfTags;
109,941,598✔
738
  pTableMeta->tableInfo.precision = msg->precision;
109,941,662✔
739
  pTableMeta->tableInfo.numOfColumns = msg->numOfColumns;
109,940,352✔
740

741
  memcpy(pTableMeta->schema, msg->pSchemas, sizeof(SSchema) * total);
109,940,352✔
742
  if (withExtSchema(msg->tableType) && msg->pSchemaExt) {
109,936,348✔
743
    pTableMeta->schemaExt = pSchemaExt;
104,598,646✔
744
    memcpy(pSchemaExt, msg->pSchemaExt, schemaExtSize);
104,598,646✔
745
  } else {
746
    pTableMeta->schemaExt = NULL;
5,341,706✔
747
  }
748

749
  if (hasRefCol(msg->tableType) && msg->pColRefs && !isStb) {
109,939,770✔
750
    pTableMeta->colRef = (SColRef *)((char *)pTableMeta + metaSize + schemaExtSize);
1,145,924✔
751
    memcpy(pTableMeta->colRef, msg->pColRefs, pColRefSize);
1,145,924✔
752
  } else {
753
    pTableMeta->colRef = NULL;
108,794,428✔
754
  }
755

756
  bool hasPK = (msg->numOfColumns > 1) && (pTableMeta->schema[1].flags & COL_IS_KEY);
109,937,726✔
757
  for (int32_t i = 0; i < msg->numOfColumns; ++i) {
2,147,483,647✔
758
    pTableMeta->tableInfo.rowSize += pTableMeta->schema[i].bytes;
2,147,483,647✔
759
    if (hasPK && (i > 0)) {
2,147,483,647✔
760
      if ((pTableMeta->schema[i].flags & COL_IS_KEY)) {
1,070,046✔
761
        ++pTableMeta->tableInfo.numOfPKs;
539,070✔
762
      } else {
763
        hasPK = false;
530,976✔
764
      }
765
    }
766
  }
767

768
  qDebug("tb:%s, uid:%" PRIx64 " meta returned, type:%d vgId:%d db:%s stb:%s suid:%" PRIx64
109,940,350✔
769
         " sver:%d tver:%d"
770
         " tagNum:%d colNum:%d precision:%d rowSize:%d",
771
         msg->tbName, pTableMeta->uid, pTableMeta->tableType, pTableMeta->vgId, msg->dbFName, msg->stbName,
772
         pTableMeta->suid, pTableMeta->sversion, pTableMeta->tversion, pTableMeta->tableInfo.numOfTags,
773
         pTableMeta->tableInfo.numOfColumns, pTableMeta->tableInfo.precision, pTableMeta->tableInfo.rowSize);
774

775
  *pMeta = pTableMeta;
109,944,288✔
776
  return TSDB_CODE_SUCCESS;
109,942,976✔
777
}
778

779
int32_t queryCreateTableMetaExFromMsg(STableMetaRsp *msg, bool isStb, STableMeta **pMeta) {
318,358✔
780
  QUERY_PARAM_CHECK(msg);
318,358✔
781
  QUERY_PARAM_CHECK(pMeta);
318,358✔
782
  int32_t total = msg->numOfColumns + msg->numOfTags;
318,358✔
783
  int32_t metaSize = sizeof(STableMeta) + sizeof(SSchema) * total;
318,358✔
784
  int32_t schemaExtSize = (withExtSchema(msg->tableType) && msg->pSchemaExt) ? sizeof(SSchemaExt) * msg->numOfColumns : 0;
318,358✔
785
  int32_t pColRefSize = (hasRefCol(msg->tableType) && msg->pColRefs) ? sizeof(SColRef) * msg->numOfColRefs : 0;
318,358✔
786
  int32_t tbNameSize = strlen(msg->tbName) + 1;
318,358✔
787

788
  STableMeta *pTableMeta = taosMemoryCalloc(1, metaSize + schemaExtSize + pColRefSize + tbNameSize);
318,358✔
789
  if (NULL == pTableMeta) {
318,358✔
UNCOV
790
    qError("calloc size[%d] failed", metaSize);
×
791
    return terrno;
×
792
  }
793
  SSchemaExt *pSchemaExt = (SSchemaExt *)((char *)pTableMeta + metaSize);
318,358✔
794
  SColRef    *pColRef = (SColRef *)((char *)pTableMeta + metaSize + schemaExtSize);
318,358✔
795

796
  pTableMeta->vgId = isStb ? 0 : msg->vgId;
318,358✔
797
  pTableMeta->tableType = isStb ? TSDB_SUPER_TABLE : msg->tableType;
318,358✔
798
  pTableMeta->uid = isStb ? msg->suid : msg->tuid;
318,358✔
799
  pTableMeta->suid = msg->suid;
318,358✔
800
  pTableMeta->sversion = msg->sversion;
318,358✔
801
  pTableMeta->tversion = msg->tversion;
318,358✔
802
  pTableMeta->rversion = msg->rversion;
318,358✔
803
  pTableMeta->virtualStb = msg->virtualStb;
318,358✔
804
  pTableMeta->numOfColRefs = msg->numOfColRefs;
318,358✔
805
  pTableMeta->ownerId = msg->ownerId;
318,358✔
806
  pTableMeta->secureDelete = msg->secureDelete;
318,358✔
807

808
  pTableMeta->tableInfo.numOfTags = msg->numOfTags;
318,358✔
809
  pTableMeta->tableInfo.precision = msg->precision;
318,358✔
810
  pTableMeta->tableInfo.numOfColumns = msg->numOfColumns;
318,358✔
811

812
  TAOS_MEMCPY(pTableMeta->schema, msg->pSchemas, sizeof(SSchema) * total);
318,358✔
813
  if (withExtSchema(msg->tableType) && msg->pSchemaExt) {
318,358✔
814
    pTableMeta->schemaExt = pSchemaExt;
318,358✔
815
    TAOS_MEMCPY(pSchemaExt, msg->pSchemaExt, schemaExtSize);
318,358✔
816
  } else {
UNCOV
817
    pTableMeta->schemaExt = NULL;
×
818
  }
819

820
  if (hasRefCol(msg->tableType) && msg->pColRefs) {
318,358✔
UNCOV
821
    pTableMeta->colRef = (SColRef *)((char *)pTableMeta + metaSize + schemaExtSize);
×
UNCOV
822
    memcpy(pTableMeta->colRef, msg->pColRefs, pColRefSize);
×
823
  } else {
824
    pTableMeta->colRef = NULL;
318,358✔
825
  }
826

827
  bool hasPK = (msg->numOfColumns > 1) && (pTableMeta->schema[1].flags & COL_IS_KEY);
318,358✔
828
  for (int32_t i = 0; i < msg->numOfColumns; ++i) {
1,031,304✔
829
    pTableMeta->tableInfo.rowSize += pTableMeta->schema[i].bytes;
712,946✔
830
    if (hasPK && (i > 0)) {
712,946✔
UNCOV
831
      if ((pTableMeta->schema[i].flags & COL_IS_KEY)) {
×
UNCOV
832
        ++pTableMeta->tableInfo.numOfPKs;
×
833
      } else {
834
        hasPK = false;
×
835
      }
836
    }
837
  }
838

839
  char *pTbName = (char *)pTableMeta + metaSize + schemaExtSize + pColRefSize;
318,358✔
840
  tstrncpy(pTbName, msg->tbName, tbNameSize);
318,358✔
841

842
  qDebug("tb:%s, uid:%" PRIx64 " meta returned, type:%d vgId:%d db:%s stb:%s suid:%" PRIx64
318,358✔
843
         " sver:%d tver:%d"
844
         " tagNum:%d colNum:%d precision:%d rowSize:%d",
845
         msg->tbName, pTableMeta->uid, pTableMeta->tableType, pTableMeta->vgId, msg->dbFName, msg->stbName,
846
         pTableMeta->suid, pTableMeta->sversion, pTableMeta->tversion, pTableMeta->tableInfo.numOfTags,
847
         pTableMeta->tableInfo.numOfColumns, pTableMeta->tableInfo.precision, pTableMeta->tableInfo.rowSize);
848

849
  *pMeta = pTableMeta;
318,358✔
850
  return TSDB_CODE_SUCCESS;
318,358✔
851
}
852

853
int32_t queryProcessTableMetaRsp(void *output, char *msg, int32_t msgSize) {
75,065,206✔
854
  int32_t       code = 0;
75,065,206✔
855
  STableMetaRsp metaRsp = {0};
75,065,206✔
856

857
  if (NULL == output || NULL == msg || msgSize <= 0) {
75,065,206✔
UNCOV
858
    qError("queryProcessTableMetaRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
859
    code = TSDB_CODE_TSC_INVALID_INPUT;
×
860
    goto PROCESS_META_OVER;
×
861
  }
862

863
  if (tDeserializeSTableMetaRsp(msg, msgSize, &metaRsp) != 0) {
75,065,206✔
UNCOV
864
    code = TSDB_CODE_INVALID_MSG;
×
UNCOV
865
    goto PROCESS_META_OVER;
×
866
  }
867

868
  code = queryConvertTableMetaMsg(&metaRsp);
75,063,894✔
869
  if (code != TSDB_CODE_SUCCESS) {
75,061,270✔
UNCOV
870
    goto PROCESS_META_OVER;
×
871
  }
872

873
  bool isVirtual = (metaRsp.tableType == TSDB_VIRTUAL_NORMAL_TABLE ||
224,913,456✔
874
                    metaRsp.tableType == TSDB_VIRTUAL_CHILD_TABLE ||
149,459,014✔
875
                    metaRsp.virtualStb);
74,397,744✔
876
  if (!IS_SYS_DBNAME(metaRsp.dbFName) &&
75,061,270✔
877
      !tIsValidSchema(metaRsp.pSchemas, metaRsp.numOfColumns, metaRsp.numOfTags, isVirtual)) {
71,259,068✔
UNCOV
878
    code = TSDB_CODE_TSC_INVALID_VALUE;
×
UNCOV
879
    goto PROCESS_META_OVER;
×
880
  }
881

882
  STableMetaOutput *pOut = output;
75,064,624✔
883
  tstrncpy(pOut->dbFName, metaRsp.dbFName, TSDB_DB_FNAME_LEN);
75,064,624✔
884
  pOut->dbId = metaRsp.dbId;
75,061,444✔
885

886
  if (metaRsp.tableType == TSDB_CHILD_TABLE) {
75,063,486✔
887
    SET_META_TYPE_BOTH_TABLE(pOut->metaType);
25,202,426✔
888

889
    tstrncpy(pOut->ctbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
25,202,426✔
890
    tstrncpy(pOut->tbName, metaRsp.stbName, TSDB_TABLE_NAME_LEN);
25,202,492✔
891

892
    pOut->ctbMeta.vgId = metaRsp.vgId;
25,202,426✔
893
    pOut->ctbMeta.tableType = metaRsp.tableType;
25,202,426✔
894
    pOut->ctbMeta.uid = metaRsp.tuid;
25,202,426✔
895
    pOut->ctbMeta.suid = metaRsp.suid;
25,202,492✔
896

897
    code = queryCreateTableMetaFromMsg(&metaRsp, true, &pOut->tbMeta);
25,202,492✔
898
  } else if (metaRsp.tableType == TSDB_VIRTUAL_CHILD_TABLE) {
49,861,060✔
899
    SET_META_TYPE_BOTH_VTABLE(pOut->metaType);
393,172✔
900

901
    tstrncpy(pOut->ctbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
393,172✔
902
    tstrncpy(pOut->tbName, metaRsp.stbName, TSDB_TABLE_NAME_LEN);
393,172✔
903

904
    code = queryCreateVCTableMetaFromMsg(&metaRsp, &pOut->vctbMeta);
393,172✔
905
    if (TSDB_CODE_SUCCESS != code) {
393,172✔
UNCOV
906
      goto PROCESS_META_OVER;
×
907
    }
908
    code = queryCreateTableMetaFromMsg(&metaRsp, true, &pOut->tbMeta);
393,172✔
909
  } else {
910
    SET_META_TYPE_TABLE(pOut->metaType);
49,467,888✔
911
    tstrncpy(pOut->tbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
49,468,960✔
912
    code = queryCreateTableMetaFromMsg(&metaRsp, (metaRsp.tableType == TSDB_SUPER_TABLE), &pOut->tbMeta);
49,466,918✔
913
  }
914

915
PROCESS_META_OVER:
75,065,206✔
916
  if (code != 0) {
75,065,206✔
UNCOV
917
    qError("failed to process table meta rsp since %s", tstrerror(code));
×
918
  }
919

920
  tFreeSTableMetaRsp(&metaRsp);
75,065,206✔
921
  return code;
75,065,140✔
922
}
923

924
static int32_t queryProcessTableNameRsp(void *output, char *msg, int32_t msgSize) {
318,358✔
925
  int32_t       code = 0;
318,358✔
926
  STableMetaRsp metaRsp = {0};
318,358✔
927

928
  if (NULL == output || NULL == msg || msgSize <= 0) {
318,358✔
UNCOV
929
    qError("queryProcessTableNameRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
930
    code = TSDB_CODE_TSC_INVALID_INPUT;
×
931
    goto PROCESS_NAME_OVER;
×
932
  }
933

934
  if (tDeserializeSTableMetaRsp(msg, msgSize, &metaRsp) != 0) {
318,358✔
UNCOV
935
    code = TSDB_CODE_INVALID_MSG;
×
UNCOV
936
    goto PROCESS_NAME_OVER;
×
937
  }
938

939
  code = queryConvertTableMetaMsg(&metaRsp);
318,358✔
940
  if (code != TSDB_CODE_SUCCESS) {
318,358✔
UNCOV
941
    goto PROCESS_NAME_OVER;
×
942
  }
943

944
  bool isVirtual = (metaRsp.tableType == TSDB_VIRTUAL_NORMAL_TABLE ||
955,074✔
945
                    metaRsp.tableType == TSDB_VIRTUAL_CHILD_TABLE ||
636,716✔
946
                    metaRsp.virtualStb);
318,358✔
947

948
  if (!IS_SYS_DBNAME(metaRsp.dbFName) &&
318,358✔
949
      !tIsValidSchema(metaRsp.pSchemas, metaRsp.numOfColumns, metaRsp.numOfTags, isVirtual)) {
318,358✔
UNCOV
950
    code = TSDB_CODE_TSC_INVALID_VALUE;
×
UNCOV
951
    goto PROCESS_NAME_OVER;
×
952
  }
953

954
  STableMetaOutput *pOut = output;
318,358✔
955
  tstrncpy(pOut->dbFName, metaRsp.dbFName, TSDB_DB_FNAME_LEN);
318,358✔
956
  pOut->dbId = metaRsp.dbId;
318,358✔
957

958
  if (metaRsp.tableType == TSDB_CHILD_TABLE) {
318,358✔
959
    SET_META_TYPE_BOTH_TABLE(pOut->metaType);
78,518✔
960

961
    tstrncpy(pOut->ctbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
78,518✔
962
    tstrncpy(pOut->tbName, metaRsp.stbName, TSDB_TABLE_NAME_LEN);
78,518✔
963

964
    pOut->ctbMeta.vgId = metaRsp.vgId;
78,518✔
965
    pOut->ctbMeta.tableType = metaRsp.tableType;
78,518✔
966
    pOut->ctbMeta.uid = metaRsp.tuid;
78,518✔
967
    pOut->ctbMeta.suid = metaRsp.suid;
78,518✔
968

969
    code = queryCreateTableMetaExFromMsg(&metaRsp, true, &pOut->tbMeta);
78,518✔
970
  } else if (metaRsp.tableType == TSDB_VIRTUAL_CHILD_TABLE) {
239,840✔
UNCOV
971
    SET_META_TYPE_BOTH_VTABLE(pOut->metaType);
×
972

973
    tstrncpy(pOut->ctbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
×
UNCOV
974
    tstrncpy(pOut->tbName, metaRsp.stbName, TSDB_TABLE_NAME_LEN);
×
975

976
    code = queryCreateVCTableMetaFromMsg(&metaRsp, &pOut->vctbMeta);
×
UNCOV
977
    if (TSDB_CODE_SUCCESS != code) {
×
978
      goto PROCESS_NAME_OVER;
×
979
    }
980

UNCOV
981
    code = queryCreateTableMetaExFromMsg(&metaRsp, true, &pOut->tbMeta);
×
982
  } else {
983
    SET_META_TYPE_TABLE(pOut->metaType);
239,840✔
984
    tstrncpy(pOut->tbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
239,840✔
985
    code = queryCreateTableMetaExFromMsg(&metaRsp, (metaRsp.tableType == TSDB_SUPER_TABLE), &pOut->tbMeta);
239,840✔
986
  }
987

988
PROCESS_NAME_OVER:
318,358✔
989
  if (code != 0) {
318,358✔
UNCOV
990
    qError("failed to process table name rsp since %s", tstrerror(code));
×
991
  }
992

993
  tFreeSTableMetaRsp(&metaRsp);
318,358✔
994
  return code;
318,358✔
995
}
996

997
int32_t queryProcessQnodeListRsp(void *output, char *msg, int32_t msgSize) {
103,278✔
998
  SQnodeListRsp out = {0};
103,278✔
999
  int32_t       code = 0;
103,278✔
1000

1001
  if (NULL == output || NULL == msg || msgSize <= 0) {
103,278✔
UNCOV
1002
    qError("queryProcessQnodeListRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1003
    code = TSDB_CODE_TSC_INVALID_INPUT;
×
1004
    return code;
×
1005
  }
1006

1007
  out.qnodeList = (SArray *)output;
103,278✔
1008
  if (tDeserializeSQnodeListRsp(msg, msgSize, &out) != 0) {
103,278✔
UNCOV
1009
    qError("invalid qnode list rsp msg, msgSize:%d", msgSize);
×
UNCOV
1010
    code = TSDB_CODE_INVALID_MSG;
×
1011
    return code;
×
1012
  }
1013

1014
  return code;
103,278✔
1015
}
1016

1017
int32_t queryProcessDnodeListRsp(void *output, char *msg, int32_t msgSize) {
80,086✔
1018
  SDnodeListRsp out = {0};
80,086✔
1019
  int32_t       code = 0;
80,086✔
1020

1021
  if (NULL == output || NULL == msg || msgSize <= 0) {
80,086✔
UNCOV
1022
    qError("queryProcessDnodeListRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1023
    code = TSDB_CODE_TSC_INVALID_INPUT;
×
1024
    return code;
×
1025
  }
1026

1027
  if (tDeserializeSDnodeListRsp(msg, msgSize, &out) != 0) {
80,086✔
UNCOV
1028
    qError("invalid dnode list rsp msg, msgSize:%d", msgSize);
×
UNCOV
1029
    code = TSDB_CODE_INVALID_MSG;
×
1030
    return code;
×
1031
  }
1032

1033
  *(SArray **)output = out.dnodeList;
80,086✔
1034

1035
  return code;
80,086✔
1036
}
1037

1038
int32_t queryProcessGetSerVerRsp(void *output, char *msg, int32_t msgSize) {
204✔
1039
  SServerVerRsp out = {0};
204✔
1040
  int32_t       code = 0;
204✔
1041

1042
  if (NULL == output || NULL == msg || msgSize <= 0) {
204✔
UNCOV
1043
    qError("queryProcessGetSerVerRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1044
    code = TSDB_CODE_TSC_INVALID_INPUT;
×
1045
    return code;
×
1046
  }
1047

1048
  if (tDeserializeSServerVerRsp(msg, msgSize, &out) != 0) {
204✔
UNCOV
1049
    qError("invalid svr ver rsp msg, msgSize:%d", msgSize);
×
UNCOV
1050
    code = TSDB_CODE_INVALID_MSG;
×
1051
    return code;
×
1052
  }
1053

1054
  *(char **)output = taosStrdup(out.ver);
204✔
1055
  if (NULL == *(char **)output) {
204✔
UNCOV
1056
    return terrno;
×
1057
  }
1058

1059
  return code;
204✔
1060
}
1061

1062
int32_t queryProcessGetDbCfgRsp(void *output, char *msg, int32_t msgSize) {
8,995,196✔
1063
  SDbCfgRsp out = {0};
8,995,196✔
1064

1065
  if (NULL == output || NULL == msg || msgSize <= 0) {
8,996,332✔
UNCOV
1066
    qError("queryProcessGetDbCfgRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1067
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1068
  }
1069

1070
  if (tDeserializeSDbCfgRsp(msg, msgSize, &out) != 0) {
8,996,332✔
UNCOV
1071
    qError("tDeserializeSDbCfgRsp failed, msgSize:%d, dbCfgRsp:%lu", msgSize, sizeof(out));
×
UNCOV
1072
    return TSDB_CODE_INVALID_MSG;
×
1073
  }
1074

1075
  memcpy(output, &out, sizeof(out));
8,996,332✔
1076

1077
  return TSDB_CODE_SUCCESS;
8,996,332✔
1078
}
1079

UNCOV
1080
int32_t queryProcessGetIndexRsp(void *output, char *msg, int32_t msgSize) {
×
UNCOV
1081
  SUserIndexRsp out = {0};
×
1082

1083
  if (NULL == output || NULL == msg || msgSize <= 0) {
×
UNCOV
1084
    qError("queryProcessGetIndexRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
1085
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1086
  }
1087

UNCOV
1088
  if (tDeserializeSUserIndexRsp(msg, msgSize, &out) != 0) {
×
UNCOV
1089
    qError("tDeserializeSUserIndexRsp failed, msgSize:%d", msgSize);
×
1090
    return TSDB_CODE_INVALID_MSG;
×
1091
  }
1092

UNCOV
1093
  memcpy(output, &out, sizeof(out));
×
1094

1095
  return TSDB_CODE_SUCCESS;
×
1096
}
1097

1098
int32_t queryProcessRetrieveFuncRsp(void *output, char *msg, int32_t msgSize) {
282,308✔
1099
  SRetrieveFuncRsp out = {0};
282,308✔
1100

1101
  if (NULL == output || NULL == msg || msgSize <= 0) {
282,308✔
UNCOV
1102
    qError("queryProcessRetrieveFuncRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1103
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1104
  }
1105

1106
  if (tDeserializeSRetrieveFuncRsp(msg, msgSize, &out) != 0) {
282,308✔
UNCOV
1107
    qError("tDeserializeSRetrieveFuncRsp failed, msgSize:%d", msgSize);
×
UNCOV
1108
    return TSDB_CODE_INVALID_MSG;
×
1109
  }
1110

1111
  if (1 != out.numOfFuncs) {
282,308✔
UNCOV
1112
    qError("invalid func num returned, numOfFuncs:%d", out.numOfFuncs);
×
UNCOV
1113
    return TSDB_CODE_INVALID_MSG;
×
1114
  }
1115

1116
  SFuncInfo *funcInfo = taosArrayGet(out.pFuncInfos, 0);
282,308✔
1117

1118
  memcpy(output, funcInfo, sizeof(*funcInfo));
282,308✔
1119
  taosArrayDestroy(out.pFuncInfos);
282,308✔
1120
  taosArrayDestroy(out.pFuncExtraInfos);
282,308✔
1121

1122
  return TSDB_CODE_SUCCESS;
282,308✔
1123
}
1124

1125
int32_t queryProcessGetUserAuthRsp(void *output, char *msg, int32_t msgSize) {
12,274,426✔
1126
  if (NULL == output || NULL == msg || msgSize <= 0) {
12,274,426✔
UNCOV
1127
    qError("queryProcessGetUserAuthRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1128
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1129
  }
1130

1131
  if (tDeserializeSGetUserAuthRsp(msg, msgSize, (SGetUserAuthRsp *)output) != 0) {
12,274,426✔
UNCOV
1132
    qError("tDeserializeSGetUserAuthRsp failed, msgSize:%d", msgSize);
×
UNCOV
1133
    return TSDB_CODE_INVALID_MSG;
×
1134
  }
1135

1136
  return TSDB_CODE_SUCCESS;
12,274,426✔
1137
}
1138

1139
int32_t queryProcessGetTbIndexRsp(void *output, char *msg, int32_t msgSize) {
204✔
1140
  if (NULL == output || NULL == msg || msgSize <= 0) {
204✔
UNCOV
1141
    qError("queryProcessGetTbIndexRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1142
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1143
  }
1144

1145
  STableIndexRsp *out = (STableIndexRsp *)output;
204✔
1146
  if (tDeserializeSTableIndexRsp(msg, msgSize, out) != 0) {
204✔
UNCOV
1147
    qError("tDeserializeSTableIndexRsp failed, msgSize:%d", msgSize);
×
UNCOV
1148
    return TSDB_CODE_INVALID_MSG;
×
1149
  }
1150

1151
  return TSDB_CODE_SUCCESS;
204✔
1152
}
1153

1154
int32_t queryProcessGetTbCfgRsp(void *output, char *msg, int32_t msgSize) {
190,648✔
1155
  if (NULL == output || NULL == msg || msgSize <= 0) {
190,648✔
UNCOV
1156
    qError("queryProcessGetTbCfgRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1157
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1158
  }
1159

1160
  STableCfgRsp *out = taosMemoryCalloc(1, sizeof(STableCfgRsp));
190,648✔
1161
  if(out == NULL) {
190,648✔
UNCOV
1162
    return terrno;
×
1163
  }
1164
  if (tDeserializeSTableCfgRsp(msg, msgSize, out) != 0) {
190,648✔
UNCOV
1165
    qError("tDeserializeSTableCfgRsp failed, msgSize:%d", msgSize);
×
UNCOV
1166
    tFreeSTableCfgRsp(out);
×
1167
    taosMemoryFree(out);
×
1168
    return TSDB_CODE_INVALID_MSG;
×
1169
  }
1170

1171
  *(STableCfgRsp **)output = out;
190,648✔
1172

1173
  return TSDB_CODE_SUCCESS;
190,648✔
1174
}
1175

1176
int32_t queryProcessGetViewMetaRsp(void *output, char *msg, int32_t msgSize) {
468,350✔
1177
  if (NULL == output || NULL == msg || msgSize <= 0) {
468,350✔
UNCOV
1178
    qError("queryProcessGetViewMetaRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1179
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1180
  }
1181

1182
  SViewMetaRsp *out = taosMemoryCalloc(1, sizeof(SViewMetaRsp));
468,350✔
1183
  if (out == NULL) {
468,350✔
UNCOV
1184
    return terrno;
×
1185
  }
1186
  if (tDeserializeSViewMetaRsp(msg, msgSize, out) != 0) {
468,350✔
UNCOV
1187
    qError("tDeserializeSViewMetaRsp failed, msgSize:%d", msgSize);
×
UNCOV
1188
    tFreeSViewMetaRsp(out);
×
1189
    taosMemoryFree(out);
×
1190
    return TSDB_CODE_INVALID_MSG;
×
1191
  }
1192

1193
  qDebugL("view meta recved, dbFName:%s, view:%s, querySQL:%s", out->dbFName, out->name, out->querySql);
468,350✔
1194

1195
  *(SViewMetaRsp **)output = out;
468,350✔
1196

1197
  return TSDB_CODE_SUCCESS;
468,350✔
1198
}
1199

1200
int32_t queryProcessGetTbTSMARsp(void* output, char* msg, int32_t msgSize) {
10,026✔
1201
  if (NULL == output || NULL == msg || msgSize <= 0) {
10,026✔
UNCOV
1202
    qError("queryProcessGetTbTSMARsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1203
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1204
  }
1205

1206
  if (tDeserializeTableTSMAInfoRsp(msg, msgSize, output) != 0) {
10,026✔
UNCOV
1207
    qError("tDeserializeTbTSMARsp failed, msgSize:%d", msgSize);
×
UNCOV
1208
    return TSDB_CODE_INVALID_MSG;
×
1209
  }
1210

1211
  return TSDB_CODE_SUCCESS;
10,026✔
1212
}
1213

1214
static int32_t queryProcessGetRsmaRsp(void* output, char* msg, int32_t msgSize) {
36,966✔
1215
  if (NULL == output || NULL == msg || msgSize <= 0) {
36,966✔
UNCOV
1216
    qError("queryProcessGetRsmaRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1217
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1218
  }
1219

1220
  if (tDeserializeRsmaInfoRsp(msg, msgSize, output) != 0) {
36,966✔
UNCOV
1221
    qError("tDeserializeRsmaInfoRsp failed, msgSize:%d", msgSize);
×
UNCOV
1222
    return TSDB_CODE_INVALID_MSG;
×
1223
  }
1224

1225
  return TSDB_CODE_SUCCESS;
36,966✔
1226
}
1227

1228
int32_t queryProcessStreamProgressRsp(void* output, char* msg, int32_t msgSize) {
11,092✔
1229
  if (!output || !msg || msgSize <= 0) {
11,092✔
UNCOV
1230
    qError("queryProcessStreamProgressRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1231
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1232
  }
1233

1234
  if (tDeserializeSStreamProgressRsp(msg, msgSize, output) != 0) {
11,092✔
UNCOV
1235
    qError("tDeserializeStreamProgressRsp failed, msgSize:%d", msgSize);
×
UNCOV
1236
    return TSDB_CODE_INVALID_MSG;
×
1237
  }
1238
  return TSDB_CODE_SUCCESS;
11,092✔
1239
}
1240

UNCOV
1241
int32_t queryProcessVSubTablesRsp(void* output, char* msg, int32_t msgSize) {
×
UNCOV
1242
  if (!output || !msg || msgSize <= 0) {
×
1243
    qError("queryProcessVSubTablesRsp input error, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
1244
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1245
  }
1246

UNCOV
1247
  SVSubTablesRsp* pRsp = (SVSubTablesRsp*)output;
×
UNCOV
1248
  int32_t code = tDeserializeSVSubTablesRsp(msg, msgSize, pRsp);
×
1249
  if (code != 0) {
×
1250
    qError("tDeserializeSVSubTablesRsp failed, msgSize: %d, error:%d", msgSize, code);
×
1251
    return code;
×
1252
  }
1253
  
UNCOV
1254
  return TSDB_CODE_SUCCESS;
×
1255
}
1256

1257
int32_t queryProcessVStbRefDbsRsp(void* output, char* msg, int32_t msgSize) {
12,490,838✔
1258
  if (!output || !msg || msgSize <= 0) {
12,490,838✔
UNCOV
1259
    qError("queryProcessVStbRefDbsRsp input error, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
UNCOV
1260
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1261
  }
1262

1263
  SVStbRefDbsRsp * pRsp = (SVStbRefDbsRsp*)output;
12,490,838✔
1264
  int32_t code = tDeserializeSVStbRefDbsRsp(msg, msgSize, pRsp);
12,490,838✔
1265
  if (code != 0) {
12,483,388✔
1266
    qError("tDeserializeSVStbRefDbsRsp failed, msgSize: %d, error:%d", msgSize, code);
7,198✔
UNCOV
1267
    return code;
×
1268
  }
1269

1270
  return TSDB_CODE_SUCCESS;
12,476,190✔
1271
}
1272

1273
void initQueryModuleMsgHandle() {
2,706,578✔
1274
  queryBuildMsg[TMSG_INDEX(TDMT_VND_TABLE_META)] = queryBuildTableMetaReqMsg;
2,706,578✔
1275
  queryBuildMsg[TMSG_INDEX(TDMT_VND_TABLE_NAME)] = queryBuildTableMetaReqMsg;
2,706,578✔
1276
  queryBuildMsg[TMSG_INDEX(TDMT_MND_TABLE_META)] = queryBuildTableMetaReqMsg;
2,706,578✔
1277
  queryBuildMsg[TMSG_INDEX(TDMT_MND_USE_DB)] = queryBuildUseDbMsg;
2,706,578✔
1278
  queryBuildMsg[TMSG_INDEX(TDMT_MND_QNODE_LIST)] = queryBuildQnodeListMsg;
2,706,578✔
1279
  queryBuildMsg[TMSG_INDEX(TDMT_MND_DNODE_LIST)] = queryBuildDnodeListMsg;
2,706,578✔
1280
  queryBuildMsg[TMSG_INDEX(TDMT_MND_GET_DB_CFG)] = queryBuildGetDBCfgMsg;
2,706,578✔
1281
  queryBuildMsg[TMSG_INDEX(TDMT_MND_GET_INDEX)] = queryBuildGetIndexMsg;
2,706,578✔
1282
  queryBuildMsg[TMSG_INDEX(TDMT_MND_RETRIEVE_FUNC)] = queryBuildRetrieveFuncMsg;
2,706,578✔
1283
  queryBuildMsg[TMSG_INDEX(TDMT_MND_GET_USER_AUTH)] = queryBuildGetUserAuthMsg;
2,706,578✔
1284
  queryBuildMsg[TMSG_INDEX(TDMT_MND_GET_TABLE_INDEX)] = queryBuildGetTbIndexMsg;
2,706,578✔
1285
  queryBuildMsg[TMSG_INDEX(TDMT_VND_TABLE_CFG)] = queryBuildGetTbCfgMsg;
2,706,578✔
1286
  queryBuildMsg[TMSG_INDEX(TDMT_MND_TABLE_CFG)] = queryBuildGetTbCfgMsg;
2,706,578✔
1287
  queryBuildMsg[TMSG_INDEX(TDMT_MND_SERVER_VERSION)] = queryBuildGetSerVerMsg;
2,706,578✔
1288
  queryBuildMsg[TMSG_INDEX(TDMT_MND_VIEW_META)] = queryBuildGetViewMetaMsg;
2,706,578✔
1289
  queryBuildMsg[TMSG_INDEX(TDMT_MND_GET_TABLE_TSMA)] = queryBuildGetTableTSMAMsg;
2,706,578✔
1290
  queryBuildMsg[TMSG_INDEX(TDMT_MND_GET_TSMA)] = queryBuildGetTSMAMsg;
2,706,578✔
1291
  queryBuildMsg[TMSG_INDEX(TDMT_MND_GET_RSMA)] = queryBuildGetRsmaMsg;
2,706,578✔
1292
  queryBuildMsg[TMSG_INDEX(TDMT_MND_GET_STREAM_PROGRESS)] = queryBuildGetStreamProgressMsg;
2,706,578✔
1293
  queryBuildMsg[TMSG_INDEX(TDMT_VND_VSUBTABLES_META)] = queryBuildVSubTablesMsg;
2,706,578✔
1294
  queryBuildMsg[TMSG_INDEX(TDMT_VND_VSTB_REF_DBS)] = queryBuildVStbRefDBsMsg;
2,706,578✔
1295

1296
  queryProcessMsgRsp[TMSG_INDEX(TDMT_VND_TABLE_META)] = queryProcessTableMetaRsp;
2,706,578✔
1297
  queryProcessMsgRsp[TMSG_INDEX(TDMT_VND_TABLE_NAME)] = queryProcessTableNameRsp;
2,706,578✔
1298
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_TABLE_META)] = queryProcessTableMetaRsp;
2,706,578✔
1299
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_USE_DB)] = queryProcessUseDBRsp;
2,706,578✔
1300
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_QNODE_LIST)] = queryProcessQnodeListRsp;
2,706,578✔
1301
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_DNODE_LIST)] = queryProcessDnodeListRsp;
2,706,578✔
1302
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_GET_DB_CFG)] = queryProcessGetDbCfgRsp;
2,706,578✔
1303
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_GET_INDEX)] = queryProcessGetIndexRsp;
2,706,578✔
1304
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_RETRIEVE_FUNC)] = queryProcessRetrieveFuncRsp;
2,706,578✔
1305
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_GET_USER_AUTH)] = queryProcessGetUserAuthRsp;
2,706,578✔
1306
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_GET_TABLE_INDEX)] = queryProcessGetTbIndexRsp;
2,706,578✔
1307
  queryProcessMsgRsp[TMSG_INDEX(TDMT_VND_TABLE_CFG)] = queryProcessGetTbCfgRsp;
2,706,578✔
1308
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_TABLE_CFG)] = queryProcessGetTbCfgRsp;
2,706,578✔
1309
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_SERVER_VERSION)] = queryProcessGetSerVerRsp;
2,706,578✔
1310
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_VIEW_META)] = queryProcessGetViewMetaRsp;
2,706,578✔
1311
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_GET_TABLE_TSMA)] = queryProcessGetTbTSMARsp;
2,706,578✔
1312
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_GET_TSMA)] = queryProcessGetTbTSMARsp;
2,706,578✔
1313
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_GET_RSMA)] = queryProcessGetRsmaRsp;
2,706,578✔
1314
  queryProcessMsgRsp[TMSG_INDEX(TDMT_MND_GET_STREAM_PROGRESS)] = queryProcessStreamProgressRsp;
2,706,578✔
1315
  queryProcessMsgRsp[TMSG_INDEX(TDMT_VND_VSUBTABLES_META)] = queryProcessVSubTablesRsp;
2,706,578✔
1316
  queryProcessMsgRsp[TMSG_INDEX(TDMT_VND_VSTB_REF_DBS)] = queryProcessVStbRefDbsRsp;
2,706,578✔
1317
}
2,706,578✔
1318

1319
#pragma GCC diagnostic pop
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