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

taosdata / TDengine / #5012

03 Apr 2026 03:59PM UTC coverage: 72.305% (+0.005%) from 72.3%
#5012

push

travis-ci

web-flow
merge: from main to 3.0 branch #35067

4053 of 5985 new or added lines in 68 files covered. (67.72%)

13105 existing lines in 173 files now uncovered.

257446 of 356056 relevant lines covered (72.3%)

131779375.07 hits per line

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

78.71
/source/dnode/vnode/src/meta/metaEntry.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 "meta.h"
17
#include "osMemPool.h"
18
#include "osMemory.h"
19
#include "tencode.h"
20
#include "tmsg.h"
21

22
static bool schemasHasTypeMod(const SSchema *pSchema, int32_t nCols) {
1,355,510,545✔
23
  for (int32_t i = 0; i < nCols; i++) {
2,147,483,647✔
24
    if (HAS_TYPE_MOD(pSchema + i)) {
2,147,483,647✔
25
      return true;
161,363,983✔
26
    }
27
  }
28
  return false;
1,194,786,016✔
29
}
30

31
static int32_t metaEncodeExtSchema(SEncoder* pCoder, const SMetaEntry* pME) {
223,083,504✔
32
  if (pME->pExtSchemas) {
223,083,504✔
33
    const SSchemaWrapper *pSchWrapper = NULL;
12,769,021✔
34
    bool                  hasTypeMods = false;
12,769,021✔
35
    if (pME->type == TSDB_SUPER_TABLE) {
12,769,021✔
36
      pSchWrapper = &pME->stbEntry.schemaRow;
12,666,308✔
37
    } else if (pME->type == TSDB_NORMAL_TABLE) {
106,212✔
38
      pSchWrapper = &pME->ntbEntry.schemaRow;
106,212✔
39
    } else {
40
      return 0;
×
41
    }
42
    hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
12,773,547✔
43

44
    for (int32_t i = 0; i < pSchWrapper->nCols && hasTypeMods; ++i) {
1,357,966,397✔
45
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->pExtSchemas[i].typeMod));
2,147,483,647✔
46
    }
47
  }
48
  return 0;
223,076,122✔
49
}
50

51
int meteEncodeColRefEntry(SEncoder *pCoder, const SMetaEntry *pME) {
2,048,304✔
52
  const SColRefWrapper *pw = &pME->colRef;
2,048,304✔
53
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
4,096,608✔
54
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
4,097,233✔
55
  uTrace("encode cols:%d", pw->nCols);
2,048,929✔
56

57
  for (int32_t i = 0; i < pw->nCols; i++) {
476,091,311✔
58
    SColRef *p = &pw->pColRef[i];
474,045,507✔
59
    TAOS_CHECK_RETURN(tEncodeI8(pCoder, p->hasRef));
948,091,639✔
60
    TAOS_CHECK_RETURN(tEncodeI16v(pCoder, p->id));
948,091,639✔
61
    if (p->hasRef) {
474,044,882✔
62
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refDbName));
628,244,703✔
63
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refTableName));
628,244,078✔
64
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refColName));
628,242,828✔
65
    }
66
  }
67

68
  // Encode tag references
69
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nTagRefs));
4,095,358✔
70
  for (int32_t i = 0; i < pw->nTagRefs; i++) {
2,048,304✔
71
    SColRef *p = &pw->pTagRef[i];
×
72
    TAOS_CHECK_RETURN(tEncodeI8(pCoder, p->hasRef));
×
73
    TAOS_CHECK_RETURN(tEncodeI16v(pCoder, p->id));
×
74
    if (p->hasRef) {
×
75
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refDbName));
×
76
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refTableName));
×
77
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refColName));
×
78
    }
79
  }
80

81
  return 0;
2,047,054✔
82
}
83

84
static int32_t metaDecodeExtSchemas(SDecoder* pDecoder, SMetaEntry* pME) {
1,294,852,611✔
85
  bool hasExtSchema = false;
1,294,852,611✔
86
  SSchemaWrapper* pSchWrapper = NULL;
1,294,852,611✔
87
  if (pME->type == TSDB_SUPER_TABLE) {
1,294,852,611✔
88
    pSchWrapper = &pME->stbEntry.schemaRow;
977,097,353✔
89
  } else if (pME->type == TSDB_NORMAL_TABLE) {
317,782,192✔
90
    pSchWrapper = &pME->ntbEntry.schemaRow;
317,865,360✔
91
  } else {
92
    return 0;
×
93
  }
94

95
  hasExtSchema = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
1,294,895,573✔
96
  if (hasExtSchema && pSchWrapper->nCols > 0) {
1,295,202,072✔
97
    pME->pExtSchemas = (SExtSchema*)tDecoderMalloc(pDecoder, sizeof(SExtSchema) * pSchWrapper->nCols);
303,553,752✔
98
    if (pME->pExtSchemas == NULL) {
151,776,350✔
99
      return terrno;
×
100
    }
101

102
    for (int32_t i = 0; i < pSchWrapper->nCols && hasExtSchema; i++) {
2,147,483,647✔
103
      TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pME->pExtSchemas[i].typeMod));
2,147,483,647✔
104
    }
105
  } else {
106
    pME->pExtSchemas = NULL;
1,143,424,402✔
107
  }
108

109
  return 0;
1,295,171,866✔
110
}
111

112
SExtSchema* metaGetSExtSchema(const SMetaEntry *pME) {
47,909,777✔
113
  const SSchemaWrapper *pSchWrapper = NULL;
47,909,777✔
114
  bool                  hasTypeMods = false;
47,909,777✔
115
  if (pME->type == TSDB_SUPER_TABLE) {
47,909,777✔
116
    pSchWrapper = &pME->stbEntry.schemaRow;
34,790,422✔
117
  } else if (pME->type == TSDB_NORMAL_TABLE) {
13,152,280✔
118
    pSchWrapper = &pME->ntbEntry.schemaRow;
13,157,873✔
119
  } else {
120
    return NULL;
×
121
  }
122
  hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
47,950,075✔
123

124
  if (hasTypeMods) {
47,917,743✔
125
    SExtSchema *ret = taosMemoryMalloc(sizeof(SExtSchema) * pSchWrapper->nCols);
29,345✔
126
    if (ret != NULL) {
29,345✔
127
      memcpy(ret, pME->pExtSchemas, pSchWrapper->nCols * sizeof(SExtSchema));
29,345✔
128
    }
129
    return ret;
29,345✔
130
  }
131
  return NULL;
47,888,398✔
132
}
133

134
int32_t metaGetRsmaSchema(const SMetaEntry *pME, SSchemaRsma **rsmaSchema) {
28,453✔
135
  if (!rsmaSchema) return 0;
28,453✔
136
  if ((pME->type != TSDB_SUPER_TABLE) || !TABLE_IS_ROLLUP(pME->flags)) {  // only support super table
28,453✔
137
    *rsmaSchema = NULL;
×
138
    return 0;
×
139
  }
140

141
  const SRSmaParam *pParam = &pME->stbEntry.rsmaParam;
28,453✔
142
  const SSchema    *pSchema = pME->stbEntry.schemaRow.pSchema;
28,453✔
143
  int32_t           nCols = pME->stbEntry.schemaRow.nCols;
28,453✔
144

145
  *rsmaSchema = (SSchemaRsma *)taosMemoryMalloc(sizeof(SSchemaRsma));
28,453✔
146
  if (*rsmaSchema == NULL) {
28,453✔
147
    return terrno;
×
148
  }
149

150
  (*rsmaSchema)->funcIds = taosMemoryMalloc(sizeof(func_id_t) * nCols);
28,453✔
151
  if ((*rsmaSchema)->funcIds == NULL) {
28,453✔
152
    taosMemoryFree(*rsmaSchema);
×
153
    *rsmaSchema = NULL;
×
154
    return terrno;
×
155
  }
156

157
  (void)snprintf((*rsmaSchema)->tbName, TSDB_TABLE_NAME_LEN, "%s", pME->name);
28,453✔
158
  (*rsmaSchema)->tbUid = pME->uid;
28,453✔
159
  (*rsmaSchema)->tbType = pME->type;
28,453✔
160
  (*rsmaSchema)->interval[0] = pParam->interval[0];
28,453✔
161
  (*rsmaSchema)->interval[1] = pParam->interval[1];
28,453✔
162
  (*rsmaSchema)->nFuncs = nCols;
28,453✔
163

164
  func_id_t *pFuncIds = (*rsmaSchema)->funcIds;
28,453✔
165
  int32_t    i = 0, j = 0;
28,453✔
166
  for (i = 0; i < nCols; ++i) {
215,320✔
167
    while (j < pParam->nFuncs) {
339,898✔
168
      if (pParam->funcColIds[j] == pSchema[i].colId) {
326,056✔
169
        pFuncIds[i] = pParam->funcIds[j];
152,262✔
170
        break;
152,262✔
171
      }
172
      if (pParam->funcColIds[j] > pSchema[i].colId) {
173,794✔
173
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
34,605✔
174
        break;
34,605✔
175
      }
176
      ++j;
139,189✔
177
    }
178
    if (j >= pParam->nFuncs) {
200,709✔
179
      for (; i < nCols; ++i) {
27,684✔
180
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
13,842✔
181
      }
182
      break;
13,842✔
183
    }
184
  }
185
  pFuncIds[0] = 0;  // Primary TS column has no function
28,453✔
186

187
  return 0;
28,453✔
188
}
189

190
int meteDecodeColRefEntry(SDecoder *pDecoder, SMetaEntry *pME) {
42,786,278✔
191
  SColRefWrapper *pWrapper = &pME->colRef;
42,786,278✔
192
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
85,701,652✔
193
  if (pWrapper->nCols == 0) {
42,851,739✔
194
    return 0;
×
195
  }
196

197
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->version));
85,700,692✔
198
  uDebug("decode cols:%d", pWrapper->nCols);
42,853,654✔
199
  pWrapper->pColRef = (SColRef *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColRef));
85,708,181✔
200
  if (pWrapper->pColRef == NULL) {
42,853,698✔
201
    return terrno;
×
202
  }
203

204
  for (int i = 0; i < pWrapper->nCols; i++) {
734,777,879✔
205
    SColRef *p = &pWrapper->pColRef[i];
691,933,747✔
206
    TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&p->hasRef));
1,383,876,824✔
207
    TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &p->id));
1,383,892,247✔
208
    if (p->hasRef) {
691,944,034✔
209
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refDbName));
392,833,579✔
210
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refTableName));
392,831,274✔
211
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refColName));
392,833,236✔
212
    }
213
  }
214

215
  // Decode tag references (backward compatible)
216
  pWrapper->nTagRefs = 0;
42,816,003✔
217
  pWrapper->pTagRef = NULL;
42,862,285✔
218
  if (!tDecodeIsEnd(pDecoder)) {
42,862,894✔
219
    TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nTagRefs));
85,715,311✔
220
    if (pWrapper->nTagRefs > 0) {
42,853,670✔
221
      pWrapper->pTagRef = (SColRef *)tDecoderMalloc(pDecoder, pWrapper->nTagRefs * sizeof(SColRef));
×
222
      if (pWrapper->pTagRef == NULL) {
×
223
        return terrno;
×
224
      }
225

226
      for (int i = 0; i < pWrapper->nTagRefs; i++) {
×
227
        SColRef *p = &pWrapper->pTagRef[i];
×
228
        TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&p->hasRef));
×
229
        TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &p->id));
×
230
        if (p->hasRef) {
×
231
          TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refDbName));
×
232
          TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refTableName));
×
233
          TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refColName));
×
234
        }
235
      }
236
    }
237
  }
238

239
  return 0;
42,844,293✔
240
}
241

242
static FORCE_INLINE int32_t metatInitDefaultSColRefWrapper(SDecoder *pDecoder, SColRefWrapper *pRef,
243
                                                            SSchemaWrapper *pSchema) {
244
  pRef->nCols = pSchema->nCols;
×
245
  if ((pRef->pColRef = (SColRef *)tDecoderMalloc(pDecoder, pRef->nCols * sizeof(SColRef))) == NULL) {
×
246
    return terrno;
×
247
  }
248

249
  for (int32_t i = 0; i < pRef->nCols; i++) {
×
250
    SColRef  *pColRef = &pRef->pColRef[i];
×
251
    SSchema  *pColSchema = &pSchema->pSchema[i];
×
252
    pColRef->id = pColSchema->colId;
×
253
    pColRef->hasRef = false;
×
254
  }
255
  return 0;
×
256
}
257

258
static int32_t metaCloneColRef(const SColRefWrapper*pSrc, SColRefWrapper *pDst) {
1,298,130✔
259
  if (pSrc->nCols > 0) {
1,298,130✔
260
    pDst->nCols = pSrc->nCols;
1,298,755✔
261
    pDst->version = pSrc->version;
1,298,130✔
262
    pDst->pColRef = (SColRef*)taosMemoryCalloc(pSrc->nCols, sizeof(SColRef));
1,298,755✔
263
    if (NULL == pDst->pColRef) {
1,296,255✔
264
      return terrno;
×
265
    }
266
    memcpy(pDst->pColRef, pSrc->pColRef, pSrc->nCols * sizeof(SColRef));
1,297,505✔
267
  }
268
  return 0;
1,299,380✔
269
}
270

271
static int32_t metaEncodeComprEntryImpl(SEncoder *pCoder, SColCmprWrapper *pw) {
50,385,419✔
272
  int32_t code = 0;
50,385,419✔
273
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
100,748,718✔
274
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
100,837,444✔
275
  uTrace("encode cols:%d", pw->nCols);
50,474,145✔
276

277
  for (int32_t i = 0; i < pw->nCols; i++) {
2,147,483,647✔
278
    SColCmpr *p = &pw->pColCmpr[i];
2,147,483,647✔
279
    TAOS_CHECK_RETURN(tEncodeI16v(pCoder, p->id));
2,147,483,647✔
280
    TAOS_CHECK_RETURN(tEncodeU32(pCoder, p->alg));
2,147,483,647✔
281
  }
282
  return code;
50,510,387✔
283
}
284
int meteEncodeColCmprEntry(SEncoder *pCoder, const SMetaEntry *pME) {
50,216,347✔
285
  const SColCmprWrapper *pw = &pME->colCmpr;
50,216,347✔
286
  return metaEncodeComprEntryImpl(pCoder, (SColCmprWrapper *)pw);
50,235,581✔
287
}
288
int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
1,294,882,874✔
289
  SColCmprWrapper *pWrapper = &pME->colCmpr;
1,294,882,874✔
290
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
2,147,483,647✔
291
  if (pWrapper->nCols == 0) {
1,294,897,966✔
292
    return 0;
×
293
  }
294

295
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->version));
2,147,483,647✔
296
  uDebug("dencode cols:%d", pWrapper->nCols);
1,294,772,567✔
297
  pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
2,147,483,647✔
298
  if (pWrapper->pColCmpr == NULL) {
1,295,044,778✔
299
    return terrno;
×
300
  }
301

302
  for (int i = 0; i < pWrapper->nCols; i++) {
2,147,483,647✔
303
    SColCmpr *p = &pWrapper->pColCmpr[i];
2,147,483,647✔
304
    TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &p->id));
2,147,483,647✔
305
    TAOS_CHECK_RETURN(tDecodeU32(pDecoder, &p->alg));
2,147,483,647✔
306
  }
307
  return 0;
1,295,502,460✔
308
}
309
static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder, SColCmprWrapper *pCmpr,
310
                                                            SSchemaWrapper *pSchema) {
311
  pCmpr->nCols = pSchema->nCols;
267,948✔
312

313
  if (pDecoder == NULL) {
267,948✔
314
    pCmpr->pColCmpr = taosMemoryCalloc(1, pCmpr->nCols * sizeof(SColCmpr));
267,948✔
315
  } else {
316
    pCmpr->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pCmpr->nCols * sizeof(SColCmpr));
×
317
  }
318

319
  if (pCmpr->pColCmpr == NULL) {
267,948✔
320
    return terrno;
×
321
  }
322

323
  for (int32_t i = 0; i < pCmpr->nCols; i++) {
1,325,306✔
324
    SColCmpr *pColCmpr = &pCmpr->pColCmpr[i];
1,057,358✔
325
    SSchema  *pColSchema = &pSchema->pSchema[i];
1,057,358✔
326
    pColCmpr->id = pColSchema->colId;
1,057,358✔
327
    pColCmpr->alg = createDefaultColCmprByType(pColSchema->type);
1,057,358✔
328
  }
329
  return 0;
267,948✔
330
}
331

332
static int32_t metaCloneColCmpr(const SColCmprWrapper *pSrc, SColCmprWrapper *pDst) {
216,217,925✔
333
  if (pSrc->nCols > 0) {
216,217,925✔
334
    pDst->nCols = pSrc->nCols;
191,187,014✔
335
    pDst->version = pSrc->version;
191,195,904✔
336
    pDst->pColCmpr = (SColCmpr *)taosMemoryCalloc(pSrc->nCols, sizeof(SColCmpr));
191,175,567✔
337
    if (NULL == pDst->pColCmpr) {
191,150,355✔
338
      return terrno;
×
339
    }
340
    memcpy(pDst->pColCmpr, pSrc->pColCmpr, pSrc->nCols * sizeof(SColCmpr));
191,174,670✔
341
  }
342
  return 0;
216,248,648✔
343
}
344

345
static void metaCloneColRefFree(SColRefWrapper *pColRef) {
217,476,050✔
346
  if (pColRef) {
217,476,050✔
347
    taosMemoryFreeClear(pColRef->pColRef);
217,497,319✔
348
  }
349
}
217,500,099✔
350

351
static void metaCloneColCmprFree(SColCmprWrapper *pCmpr) {
217,504,621✔
352
  if (pCmpr) {
217,504,621✔
353
    taosMemoryFreeClear(pCmpr->pColCmpr);
217,520,025✔
354
  }
355
}
217,519,755✔
356

357
int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
228,771,885✔
358
  TAOS_CHECK_RETURN(tStartEncode(pCoder));
228,771,885✔
359
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->version));
457,581,816✔
360
  TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->type));
457,572,401✔
361
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->uid));
457,546,494✔
362

363
  if (pME->type > 0) {
228,754,407✔
364
    if (pME->name == NULL) {
223,041,065✔
365
      return TSDB_CODE_INVALID_PARA;
×
366
    }
367

368
    TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->name));
446,121,381✔
369

370
    if (pME->type == TSDB_SUPER_TABLE) {
223,069,359✔
371
      TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->flags));
54,815,283✔
372
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaRow));
54,878,636✔
373
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaTag));
54,874,829✔
374
      if (TABLE_IS_ROLLUP(pME->flags)) {
27,398,513✔
375
        TAOS_CHECK_RETURN(tEncodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
115,427✔
376
      }
377
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
195,636,156✔
378
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.btime));
343,499,329✔
379
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ctbEntry.ttlDays));
343,516,180✔
380
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ctbEntry.commentLen));
343,520,991✔
381
      if (pME->ctbEntry.commentLen > 0) {
171,759,819✔
382
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ctbEntry.comment));
30,872✔
383
      }
384
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.suid));
343,503,263✔
385
      TAOS_CHECK_RETURN(tEncodeTag(pCoder, (const STag *)pME->ctbEntry.pTags));
171,760,076✔
386
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
23,908,598✔
387
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.btime));
47,817,196✔
388
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ntbEntry.ttlDays));
47,817,196✔
389
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.commentLen));
47,817,196✔
390
      if (pME->ntbEntry.commentLen > 0) {
23,908,598✔
391
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ntbEntry.comment));
19,512✔
392
      }
393
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.ncid));
47,817,196✔
394
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->ntbEntry.schemaRow));
47,817,196✔
395
    } else if (pME->type == TSDB_TSMA_TABLE) {
×
396
      TAOS_CHECK_RETURN(tEncodeTSma(pCoder, pME->smaEntry.tsma));
×
397
    } else {
398
      metaError("meta/entry: invalide table type: %" PRId8 " encode failed.", pME->type);
×
399
      return TSDB_CODE_INVALID_PARA;
×
400
    }
401
    if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
223,056,670✔
402
      TAOS_CHECK_RETURN(meteEncodeColRefEntry(pCoder, pME));
2,132,807✔
403
    } else {
404
      if (pME->type == TSDB_SUPER_TABLE && TABLE_IS_COL_COMPRESSED(pME->flags)) {
220,993,817✔
405
        TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
27,426,936✔
406
      } else if (pME->type == TSDB_NORMAL_TABLE) {
193,590,627✔
407
        if (pME->colCmpr.nCols != 0) {
23,055,108✔
408
          TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
22,787,160✔
409
        } else {
410
          metaWarn("meta/entry: failed to get compress cols, type:%d", pME->type);
267,948✔
411
          SColCmprWrapper colCmprs = {0};
267,948✔
412
          int32_t code = metatInitDefaultSColCmprWrapper(NULL, &colCmprs, (SSchemaWrapper *)&pME->ntbEntry.schemaRow);
267,948✔
413
          if (code != 0) {
267,948✔
414
            taosMemoryFree(colCmprs.pColCmpr);
×
415
            TAOS_CHECK_RETURN(code);
×
416
          }
417
          code = metaEncodeComprEntryImpl(pCoder, &colCmprs);
267,948✔
418
          taosMemoryFree(colCmprs.pColCmpr);
267,948✔
419
          TAOS_CHECK_RETURN(code);
267,948✔
420
        }
421
      }
422
    }
423
    TAOS_CHECK_RETURN(metaEncodeExtSchema(pCoder, pME));
223,120,785✔
424
  }
425
  if (pME->type == TSDB_SUPER_TABLE) {
228,797,451✔
426
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->stbEntry.keep));
54,831,147✔
427
    TAOS_CHECK_RETURN(tEncodeI64v(pCoder, pME->stbEntry.ownerId));
54,788,186✔
428
  } else if (pME->type == TSDB_NORMAL_TABLE) {
201,309,712✔
429
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.ownerId));
46,110,216✔
430
  }
431

432
  tEndEncode(pCoder);
228,740,006✔
433
  return 0;
228,687,875✔
434
}
435

436
int metaDecodeEntryImpl(SDecoder *pCoder, SMetaEntry *pME, bool headerOnly) {
2,147,483,647✔
437
  TAOS_CHECK_RETURN(tStartDecode(pCoder));
2,147,483,647✔
438
  TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->version));
2,147,483,647✔
439
  TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pME->type));
2,147,483,647✔
440
  TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->uid));
2,147,483,647✔
441

442
  if (headerOnly) {
2,147,483,647✔
443
    tEndDecode(pCoder);
335,196✔
444
    return 0;
335,196✔
445
  }
446

447
  if (pME->type > 0) {
2,147,483,647✔
448
    TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->name));
2,147,483,647✔
449

450
    if (pME->type == TSDB_SUPER_TABLE) {
2,147,483,647✔
451
      TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pME->flags));
1,954,510,448✔
452
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaRow));
1,954,789,849✔
453
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaTag));
1,954,722,234✔
454
      if (TABLE_IS_ROLLUP(pME->flags)) {
977,297,285✔
455
        TAOS_CHECK_RETURN(tDecodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
353,221✔
456
      }
457
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
1,210,987,266✔
458
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.btime));
1,771,262,729✔
459
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ctbEntry.ttlDays));
1,771,478,277✔
460
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ctbEntry.commentLen));
1,771,261,546✔
461
      if (pME->ctbEntry.commentLen > 0) {
885,522,836✔
462
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ctbEntry.comment));
53,546✔
463
      }
464
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.suid));
1,771,219,123✔
465
      TAOS_CHECK_RETURN(tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags));
885,767,778✔
466
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
325,719,922✔
467
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.btime));
651,762,236✔
468
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ntbEntry.ttlDays));
651,892,540✔
469
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.commentLen));
651,746,354✔
470
      if (pME->ntbEntry.commentLen > 0) {
325,804,205✔
471
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ntbEntry.comment));
40,766✔
472
      }
473
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.ncid));
651,610,014✔
474
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->ntbEntry.schemaRow));
651,792,809✔
475
    } else if (pME->type == TSDB_TSMA_TABLE) {
×
476
      pME->smaEntry.tsma = tDecoderMalloc(pCoder, sizeof(STSma));
×
477
      if (!pME->smaEntry.tsma) {
×
478
        return terrno;
×
479
      }
480
      TAOS_CHECK_RETURN(tDecodeTSma(pCoder, pME->smaEntry.tsma, true));
×
481
    } else {
482
      metaError("meta/entry: invalide table type: %" PRId8 " decode failed.", pME->type);
×
483
      return TSDB_CODE_INVALID_PARA;
×
484
    }
485
    if (pME->type == TSDB_SUPER_TABLE) {
2,147,483,647✔
486
      if (TABLE_IS_COL_COMPRESSED(pME->flags)) {
977,388,466✔
487
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
977,371,913✔
488

489
        if (pME->colCmpr.nCols == 0) {
977,381,192✔
490
          TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->stbEntry.schemaRow));
×
491
        }
492
      } else {
493
        TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->stbEntry.schemaRow));
×
494
        TABLE_SET_COL_COMPRESSED(pME->flags);
×
495
      }
496
    } else if (pME->type == TSDB_NORMAL_TABLE) {
1,211,007,493✔
497
      if (!tDecodeIsEnd(pCoder)) {
317,935,967✔
498
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
317,957,658✔
499
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
317,957,658✔
500
        if (pME->colCmpr.nCols == 0) {
317,927,021✔
501
          TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->ntbEntry.schemaRow));
×
502
        }
503
      } else {
504
        uDebug("set default type: %d, tableName:%s", pME->type, pME->name);
×
505
        TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->ntbEntry.schemaRow));
×
506
      }
507
      TABLE_SET_COL_COMPRESSED(pME->flags);
317,918,764✔
508
    } else if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
893,227,429✔
509
      if (!tDecodeIsEnd(pCoder)) {
42,856,555✔
510
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
42,857,429✔
511
        TAOS_CHECK_RETURN(meteDecodeColRefEntry(pCoder, pME));
42,857,668✔
512
      } else {
UNCOV
513
        uDebug("set default type: %d, tableName:%s", pME->type, pME->name);
×
514
        if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
65✔
515
           TAOS_CHECK_RETURN(metatInitDefaultSColRefWrapper(pCoder, &pME->colRef, &pME->ntbEntry.schemaRow));
×
516
        }
517
      }
518
    }
519
    if (!tDecodeIsEnd(pCoder)) {
2,147,483,647✔
520
      TAOS_CHECK_RETURN(metaDecodeExtSchemas(pCoder, pME));
1,295,240,257✔
521
    } else {
522
      pME->pExtSchemas = NULL;
893,419,392✔
523
    }
524
  }
525
  if (pME->type == TSDB_SUPER_TABLE) {
2,147,483,647✔
526
    if (!tDecodeIsEnd(pCoder)) {
977,032,436✔
527
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->stbEntry.keep));
1,954,420,346✔
528
    }
529
    if (!tDecodeIsEnd(pCoder)) {
976,884,208✔
530
      TAOS_CHECK_RETURN(tDecodeI64v(pCoder, &pME->stbEntry.ownerId));
1,954,091,420✔
531
    }
532
  } else if (pME->type == TSDB_NORMAL_TABLE) {
1,210,872,021✔
533
    if (!tDecodeIsEnd(pCoder)) {
317,822,235✔
534
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.ownerId));
635,777,578✔
535
    }
536
  }
537

538

539
  tEndDecode(pCoder);
2,147,483,647✔
540
  return 0;
2,147,483,647✔
541
}
542

543
int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { return metaDecodeEntryImpl(pCoder, pME, false); }
2,147,483,647✔
544

545
static int32_t metaCloneSchema(const SSchemaWrapper *pSrc, SSchemaWrapper *pDst) {
373,765,512✔
546
  if (pSrc == NULL || pDst == NULL) {
373,765,512✔
547
    return TSDB_CODE_INVALID_PARA;
×
548
  }
549

550
  pDst->nCols = pSrc->nCols;
373,805,073✔
551
  pDst->version = pSrc->version;
373,791,737✔
552
  pDst->pSchema = (SSchema *)taosMemoryMalloc(pSrc->nCols * sizeof(SSchema));
373,739,242✔
553
  if (pDst->pSchema == NULL) {
373,706,211✔
554
    return terrno;
×
555
  }
556
  memcpy(pDst->pSchema, pSrc->pSchema, pSrc->nCols * sizeof(SSchema));
373,742,895✔
557
  return TSDB_CODE_SUCCESS;
373,825,937✔
558
}
559

560
static int32_t metaCloneRsmaParam(const SRSmaParam *pSrc, SRSmaParam *pDst) {
77,919✔
561
  if (pSrc == NULL || pDst == NULL) {
77,919✔
562
    return TSDB_CODE_INVALID_PARA;
×
563
  }
564
  memcpy(pDst, pSrc, sizeof(SRSmaParam));
77,919✔
565
  pDst->name = tstrdup(pSrc->name);
77,919✔
566
  if (pDst->name == NULL) {
77,919✔
567
    return terrno;
×
568
  }
569
  if (pSrc->nFuncs > 0) {
77,919✔
570
    pDst->nFuncs = pSrc->nFuncs;
77,919✔
571
    pDst->funcColIds = (col_id_t *)taosMemoryMalloc(pSrc->nFuncs * sizeof(col_id_t));
77,919✔
572
    if (pDst->funcColIds == NULL) {
77,919✔
573
      return terrno;
×
574
    }
575
    memcpy(pDst->funcColIds, pSrc->funcColIds, pSrc->nFuncs * sizeof(col_id_t));
77,919✔
576

577
    pDst->funcIds = (func_id_t *)taosMemoryMalloc(pSrc->nFuncs * sizeof(func_id_t));
77,919✔
578
    if (pDst->funcIds == NULL) {
77,919✔
579
      return terrno;
×
580
    }
581
    memcpy(pDst->funcIds, pSrc->funcIds, pSrc->nFuncs * sizeof(func_id_t));
77,919✔
582
  } else {
583
    pDst->nFuncs = 0;
×
584
    pDst->funcColIds = NULL;
×
585
    pDst->funcIds = NULL;
×
586
  }
587

588
  return TSDB_CODE_SUCCESS;
77,919✔
589
}
590

591
static void metaCloneSchemaFree(SSchemaWrapper *pSchema) {
373,752,195✔
592
  if (pSchema) {
373,752,195✔
593
    taosMemoryFreeClear(pSchema->pSchema);
373,769,833✔
594
  }
595
}
373,778,438✔
596

597
/**
598
 * @param type 0x01 free name
599
 */
600
void metaFreeRsmaParam(SRSmaParam *pParam, int8_t type) {
118,801✔
601
  if (pParam) {
118,801✔
602
    if ((type & 0x01)) {
118,801✔
603
      taosMemoryFreeClear(pParam->name);
118,801✔
604
    }
605
    taosMemoryFreeClear(pParam->funcColIds);
118,801✔
606
    taosMemoryFreeClear(pParam->funcIds);
118,801✔
607
  }
608
}
118,801✔
609

610
void metaCloneEntryFree(SMetaEntry **ppEntry) {
217,606,650✔
611
  if (ppEntry == NULL || *ppEntry == NULL) {
217,606,650✔
612
    return;
82,274✔
613
  }
614

615
  taosMemoryFreeClear((*ppEntry)->name);
217,541,668✔
616

617
  if ((*ppEntry)->type < 0) {
217,560,725✔
618
    taosMemoryFreeClear(*ppEntry);
×
619
    return;
×
620
  }
621

622
  if (TSDB_SUPER_TABLE == (*ppEntry)->type) {
217,484,463✔
623
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaRow);
182,103,690✔
624
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaTag);
182,092,654✔
625
    if (TABLE_IS_ROLLUP((*ppEntry)->flags)) {
182,101,184✔
626
      metaFreeRsmaParam(&(*ppEntry)->stbEntry.rsmaParam, 1);
118,801✔
627
    }
628
  } else if (TSDB_CHILD_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_CHILD_TABLE == (*ppEntry)->type) {
35,422,202✔
629
    taosMemoryFreeClear((*ppEntry)->ctbEntry.comment);
25,884,472✔
630
    taosMemoryFreeClear((*ppEntry)->ctbEntry.pTags);
25,881,794✔
631
  } else if (TSDB_NORMAL_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_NORMAL_TABLE == (*ppEntry)->type) {
9,548,173✔
632
    metaCloneSchemaFree(&(*ppEntry)->ntbEntry.schemaRow);
9,548,173✔
633
    taosMemoryFreeClear((*ppEntry)->ntbEntry.comment);
9,548,144✔
634
  } else {
635
    return;
×
636
  }
637
  metaCloneColCmprFree(&(*ppEntry)->colCmpr);
217,539,625✔
638
  taosMemoryFreeClear((*ppEntry)->pExtSchemas);
217,504,595✔
639
  metaCloneColRefFree(&(*ppEntry)->colRef);
217,512,850✔
640

641
  taosMemoryFreeClear(*ppEntry);
217,481,707✔
642
  return;
217,508,969✔
643
}
644

645
int32_t metaCloneEntry(const SMetaEntry *pEntry, SMetaEntry **ppEntry) {
217,512,458✔
646
  int32_t code = TSDB_CODE_SUCCESS;
217,512,458✔
647

648
  if (NULL == pEntry || NULL == ppEntry) {
217,512,458✔
649
    return TSDB_CODE_INVALID_PARA;
×
650
  }
651

652
  *ppEntry = (SMetaEntry *)taosMemoryCalloc(1, sizeof(SMetaEntry));
217,572,491✔
653
  if (NULL == *ppEntry) {
217,476,548✔
654
    return terrno;
×
655
  }
656

657
  (*ppEntry)->version = pEntry->version;
217,497,704✔
658
  (*ppEntry)->type = pEntry->type;
217,527,905✔
659
  (*ppEntry)->uid = pEntry->uid;
217,516,496✔
660

661
  if (pEntry->type < 0) {
217,547,803✔
662
    return TSDB_CODE_SUCCESS;
×
663
  }
664

665
  if (pEntry->name) {
217,516,861✔
666
    (*ppEntry)->name = tstrdup(pEntry->name);
217,529,801✔
667
    if (NULL == (*ppEntry)->name) {
217,555,991✔
668
      code = terrno;
47✔
669
      metaCloneEntryFree(ppEntry);
×
670
      return code;
×
671
    }
672
  }
673

674
  if (pEntry->type == TSDB_SUPER_TABLE) {
217,541,228✔
675
    (*ppEntry)->flags = pEntry->flags;
182,119,117✔
676

677
    code = metaCloneSchema(&pEntry->stbEntry.schemaRow, &(*ppEntry)->stbEntry.schemaRow);
182,078,817✔
678
    if (code) {
182,128,582✔
679
      metaCloneEntryFree(ppEntry);
×
680
      return code;
×
681
    }
682

683
    code = metaCloneSchema(&pEntry->stbEntry.schemaTag, &(*ppEntry)->stbEntry.schemaTag);
182,128,582✔
684
    if (code) {
182,153,892✔
685
      metaCloneEntryFree(ppEntry);
×
686
      return code;
×
687
    }
688
    if (TABLE_IS_ROLLUP(pEntry->flags)) {
182,153,892✔
689
      code = metaCloneRsmaParam(&pEntry->stbEntry.rsmaParam, &(*ppEntry)->stbEntry.rsmaParam);
77,919✔
690
      if (code) {
77,919✔
691
        metaCloneEntryFree(ppEntry);
×
692
        return code;
×
693
      }
694
    }
695
    (*ppEntry)->stbEntry.keep = pEntry->stbEntry.keep;
182,148,599✔
696
    (*ppEntry)->stbEntry.ownerId = pEntry->stbEntry.ownerId;
182,107,423✔
697
  } else if (pEntry->type == TSDB_CHILD_TABLE || pEntry->type == TSDB_VIRTUAL_CHILD_TABLE) {
35,421,183✔
698
    (*ppEntry)->ctbEntry.btime = pEntry->ctbEntry.btime;
25,878,762✔
699
    (*ppEntry)->ctbEntry.ttlDays = pEntry->ctbEntry.ttlDays;
25,875,861✔
700
    (*ppEntry)->ctbEntry.suid = pEntry->ctbEntry.suid;
25,880,770✔
701

702
    // comment
703
    (*ppEntry)->ctbEntry.commentLen = pEntry->ctbEntry.commentLen;
25,883,671✔
704
    if (pEntry->ctbEntry.commentLen > 0) {
25,881,529✔
705
      (*ppEntry)->ctbEntry.comment = taosMemoryMalloc(pEntry->ctbEntry.commentLen + 1);
9,115✔
706
      if (NULL == (*ppEntry)->ctbEntry.comment) {
9,115✔
707
        code = terrno;
×
708
        metaCloneEntryFree(ppEntry);
×
709
        return code;
×
710
      }
711
      memcpy((*ppEntry)->ctbEntry.comment, pEntry->ctbEntry.comment, pEntry->ctbEntry.commentLen + 1);
9,115✔
712
    }
713

714
    // tags
715
    STag *pTags = (STag *)pEntry->ctbEntry.pTags;
25,880,437✔
716
    (*ppEntry)->ctbEntry.pTags = taosMemoryCalloc(1, pTags->len);
25,871,086✔
717
    if (NULL == (*ppEntry)->ctbEntry.pTags) {
25,879,271✔
718
      code = terrno;
×
719
      metaCloneEntryFree(ppEntry);
×
720
      return code;
×
721
    }
722
    memcpy((*ppEntry)->ctbEntry.pTags, pEntry->ctbEntry.pTags, pTags->len);
25,873,559✔
723
  } else if (pEntry->type == TSDB_NORMAL_TABLE || pEntry->type == TSDB_VIRTUAL_NORMAL_TABLE) {
9,548,144✔
724
    (*ppEntry)->ntbEntry.btime = pEntry->ntbEntry.btime;
9,548,144✔
725
    (*ppEntry)->ntbEntry.ttlDays = pEntry->ntbEntry.ttlDays;
9,548,144✔
726
    (*ppEntry)->ntbEntry.ncid = pEntry->ntbEntry.ncid;
9,548,144✔
727
    (*ppEntry)->ntbEntry.ownerId = pEntry->ntbEntry.ownerId;
9,548,144✔
728

729
    // schema
730
    code = metaCloneSchema(&pEntry->ntbEntry.schemaRow, &(*ppEntry)->ntbEntry.schemaRow);
9,548,144✔
731
    if (code) {
9,548,144✔
732
      metaCloneEntryFree(ppEntry);
×
733
      return code;
×
734
    }
735

736
    // comment
737
    (*ppEntry)->ntbEntry.commentLen = pEntry->ntbEntry.commentLen;
9,548,173✔
738
    if (pEntry->ntbEntry.commentLen > 0) {
9,548,173✔
739
      (*ppEntry)->ntbEntry.comment = taosMemoryMalloc(pEntry->ntbEntry.commentLen + 1);
6,275✔
740
      if (NULL == (*ppEntry)->ntbEntry.comment) {
6,275✔
741
        code = terrno;
×
742
        metaCloneEntryFree(ppEntry);
×
743
        return code;
×
744
      }
745
      memcpy((*ppEntry)->ntbEntry.comment, pEntry->ntbEntry.comment, pEntry->ntbEntry.commentLen + 1);
6,275✔
746
    }
747
  } else {
748
    return TSDB_CODE_INVALID_PARA;
×
749
  }
750

751
  if (pEntry->type == TSDB_VIRTUAL_NORMAL_TABLE || pEntry->type == TSDB_VIRTUAL_CHILD_TABLE) {
217,551,996✔
752
    code = metaCloneColRef(&pEntry->colRef, &(*ppEntry)->colRef);
1,363,809✔
753
    if (code) {
1,298,755✔
754
      metaCloneEntryFree(ppEntry);
×
755
      return code;
×
756
    }
757
  } else {
758
    code = metaCloneColCmpr(&pEntry->colCmpr, &(*ppEntry)->colCmpr);
216,203,376✔
759
    if (code) {
216,243,029✔
760
      metaCloneEntryFree(ppEntry);
×
761
      return code;
×
762
    }
763
  }
764
  if (pEntry->pExtSchemas && pEntry->colCmpr.nCols > 0) {
217,541,784✔
765
    (*ppEntry)->pExtSchemas = taosMemoryCalloc(pEntry->colCmpr.nCols, sizeof(SExtSchema));
10,045,262✔
766
    if (!(*ppEntry)->pExtSchemas) {
10,047,600✔
767
      code = terrno;
×
768
      metaCloneEntryFree(ppEntry);
×
769
      return code;
×
770
    }
771
    memcpy((*ppEntry)->pExtSchemas, pEntry->pExtSchemas, sizeof(SExtSchema) * pEntry->colCmpr.nCols);
10,040,790✔
772
  }
773

774
  return code;
217,526,835✔
775
}
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