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

taosdata / TDengine / #4944

30 Jan 2026 06:19AM UTC coverage: 66.849% (+0.1%) from 66.718%
#4944

push

travis-ci

web-flow
merge: from main to 3.0 #34453

1124 of 2018 new or added lines in 72 files covered. (55.7%)

13677 existing lines in 155 files now uncovered.

205211 of 306978 relevant lines covered (66.85%)

125657591.7 hits per line

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

65.56
/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) {
26,669,453✔
33
  QUERY_PARAM_CHECK(pOut);
26,669,453✔
34
  QUERY_PARAM_CHECK(usedbRsp);
26,669,453✔
35
  memcpy(pOut->db, usedbRsp->db, TSDB_DB_FNAME_LEN);
26,669,453✔
36
  pOut->dbId = usedbRsp->uid;
26,669,453✔
37

38
  pOut->dbVgroup = taosMemoryCalloc(1, sizeof(SDBVgInfo));
26,669,453✔
39
  if (NULL == pOut->dbVgroup) {
26,669,545✔
40
    return terrno;
×
41
  }
42

43
  pOut->dbVgroup->vgVersion = usedbRsp->vgVersion;
26,669,472✔
44
  pOut->dbVgroup->hashMethod = usedbRsp->hashMethod;
26,669,470✔
45
  pOut->dbVgroup->hashPrefix = usedbRsp->hashPrefix;
26,669,472✔
46
  pOut->dbVgroup->hashSuffix = usedbRsp->hashSuffix;
26,669,539✔
47
  pOut->dbVgroup->stateTs = usedbRsp->stateTs;
26,669,511✔
48
  pOut->dbVgroup->flags = usedbRsp->flags;
26,669,196✔
49

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

53
  if (usedbRsp->vgNum <= 0) {
26,669,124✔
54
    return TSDB_CODE_SUCCESS;
3,194,564✔
55
  }
56

57
  pOut->dbVgroup->vgHash =
46,949,252✔
58
      taosHashInit(usedbRsp->vgNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_ENTRY_LOCK);
46,028,449✔
59
  if (NULL == pOut->dbVgroup->vgHash) {
23,474,647✔
60
    return terrno;
×
61
  }
62

63
  for (int32_t i = 0; i < usedbRsp->vgNum; ++i) {
82,035,382✔
64
    SVgroupInfo *pVgInfo = taosArrayGet(usedbRsp->pVgroupInfos, i);
58,560,636✔
65
    pOut->dbVgroup->numOfTable += pVgInfo->numOfTable;
58,560,589✔
66
    qDebug("db:%s, vgId:%d, epNum:%d, current ep:%s:%u", usedbRsp->db, pVgInfo->vgId, pVgInfo->epSet.numOfEps,
58,560,723✔
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))) {
58,560,723✔
69
      return terrno;
×
70
    }
71
  }
72

73
  return TSDB_CODE_SUCCESS;
23,474,659✔
74
}
75

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

83
  STableInfoReq infoReq = {0};
45,123,409✔
84
  infoReq.option = pInput->option;
45,123,631✔
85
  infoReq.header.vgId = pInput->vgId;
45,123,675✔
86
  infoReq.autoCreateCtb = pInput->autoCreateCtb;
45,123,608✔
87

88
  if (pInput->dbFName) {
45,123,561✔
89
    tstrncpy(infoReq.dbFName, pInput->dbFName, TSDB_DB_FNAME_LEN);
45,123,444✔
90
  }
91
  tstrncpy(infoReq.tbName, pInput->tbName, TSDB_TABLE_NAME_LEN);
45,123,672✔
92

93
  int32_t bufLen = tSerializeSTableInfoReq(NULL, 0, &infoReq);
45,123,612✔
94
  void   *pBuf = (*mallcFp)(bufLen);
45,123,536✔
95
  if (NULL == pBuf) {
45,123,596✔
96
    return terrno;
×
97
  }
98
  int32_t ret = tSerializeSTableInfoReq(pBuf, bufLen, &infoReq);
45,123,596✔
99
  if (ret < 0) {
45,123,608✔
UNCOV
100
    if (freeFp) (*freeFp)(pBuf);
×
101
    return ret;
×
102
  }
103

104
  *msg = pBuf;
45,123,620✔
105
  *msgLen = bufLen;
45,123,596✔
106

107
  return TSDB_CODE_SUCCESS;
45,123,541✔
108
}
109

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

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

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

136
  *msg = pBuf;
22,086,685✔
137
  *msgLen = bufLen;
22,086,685✔
138

139
  return TSDB_CODE_SUCCESS;
22,086,685✔
140
}
141

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

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

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

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

162
  *msg = pBuf;
47,849✔
163
  *msgLen = bufLen;
47,849✔
164

165
  return TSDB_CODE_SUCCESS;
47,849✔
166
}
167

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

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

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

187
  *msg = pBuf;
38,818✔
188
  *msgLen = bufLen;
38,818✔
189

190
  return TSDB_CODE_SUCCESS;
38,818✔
191
}
192

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

198
  SServerVerReq req = {0};
×
199

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

211
  *msg = pBuf;
×
212
  *msgLen = bufLen;
×
213

214
  return TSDB_CODE_SUCCESS;
×
215
}
216

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

223
  SDbCfgReq dbCfgReq = {0};
4,614,791✔
224
  tstrncpy(dbCfgReq.db, input, TSDB_DB_FNAME_LEN);
4,614,807✔
225

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

237
  *msg = pBuf;
4,614,807✔
238
  *msgLen = bufLen;
4,614,807✔
239

240
  return TSDB_CODE_SUCCESS;
4,614,807✔
241
}
242

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

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

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

263
  *msg = pBuf;
×
264
  *msgLen = bufLen;
×
265

266
  return TSDB_CODE_SUCCESS;
×
267
}
268

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

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

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

300
  taosArrayDestroy(funcReq.pFuncNames);
291,275✔
301

302
  *msg = pBuf;
291,275✔
303
  *msgLen = bufLen;
291,275✔
304

305
  return TSDB_CODE_SUCCESS;
291,275✔
306
}
307

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

314
  SGetUserAuthReq req = {0};
5,738,019✔
315
  tstrncpy(req.user, input, TSDB_USER_LEN);
5,738,015✔
316

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

328
  *msg = pBuf;
5,738,019✔
329
  *msgLen = bufLen;
5,738,019✔
330

331
  return TSDB_CODE_SUCCESS;
5,738,019✔
332
}
333

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

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

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

354
  *msg = pBuf;
×
355
  *msgLen = bufLen;
×
356

357
  return TSDB_CODE_SUCCESS;
×
358
}
359

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

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

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

383
  *msg = pBuf;
83,535✔
384
  *msgLen = bufLen;
83,535✔
385

386
  return TSDB_CODE_SUCCESS;
83,535✔
387
}
388

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

395
  SViewMetaReq req = {0};
16,960,911✔
396
  tstrncpy(req.fullname, input, TSDB_VIEW_FNAME_LEN);
16,960,994✔
397

398
  int32_t bufLen = tSerializeSViewMetaReq(NULL, 0, &req);
16,960,994✔
399
  void   *pBuf = (*mallcFp)(bufLen);
16,960,950✔
400
  if (NULL == pBuf) {
16,960,992✔
401
    return terrno;
×
402
  }
403
  int32_t ret = tSerializeSViewMetaReq(pBuf, bufLen, &req);
16,960,992✔
404
  if (ret < 0) {
16,960,996✔
UNCOV
405
    if (freeFp) (*freeFp)(pBuf);
×
406
    return ret;
×
407
  }
408

409
  *msg = pBuf;
16,960,996✔
410
  *msgLen = bufLen;
16,960,996✔
411

412
  return TSDB_CODE_SUCCESS;
16,960,990✔
413
}
414

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

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

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

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

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

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

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

461
  *msg = pBuf;
×
462
  *msgLen = bufLen;
×
463
  return TSDB_CODE_SUCCESS;
×
464
}
465

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

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

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

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

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

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

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

509
  *msg = pBuf;
347,952✔
510
  *msgLen = len;
347,952✔
511
  return TSDB_CODE_SUCCESS;
347,952✔
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),
4,548,726✔
540
                                void (*freeFp)(void *)) {
541
  QUERY_PARAM_CHECK(input);
4,548,726✔
542
  QUERY_PARAM_CHECK(msg);
4,548,726✔
543
  QUERY_PARAM_CHECK(msgLen);
4,548,726✔
544

545
  SVStbRefDbsReq req = {0};
4,548,726✔
546
  req.suid = *(int64_t*)input;
4,548,726✔
547

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

558
  *msg = pBuf;
4,548,726✔
559
  *msgLen = bufLen;
4,548,726✔
560

561
  return TSDB_CODE_SUCCESS;
4,548,726✔
562
}
563

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

569
  if (NULL == output || NULL == msg || msgSize <= 0) {
21,975,480✔
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) {
21,975,510✔
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) {
21,975,480✔
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);
21,975,480✔
588
  for (int32_t i = 0; i < usedbRsp.vgNum; ++i) {
73,120,685✔
589
    SVgroupInfo *pInfo = taosArrayGet(usedbRsp.pVgroupInfos, i);
51,145,205✔
590
    qTrace("vgId:%d, numOfEps:%d inUse:%d ", pInfo->vgId, pInfo->epSet.numOfEps, pInfo->epSet.inUse);
51,145,205✔
591
    for (int32_t j = 0; j < pInfo->epSet.numOfEps; ++j) {
104,179,992✔
592
      qTrace("vgId:%d, index:%d epset:%s:%u", pInfo->vgId, j, pInfo->epSet.eps[j].fqdn, pInfo->epSet.eps[j].port);
53,034,817✔
593
    }
594
  }
595

596
  code = queryBuildUseDbOutput(pOut, &usedbRsp);
21,975,480✔
597

598
PROCESS_USEDB_OVER:
21,975,510✔
599

600
  if (code != 0) {
21,975,480✔
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);
21,975,480✔
609
  return code;
21,975,480✔
610
}
611

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

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

624
  if (pMetaMsg->tableType != TSDB_SUPER_TABLE && pMetaMsg->tableType != TSDB_CHILD_TABLE &&
35,747,634✔
625
      pMetaMsg->tableType != TSDB_NORMAL_TABLE && pMetaMsg->tableType != TSDB_SYSTEM_TABLE &&
5,306,002✔
626
      pMetaMsg->tableType != TSDB_VIRTUAL_NORMAL_TABLE && pMetaMsg->tableType != TSDB_VIRTUAL_CHILD_TABLE) {
290,312✔
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) {
35,748,303✔
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) {
35,748,267✔
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) {
35,746,405✔
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) {
35,746,441✔
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;
35,745,736✔
652
}
653

654
int32_t queryCreateCTableMetaFromMsg(STableMetaRsp *msg, SCTableMeta *pMeta) {
50,708,631✔
655
  QUERY_PARAM_CHECK(msg);
50,708,631✔
656
  QUERY_PARAM_CHECK(pMeta);
50,708,631✔
657
  pMeta->vgId = msg->vgId;
50,708,631✔
658
  pMeta->tableType = msg->tableType;
50,708,306✔
659
  pMeta->uid = msg->tuid;
50,698,375✔
660
  pMeta->suid = msg->suid;
50,709,603✔
661

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

665
  return TSDB_CODE_SUCCESS;
50,709,158✔
666
}
667

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

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

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

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

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

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

694
  *pMeta = pTableMeta;
394,397✔
695
  return TSDB_CODE_SUCCESS;
394,397✔
696
}
697

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

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

714
  pTableMeta->vgId = isStb ? 0 : msg->vgId;
50,865,113✔
715
  pTableMeta->tableType = isStb ? TSDB_SUPER_TABLE : msg->tableType;
50,863,511✔
716
  pTableMeta->uid = isStb ? msg->suid : msg->tuid;
50,864,131✔
717
  pTableMeta->suid = msg->suid;
50,863,123✔
718
  pTableMeta->sversion = msg->sversion;
50,865,113✔
719
  pTableMeta->tversion = msg->tversion;
50,865,113✔
720
  pTableMeta->rversion = msg->rversion;
50,864,493✔
721
  pTableMeta->ownerId = msg->ownerId;
50,864,756✔
722
  pTableMeta->flag = msg->flag;
50,863,743✔
723
  if (msg->virtualStb) {
50,864,462✔
724
    pTableMeta->virtualStb = 1;
417,933✔
725
    pTableMeta->numOfColRefs = 0;
417,933✔
726
  } else {
727
    if (msg->tableType == TSDB_VIRTUAL_CHILD_TABLE && isStb) {
50,444,307✔
728
      pTableMeta->virtualStb = 1;
175,436✔
729
      pTableMeta->numOfColRefs = 0;
175,436✔
730
    } else {
731
      pTableMeta->virtualStb = 0;
50,270,762✔
732
      pTableMeta->numOfColRefs = msg->numOfColRefs;
50,269,134✔
733
    }
734
  }
735

736
  pTableMeta->tableInfo.numOfTags = msg->numOfTags;
50,865,113✔
737
  pTableMeta->tableInfo.precision = msg->precision;
50,863,304✔
738
  pTableMeta->tableInfo.numOfColumns = msg->numOfColumns;
50,864,493✔
739

740
  memcpy(pTableMeta->schema, msg->pSchemas, sizeof(SSchema) * total);
50,863,842✔
741
  if (withExtSchema(msg->tableType) && msg->pSchemaExt) {
50,863,220✔
742
    pTableMeta->schemaExt = pSchemaExt;
48,456,644✔
743
    memcpy(pSchemaExt, msg->pSchemaExt, schemaExtSize);
48,457,233✔
744
  } else {
745
    pTableMeta->schemaExt = NULL;
2,408,469✔
746
  }
747

748
  if (hasRefCol(msg->tableType) && msg->pColRefs && !isStb) {
50,863,871✔
749
    pTableMeta->colRef = (SColRef *)((char *)pTableMeta + metaSize + schemaExtSize);
504,792✔
750
    memcpy(pTableMeta->colRef, msg->pColRefs, pColRefSize);
504,792✔
751
  } else {
752
    pTableMeta->colRef = NULL;
50,359,337✔
753
  }
754

755
  bool hasPK = (msg->numOfColumns > 1) && (pTableMeta->schema[1].flags & COL_IS_KEY);
50,864,751✔
756
  for (int32_t i = 0; i < msg->numOfColumns; ++i) {
2,147,483,647✔
757
    pTableMeta->tableInfo.rowSize += pTableMeta->schema[i].bytes;
2,147,483,647✔
758
    if (hasPK && (i > 0)) {
2,147,483,647✔
759
      if ((pTableMeta->schema[i].flags & COL_IS_KEY)) {
494,081✔
760
        ++pTableMeta->tableInfo.numOfPKs;
248,986✔
761
      } else {
762
        hasPK = false;
245,095✔
763
      }
764
    }
765
  }
766

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

774
  *pMeta = pTableMeta;
50,865,077✔
775
  return TSDB_CODE_SUCCESS;
50,865,046✔
776
}
777

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

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

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

806
  pTableMeta->tableInfo.numOfTags = msg->numOfTags;
157,685✔
807
  pTableMeta->tableInfo.precision = msg->precision;
157,685✔
808
  pTableMeta->tableInfo.numOfColumns = msg->numOfColumns;
157,685✔
809

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

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

825
  bool hasPK = (msg->numOfColumns > 1) && (pTableMeta->schema[1].flags & COL_IS_KEY);
157,685✔
826
  for (int32_t i = 0; i < msg->numOfColumns; ++i) {
512,479✔
827
    pTableMeta->tableInfo.rowSize += pTableMeta->schema[i].bytes;
354,794✔
828
    if (hasPK && (i > 0)) {
354,794✔
UNCOV
829
      if ((pTableMeta->schema[i].flags & COL_IS_KEY)) {
×
830
        ++pTableMeta->tableInfo.numOfPKs;
×
831
      } else {
UNCOV
832
        hasPK = false;
×
833
      }
834
    }
835
  }
836

837
  char *pTbName = (char *)pTableMeta + metaSize + schemaExtSize + pColRefSize;
157,685✔
838
  tstrncpy(pTbName, msg->tbName, tbNameSize);
157,685✔
839

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

847
  *pMeta = pTableMeta;
157,685✔
848
  return TSDB_CODE_SUCCESS;
157,685✔
849
}
850

851
int32_t queryProcessTableMetaRsp(void *output, char *msg, int32_t msgSize) {
35,590,618✔
852
  int32_t       code = 0;
35,590,618✔
853
  STableMetaRsp metaRsp = {0};
35,590,618✔
854

855
  if (NULL == output || NULL == msg || msgSize <= 0) {
35,590,618✔
UNCOV
856
    qError("queryProcessTableMetaRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
857
    code = TSDB_CODE_TSC_INVALID_INPUT;
×
858
    goto PROCESS_META_OVER;
×
859
  }
860

861
  if (tDeserializeSTableMetaRsp(msg, msgSize, &metaRsp) != 0) {
35,590,618✔
UNCOV
862
    code = TSDB_CODE_INVALID_MSG;
×
863
    goto PROCESS_META_OVER;
×
864
  }
865

866
  code = queryConvertTableMetaMsg(&metaRsp);
35,590,618✔
867
  if (code != TSDB_CODE_SUCCESS) {
35,588,051✔
UNCOV
868
    goto PROCESS_META_OVER;
×
869
  }
870

871
  bool isVirtual = (metaRsp.tableType == TSDB_VIRTUAL_NORMAL_TABLE ||
106,649,277✔
872
                    metaRsp.tableType == TSDB_VIRTUAL_CHILD_TABLE ||
70,886,412✔
873
                    metaRsp.virtualStb);
35,298,361✔
874
  if (!IS_SYS_DBNAME(metaRsp.dbFName) &&
35,588,051✔
875
      !tIsValidSchema(metaRsp.pSchemas, metaRsp.numOfColumns, metaRsp.numOfTags, isVirtual)) {
33,862,034✔
UNCOV
876
    code = TSDB_CODE_TSC_INVALID_VALUE;
×
877
    goto PROCESS_META_OVER;
×
878
  }
879

880
  STableMetaOutput *pOut = output;
35,589,636✔
881
  tstrncpy(pOut->dbFName, metaRsp.dbFName, TSDB_DB_FNAME_LEN);
35,589,636✔
882
  pOut->dbId = metaRsp.dbId;
35,590,618✔
883

884
  if (metaRsp.tableType == TSDB_CHILD_TABLE) {
35,589,016✔
885
    SET_META_TYPE_BOTH_TABLE(pOut->metaType);
11,979,036✔
886

887
    tstrncpy(pOut->ctbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
11,979,036✔
888
    tstrncpy(pOut->tbName, metaRsp.stbName, TSDB_TABLE_NAME_LEN);
11,979,398✔
889

890
    pOut->ctbMeta.vgId = metaRsp.vgId;
11,979,036✔
891
    pOut->ctbMeta.tableType = metaRsp.tableType;
11,978,987✔
892
    pOut->ctbMeta.uid = metaRsp.tuid;
11,979,318✔
893
    pOut->ctbMeta.suid = metaRsp.suid;
11,979,318✔
894

895
    code = queryCreateTableMetaFromMsg(&metaRsp, true, &pOut->tbMeta);
11,979,036✔
896
  } else if (metaRsp.tableType == TSDB_VIRTUAL_CHILD_TABLE) {
23,609,980✔
897
    SET_META_TYPE_BOTH_VTABLE(pOut->metaType);
175,436✔
898

899
    tstrncpy(pOut->ctbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
175,436✔
900
    tstrncpy(pOut->tbName, metaRsp.stbName, TSDB_TABLE_NAME_LEN);
175,436✔
901

902
    code = queryCreateVCTableMetaFromMsg(&metaRsp, &pOut->vctbMeta);
175,436✔
903
    if (TSDB_CODE_SUCCESS != code) {
175,436✔
UNCOV
904
      goto PROCESS_META_OVER;
×
905
    }
906
    code = queryCreateTableMetaFromMsg(&metaRsp, true, &pOut->tbMeta);
175,436✔
907
  } else {
908
    SET_META_TYPE_TABLE(pOut->metaType);
23,434,544✔
909
    tstrncpy(pOut->tbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
23,435,784✔
910
    code = queryCreateTableMetaFromMsg(&metaRsp, (metaRsp.tableType == TSDB_SUPER_TABLE), &pOut->tbMeta);
23,435,784✔
911
  }
912

913
PROCESS_META_OVER:
35,590,618✔
914
  if (code != 0) {
35,590,587✔
UNCOV
915
    qError("failed to process table meta rsp since %s", tstrerror(code));
×
916
  }
917

918
  tFreeSTableMetaRsp(&metaRsp);
35,590,587✔
919
  return code;
35,590,080✔
920
}
921

922
static int32_t queryProcessTableNameRsp(void *output, char *msg, int32_t msgSize) {
157,685✔
923
  int32_t       code = 0;
157,685✔
924
  STableMetaRsp metaRsp = {0};
157,685✔
925

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

932
  if (tDeserializeSTableMetaRsp(msg, msgSize, &metaRsp) != 0) {
157,685✔
UNCOV
933
    code = TSDB_CODE_INVALID_MSG;
×
934
    goto PROCESS_NAME_OVER;
×
935
  }
936

937
  code = queryConvertTableMetaMsg(&metaRsp);
157,685✔
938
  if (code != TSDB_CODE_SUCCESS) {
157,685✔
UNCOV
939
    goto PROCESS_NAME_OVER;
×
940
  }
941

942
  bool isVirtual = (metaRsp.tableType == TSDB_VIRTUAL_NORMAL_TABLE ||
473,055✔
943
                    metaRsp.tableType == TSDB_VIRTUAL_CHILD_TABLE ||
315,370✔
944
                    metaRsp.virtualStb);
157,685✔
945

946
  if (!IS_SYS_DBNAME(metaRsp.dbFName) &&
157,685✔
947
      !tIsValidSchema(metaRsp.pSchemas, metaRsp.numOfColumns, metaRsp.numOfTags, isVirtual)) {
157,685✔
UNCOV
948
    code = TSDB_CODE_TSC_INVALID_VALUE;
×
949
    goto PROCESS_NAME_OVER;
×
950
  }
951

952
  STableMetaOutput *pOut = output;
157,685✔
953
  tstrncpy(pOut->dbFName, metaRsp.dbFName, TSDB_DB_FNAME_LEN);
157,685✔
954
  pOut->dbId = metaRsp.dbId;
157,685✔
955

956
  if (metaRsp.tableType == TSDB_CHILD_TABLE) {
157,685✔
957
    SET_META_TYPE_BOTH_TABLE(pOut->metaType);
40,577✔
958

959
    tstrncpy(pOut->ctbName, metaRsp.tbName, TSDB_TABLE_NAME_LEN);
40,577✔
960
    tstrncpy(pOut->tbName, metaRsp.stbName, TSDB_TABLE_NAME_LEN);
40,577✔
961

962
    pOut->ctbMeta.vgId = metaRsp.vgId;
40,577✔
963
    pOut->ctbMeta.tableType = metaRsp.tableType;
40,577✔
964
    pOut->ctbMeta.uid = metaRsp.tuid;
40,577✔
965
    pOut->ctbMeta.suid = metaRsp.suid;
40,577✔
966

967
    code = queryCreateTableMetaExFromMsg(&metaRsp, true, &pOut->tbMeta);
40,577✔
968
  } else if (metaRsp.tableType == TSDB_VIRTUAL_CHILD_TABLE) {
117,108✔
UNCOV
969
    SET_META_TYPE_BOTH_VTABLE(pOut->metaType);
×
970

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

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

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

986
PROCESS_NAME_OVER:
157,685✔
987
  if (code != 0) {
157,685✔
UNCOV
988
    qError("failed to process table name rsp since %s", tstrerror(code));
×
989
  }
990

991
  tFreeSTableMetaRsp(&metaRsp);
157,685✔
992
  return code;
157,685✔
993
}
994

995
int32_t queryProcessQnodeListRsp(void *output, char *msg, int32_t msgSize) {
47,849✔
996
  SQnodeListRsp out = {0};
47,849✔
997
  int32_t       code = 0;
47,849✔
998

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

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

1012
  return code;
47,849✔
1013
}
1014

1015
int32_t queryProcessDnodeListRsp(void *output, char *msg, int32_t msgSize) {
38,818✔
1016
  SDnodeListRsp out = {0};
38,818✔
1017
  int32_t       code = 0;
38,818✔
1018

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

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

1031
  *(SArray **)output = out.dnodeList;
38,818✔
1032

1033
  return code;
38,818✔
1034
}
1035

UNCOV
1036
int32_t queryProcessGetSerVerRsp(void *output, char *msg, int32_t msgSize) {
×
1037
  SServerVerRsp out = {0};
×
1038
  int32_t       code = 0;
×
1039

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

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

UNCOV
1052
  *(char **)output = taosStrdup(out.ver);
×
1053
  if (NULL == *(char **)output) {
×
1054
    return terrno;
×
1055
  }
1056

UNCOV
1057
  return code;
×
1058
}
1059

1060
int32_t queryProcessGetDbCfgRsp(void *output, char *msg, int32_t msgSize) {
4,148,332✔
1061
  SDbCfgRsp out = {0};
4,148,332✔
1062

1063
  if (NULL == output || NULL == msg || msgSize <= 0) {
4,148,416✔
UNCOV
1064
    qError("queryProcessGetDbCfgRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
1065
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1066
  }
1067

1068
  if (tDeserializeSDbCfgRsp(msg, msgSize, &out) != 0) {
4,148,416✔
UNCOV
1069
    qError("tDeserializeSDbCfgRsp failed, msgSize:%d, dbCfgRsp:%lu", msgSize, sizeof(out));
×
1070
    return TSDB_CODE_INVALID_MSG;
×
1071
  }
1072

1073
  memcpy(output, &out, sizeof(out));
4,148,373✔
1074

1075
  return TSDB_CODE_SUCCESS;
4,148,332✔
1076
}
1077

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

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

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

UNCOV
1091
  memcpy(output, &out, sizeof(out));
×
1092

UNCOV
1093
  return TSDB_CODE_SUCCESS;
×
1094
}
1095

1096
int32_t queryProcessRetrieveFuncRsp(void *output, char *msg, int32_t msgSize) {
270,008✔
1097
  SRetrieveFuncRsp out = {0};
270,008✔
1098

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

1104
  if (tDeserializeSRetrieveFuncRsp(msg, msgSize, &out) != 0) {
270,008✔
UNCOV
1105
    qError("tDeserializeSRetrieveFuncRsp failed, msgSize:%d", msgSize);
×
1106
    return TSDB_CODE_INVALID_MSG;
×
1107
  }
1108

1109
  if (1 != out.numOfFuncs) {
270,008✔
UNCOV
1110
    qError("invalid func num returned, numOfFuncs:%d", out.numOfFuncs);
×
1111
    return TSDB_CODE_INVALID_MSG;
×
1112
  }
1113

1114
  SFuncInfo *funcInfo = taosArrayGet(out.pFuncInfos, 0);
270,008✔
1115

1116
  memcpy(output, funcInfo, sizeof(*funcInfo));
270,008✔
1117
  taosArrayDestroy(out.pFuncInfos);
270,008✔
1118
  taosArrayDestroy(out.pFuncExtraInfos);
270,008✔
1119

1120
  return TSDB_CODE_SUCCESS;
270,008✔
1121
}
1122

1123
int32_t queryProcessGetUserAuthRsp(void *output, char *msg, int32_t msgSize) {
5,736,951✔
1124
  if (NULL == output || NULL == msg || msgSize <= 0) {
5,736,951✔
UNCOV
1125
    qError("queryProcessGetUserAuthRsp: invalid input param, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
1126
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1127
  }
1128

1129
  if (tDeserializeSGetUserAuthRsp(msg, msgSize, (SGetUserAuthRsp *)output) != 0) {
5,736,951✔
1130
    qError("tDeserializeSGetUserAuthRsp failed, msgSize:%d", msgSize);
41✔
UNCOV
1131
    return TSDB_CODE_INVALID_MSG;
×
1132
  }
1133

1134
  return TSDB_CODE_SUCCESS;
5,736,867✔
1135
}
1136

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

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

UNCOV
1149
  return TSDB_CODE_SUCCESS;
×
1150
}
1151

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

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

1169
  *(STableCfgRsp **)output = out;
83,535✔
1170

1171
  return TSDB_CODE_SUCCESS;
83,535✔
1172
}
1173

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

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

1191
  qDebugL("view meta recved, dbFName:%s, view:%s, querySQL:%s", out->dbFName, out->name, out->querySql);
214,977✔
1192

1193
  *(SViewMetaRsp **)output = out;
214,977✔
1194

1195
  return TSDB_CODE_SUCCESS;
214,977✔
1196
}
1197

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

1204
  if (tDeserializeTableTSMAInfoRsp(msg, msgSize, output) != 0) {
347,952✔
UNCOV
1205
    qError("tDeserializeTbTSMARsp failed, msgSize:%d", msgSize);
×
1206
    return TSDB_CODE_INVALID_MSG;
×
1207
  }
1208

1209
  return TSDB_CODE_SUCCESS;
347,952✔
1210
}
1211

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

1218
  if (tDeserializeRsmaInfoRsp(msg, msgSize, output) != 0) {
16,537✔
UNCOV
1219
    qError("tDeserializeRsmaInfoRsp failed, msgSize:%d", msgSize);
×
1220
    return TSDB_CODE_INVALID_MSG;
×
1221
  }
1222

1223
  return TSDB_CODE_SUCCESS;
16,537✔
1224
}
1225

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

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

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

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

1255
int32_t queryProcessVStbRefDbsRsp(void* output, char* msg, int32_t msgSize) {
4,548,232✔
1256
  if (!output || !msg || msgSize <= 0) {
4,548,232✔
UNCOV
1257
    qError("queryProcessVStbRefDbsRsp input error, output:%p, msg:%p, msgSize:%d", output, msg, msgSize);
×
1258
    return TSDB_CODE_TSC_INVALID_INPUT;
×
1259
  }
1260

1261
  SVStbRefDbsRsp * pRsp = (SVStbRefDbsRsp*)output;
4,548,232✔
1262
  int32_t code = tDeserializeSVStbRefDbsRsp(msg, msgSize, pRsp);
4,548,232✔
1263
  if (code != 0) {
4,547,054✔
1264
    qError("tDeserializeSVStbRefDbsRsp failed, msgSize: %d, error:%d", msgSize, code);
4,894✔
UNCOV
1265
    return code;
×
1266
  }
1267

1268
  return TSDB_CODE_SUCCESS;
4,542,160✔
1269
}
1270

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

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

1317
#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