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

taosdata / TDengine / #5003

26 Mar 2026 12:51PM UTC coverage: 72.317% (-0.4%) from 72.671%
#5003

push

travis-ci

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

513 of 851 new or added lines in 47 files covered. (60.28%)

561 existing lines in 135 files now uncovered.

253860 of 351039 relevant lines covered (72.32%)

132153090.56 hits per line

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

78.32
/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,197,341,707✔
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;
157,719,484✔
26
    }
27
  }
28
  return false;
1,044,160,633✔
29
}
30

31
static int32_t metaEncodeExtSchema(SEncoder* pCoder, const SMetaEntry* pME) {
206,228,052✔
32
  if (pME->pExtSchemas) {
206,228,052✔
33
    const SSchemaWrapper *pSchWrapper = NULL;
12,476,970✔
34
    bool                  hasTypeMods = false;
12,476,970✔
35
    if (pME->type == TSDB_SUPER_TABLE) {
12,476,970✔
36
      pSchWrapper = &pME->stbEntry.schemaRow;
12,357,932✔
37
    } else if (pME->type == TSDB_NORMAL_TABLE) {
117,108✔
38
      pSchWrapper = &pME->ntbEntry.schemaRow;
117,108✔
39
    } else {
40
      return 0;
×
41
    }
42
    hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
12,475,696✔
43

44
    for (int32_t i = 0; i < pSchWrapper->nCols && hasTypeMods; ++i) {
1,320,410,300✔
45
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->pExtSchemas[i].typeMod));
2,147,483,647✔
46
    }
47
  }
48
  return 0;
206,250,044✔
49
}
50

51
int meteEncodeColRefEntry(SEncoder *pCoder, const SMetaEntry *pME) {
1,931,992✔
52
  const SColRefWrapper *pw = &pME->colRef;
1,931,992✔
53
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
3,864,600✔
54
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
3,865,216✔
55
  uTrace("encode cols:%d", pw->nCols);
1,932,608✔
56

57
  for (int32_t i = 0; i < pw->nCols; i++) {
453,306,022✔
58
    SColRef *p = &pw->pColRef[i];
451,375,878✔
59
    TAOS_CHECK_RETURN(tEncodeI8(pCoder, p->hasRef));
902,752,988✔
60
    TAOS_CHECK_RETURN(tEncodeI16v(pCoder, p->id));
902,751,756✔
61
    if (p->hasRef) {
451,375,262✔
62
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refDbName));
598,375,876✔
63
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refTableName));
598,375,260✔
64
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refColName));
598,374,644✔
65
    }
66
  }
67

68
  // Encode tag references
69
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nTagRefs));
3,861,520✔
70
  for (int32_t i = 0; i < pw->nTagRefs; i++) {
1,930,760✔
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;
1,930,760✔
82
}
83

84
static int32_t metaDecodeExtSchemas(SDecoder* pDecoder, SMetaEntry* pME) {
1,138,309,070✔
85
  bool hasExtSchema = false;
1,138,309,070✔
86
  SSchemaWrapper* pSchWrapper = NULL;
1,138,309,070✔
87
  if (pME->type == TSDB_SUPER_TABLE) {
1,138,309,070✔
88
    pSchWrapper = &pME->stbEntry.schemaRow;
901,596,387✔
89
  } else if (pME->type == TSDB_NORMAL_TABLE) {
236,884,901✔
90
    pSchWrapper = &pME->ntbEntry.schemaRow;
236,930,622✔
91
  } else {
92
    return 0;
×
93
  }
94

95
  hasExtSchema = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
1,138,427,975✔
96
  if (hasExtSchema && pSchWrapper->nCols > 0) {
1,138,709,483✔
97
    pME->pExtSchemas = (SExtSchema*)tDecoderMalloc(pDecoder, sizeof(SExtSchema) * pSchWrapper->nCols);
296,746,874✔
98
    if (pME->pExtSchemas == NULL) {
148,378,828✔
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;
990,336,445✔
107
  }
108

109
  return 0;
1,138,702,743✔
110
}
111

112
SExtSchema* metaGetSExtSchema(const SMetaEntry *pME) {
46,658,648✔
113
  const SSchemaWrapper *pSchWrapper = NULL;
46,658,648✔
114
  bool                  hasTypeMods = false;
46,658,648✔
115
  if (pME->type == TSDB_SUPER_TABLE) {
46,658,648✔
116
    pSchWrapper = &pME->stbEntry.schemaRow;
34,090,307✔
117
  } else if (pME->type == TSDB_NORMAL_TABLE) {
12,595,046✔
118
    pSchWrapper = &pME->ntbEntry.schemaRow;
12,605,778✔
119
  } else {
120
    return NULL;
×
121
  }
122
  hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
46,691,104✔
123

124
  if (hasTypeMods) {
46,651,177✔
125
    SExtSchema *ret = taosMemoryMalloc(sizeof(SExtSchema) * pSchWrapper->nCols);
28,579✔
126
    if (ret != NULL) {
28,579✔
127
      memcpy(ret, pME->pExtSchemas, pSchWrapper->nCols * sizeof(SExtSchema));
28,579✔
128
    }
129
    return ret;
28,579✔
130
  }
131
  return NULL;
46,622,598✔
132
}
133

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

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

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

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

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

164
  func_id_t *pFuncIds = (*rsmaSchema)->funcIds;
27,861✔
165
  int32_t    i = 0, j = 0;
27,861✔
166
  for (i = 0; i < nCols; ++i) {
210,840✔
167
    while (j < pParam->nFuncs) {
332,826✔
168
      if (pParam->funcColIds[j] == pSchema[i].colId) {
319,272✔
169
        pFuncIds[i] = pParam->funcIds[j];
149,094✔
170
        break;
149,094✔
171
      }
172
      if (pParam->funcColIds[j] > pSchema[i].colId) {
170,178✔
173
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
33,885✔
174
        break;
33,885✔
175
      }
176
      ++j;
136,293✔
177
    }
178
    if (j >= pParam->nFuncs) {
196,533✔
179
      for (; i < nCols; ++i) {
27,108✔
180
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
13,554✔
181
      }
182
      break;
13,554✔
183
    }
184
  }
185
  pFuncIds[0] = 0;  // Primary TS column has no function
27,861✔
186

187
  return 0;
27,861✔
188
}
189

190
int meteDecodeColRefEntry(SDecoder *pDecoder, SMetaEntry *pME) {
40,318,620✔
191
  SColRefWrapper *pWrapper = &pME->colRef;
40,318,620✔
192
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
80,650,149✔
193
  if (pWrapper->nCols == 0) {
40,328,511✔
194
    return 0;
×
195
  }
196

197
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->version));
80,649,611✔
198
  uDebug("decode cols:%d", pWrapper->nCols);
40,331,622✔
199
  pWrapper->pColRef = (SColRef *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColRef));
80,658,469✔
200
  if (pWrapper->pColRef == NULL) {
40,327,895✔
201
    return terrno;
×
202
  }
203

204
  for (int i = 0; i < pWrapper->nCols; i++) {
683,425,667✔
205
    SColRef *p = &pWrapper->pColRef[i];
643,108,347✔
206
    TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&p->hasRef));
1,286,218,130✔
207
    TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &p->id));
1,286,250,092✔
208
    if (p->hasRef) {
643,142,134✔
209
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refDbName));
366,748,907✔
210
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refTableName));
366,748,067✔
211
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refColName));
366,748,788✔
212
    }
213
  }
214

215
  // Decode tag references (backward compatible)
216
  pWrapper->nTagRefs = 0;
40,257,031✔
217
  pWrapper->pTagRef = NULL;
40,335,260✔
218
  if (!tDecodeIsEnd(pDecoder)) {
40,334,026✔
219
    TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nTagRefs));
80,669,904✔
220
    if (pWrapper->nTagRefs > 0) {
40,334,644✔
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;
40,330,969✔
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,272,690✔
259
  if (pSrc->nCols > 0) {
1,272,690✔
260
    pDst->nCols = pSrc->nCols;
1,272,690✔
261
    pDst->version = pSrc->version;
1,273,306✔
262
    pDst->pColRef = (SColRef*)taosMemoryCalloc(pSrc->nCols, sizeof(SColRef));
1,273,306✔
263
    if (NULL == pDst->pColRef) {
1,272,690✔
264
      return terrno;
×
265
    }
266
    memcpy(pDst->pColRef, pSrc->pColRef, pSrc->nCols * sizeof(SColRef));
1,272,690✔
267
  }
268
  return 0;
1,273,306✔
269
}
270

271
static int32_t metaEncodeComprEntryImpl(SEncoder *pCoder, SColCmprWrapper *pw) {
48,001,993✔
272
  int32_t code = 0;
48,001,993✔
273
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
95,983,258✔
274
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
96,002,986✔
275
  uTrace("encode cols:%d", pw->nCols);
48,021,721✔
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;
48,068,432✔
283
}
284
int meteEncodeColCmprEntry(SEncoder *pCoder, const SMetaEntry *pME) {
47,775,684✔
285
  const SColCmprWrapper *pw = &pME->colCmpr;
47,775,684✔
286
  return metaEncodeComprEntryImpl(pCoder, (SColCmprWrapper *)pw);
47,794,924✔
287
}
288
int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
1,138,264,058✔
289
  SColCmprWrapper *pWrapper = &pME->colCmpr;
1,138,264,058✔
290
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
2,147,483,647✔
291
  if (pWrapper->nCols == 0) {
1,138,474,684✔
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,138,101,076✔
297
  pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
2,147,483,647✔
298
  if (pWrapper->pColCmpr == NULL) {
1,138,663,302✔
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,139,024,968✔
308
}
309
static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder, SColCmprWrapper *pCmpr,
310
                                                            SSchemaWrapper *pSchema) {
311
  pCmpr->nCols = pSchema->nCols;
255,850✔
312

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

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

323
  for (int32_t i = 0; i < pCmpr->nCols; i++) {
1,271,704✔
324
    SColCmpr *pColCmpr = &pCmpr->pColCmpr[i];
1,015,854✔
325
    SSchema  *pColSchema = &pSchema->pSchema[i];
1,015,854✔
326
    pColCmpr->id = pColSchema->colId;
1,015,854✔
327
    pColCmpr->alg = createDefaultColCmprByType(pColSchema->type);
1,015,854✔
328
  }
329
  return 0;
255,850✔
330
}
331

332
static int32_t metaCloneColCmpr(const SColCmprWrapper *pSrc, SColCmprWrapper *pDst) {
201,000,857✔
333
  if (pSrc->nCols > 0) {
201,000,857✔
334
    pDst->nCols = pSrc->nCols;
175,914,912✔
335
    pDst->version = pSrc->version;
175,908,647✔
336
    pDst->pColCmpr = (SColCmpr *)taosMemoryCalloc(pSrc->nCols, sizeof(SColCmpr));
175,894,856✔
337
    if (NULL == pDst->pColCmpr) {
175,886,169✔
338
      return terrno;
×
339
    }
340
    memcpy(pDst->pColCmpr, pSrc->pColCmpr, pSrc->nCols * sizeof(SColCmpr));
175,896,964✔
341
  }
342
  return 0;
200,996,660✔
343
}
344

345
static void metaCloneColRefFree(SColRefWrapper *pColRef) {
202,266,958✔
346
  if (pColRef) {
202,266,958✔
347
    taosMemoryFreeClear(pColRef->pColRef);
202,276,041✔
348
  }
349
}
202,277,832✔
350

351
static void metaCloneColCmprFree(SColCmprWrapper *pCmpr) {
202,266,742✔
352
  if (pCmpr) {
202,266,742✔
353
    taosMemoryFreeClear(pCmpr->pColCmpr);
202,282,764✔
354
  }
355
}
202,257,413✔
356

357
int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
211,625,877✔
358
  TAOS_CHECK_RETURN(tStartEncode(pCoder));
211,625,877✔
359
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->version));
423,276,581✔
360
  TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->type));
423,280,560✔
361
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->uid));
423,267,434✔
362

363
  if (pME->type > 0) {
211,622,096✔
364
    if (pME->name == NULL) {
206,250,377✔
365
      return TSDB_CODE_INVALID_PARA;
×
366
    }
367

368
    TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->name));
412,501,225✔
369

370
    if (pME->type == TSDB_SUPER_TABLE) {
206,261,178✔
371
      TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->flags));
52,584,612✔
372
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaRow));
52,625,217✔
373
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaTag));
52,646,193✔
374
      if (TABLE_IS_ROLLUP(pME->flags)) {
26,300,706✔
375
        TAOS_CHECK_RETURN(tEncodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
113,508✔
376
      }
377
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
179,930,796✔
378
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.btime));
314,788,390✔
379
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ctbEntry.ttlDays));
314,807,941✔
380
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ctbEntry.commentLen));
314,827,482✔
381
      if (pME->ctbEntry.commentLen > 0) {
157,413,563✔
382
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ctbEntry.comment));
29,888✔
383
      }
384
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.suid));
314,805,897✔
385
      TAOS_CHECK_RETURN(tEncodeTag(pCoder, (const STag *)pME->ctbEntry.pTags));
157,394,505✔
386
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
22,548,154✔
387
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.btime));
45,096,308✔
388
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ntbEntry.ttlDays));
45,096,308✔
389
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.commentLen));
45,096,308✔
390
      if (pME->ntbEntry.commentLen > 0) {
22,548,154✔
391
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ntbEntry.comment));
18,944✔
392
      }
393
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.ncid));
45,096,308✔
394
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->ntbEntry.schemaRow));
45,096,308✔
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) {
206,242,355✔
402
      TAOS_CHECK_RETURN(meteEncodeColRefEntry(pCoder, pME));
1,975,783✔
403
    } else {
404
      if (pME->type == TSDB_SUPER_TABLE && TABLE_IS_COL_COMPRESSED(pME->flags)) {
204,281,652✔
405
        TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
26,308,525✔
406
      } else if (pME->type == TSDB_NORMAL_TABLE) {
178,033,613✔
407
        if (pME->colCmpr.nCols != 0) {
21,740,460✔
408
          TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
21,484,610✔
409
        } else {
410
          metaWarn("meta/entry: failed to get compress cols, type:%d", pME->type);
255,850✔
411
          SColCmprWrapper colCmprs = {0};
255,850✔
412
          int32_t code = metatInitDefaultSColCmprWrapper(NULL, &colCmprs, (SSchemaWrapper *)&pME->ntbEntry.schemaRow);
255,850✔
413
          if (code != 0) {
255,850✔
414
            taosMemoryFree(colCmprs.pColCmpr);
×
415
            TAOS_CHECK_RETURN(code);
×
416
          }
417
          code = metaEncodeComprEntryImpl(pCoder, &colCmprs);
255,850✔
418
          taosMemoryFree(colCmprs.pColCmpr);
255,850✔
419
          TAOS_CHECK_RETURN(code);
255,850✔
420
        }
421
      }
422
    }
423
    TAOS_CHECK_RETURN(metaEncodeExtSchema(pCoder, pME));
206,280,420✔
424
  }
425
  if (pME->type == TSDB_SUPER_TABLE) {
211,622,384✔
426
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->stbEntry.keep));
52,594,152✔
427
    TAOS_CHECK_RETURN(tEncodeI64v(pCoder, pME->stbEntry.ownerId));
52,560,615✔
428
  } else if (pME->type == TSDB_NORMAL_TABLE) {
185,297,752✔
429
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.ownerId));
43,480,920✔
430
  }
431

432
  tEndEncode(pCoder);
211,599,482✔
433
  return 0;
211,595,657✔
434
}
435

436
int metaDecodeEntryImpl(SDecoder *pCoder, SMetaEntry *pME, bool headerOnly) {
1,957,816,596✔
437
  TAOS_CHECK_RETURN(tStartDecode(pCoder));
1,957,816,596✔
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) {
1,958,770,824✔
443
    tEndDecode(pCoder);
320,702✔
444
    return 0;
320,702✔
445
  }
446

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

450
    if (pME->type == TSDB_SUPER_TABLE) {
1,958,262,312✔
451
      TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pME->flags));
1,803,567,015✔
452
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaRow));
1,803,663,106✔
453
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaTag));
1,803,448,620✔
454
      if (TABLE_IS_ROLLUP(pME->flags)) {
901,649,614✔
455
        TAOS_CHECK_RETURN(tDecodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
346,680✔
456
      }
457
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
1,055,831,417✔
458
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.btime));
1,624,818,355✔
459
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ctbEntry.ttlDays));
1,624,913,339✔
460
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ctbEntry.commentLen));
1,624,627,382✔
461
      if (pME->ctbEntry.commentLen > 0) {
812,175,368✔
462
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ctbEntry.comment));
51,750✔
463
      }
464
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.suid));
1,624,691,039✔
465
      TAOS_CHECK_RETURN(tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags));
812,468,958✔
466
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
243,931,049✔
467
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.btime));
488,081,005✔
468
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ntbEntry.ttlDays));
488,240,529✔
469
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.commentLen));
488,122,402✔
470
      if (pME->ntbEntry.commentLen > 0) {
244,000,648✔
471
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ntbEntry.comment));
39,438✔
472
      }
473
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.ncid));
487,984,063✔
474
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->ntbEntry.schemaRow));
488,125,447✔
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) {
1,957,939,111✔
486
      if (TABLE_IS_COL_COMPRESSED(pME->flags)) {
901,772,347✔
487
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
901,797,851✔
488

489
        if (pME->colCmpr.nCols == 0) {
901,678,619✔
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,055,913,504✔
497
      if (!tDecodeIsEnd(pCoder)) {
236,996,241✔
498
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
237,025,185✔
499
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
237,025,185✔
500
        if (pME->colCmpr.nCols == 0) {
236,953,986✔
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);
237,046,612✔
508
    } else if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
818,905,820✔
509
      if (!tDecodeIsEnd(pCoder)) {
40,332,757✔
510
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
40,332,757✔
511
        TAOS_CHECK_RETURN(meteDecodeColRefEntry(pCoder, pME));
40,332,757✔
512
      } else {
UNCOV
513
        uDebug("set default type: %d, tableName:%s", pME->type, pME->name);
×
UNCOV
514
        if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
×
515
           TAOS_CHECK_RETURN(metatInitDefaultSColRefWrapper(pCoder, &pME->colRef, &pME->ntbEntry.schemaRow));
×
516
        }
517
      }
518
    }
519
    if (!tDecodeIsEnd(pCoder)) {
1,957,974,094✔
520
      TAOS_CHECK_RETURN(metaDecodeExtSchemas(pCoder, pME));
1,138,765,705✔
521
    } else {
522
      pME->pExtSchemas = NULL;
819,208,389✔
523
    }
524
  }
525
  if (pME->type == TSDB_SUPER_TABLE) {
1,957,832,361✔
526
    if (!tDecodeIsEnd(pCoder)) {
901,592,826✔
527
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->stbEntry.keep));
1,803,207,503✔
528
    }
529
    if (!tDecodeIsEnd(pCoder)) {
901,539,064✔
530
      TAOS_CHECK_RETURN(tDecodeI64v(pCoder, &pME->stbEntry.ownerId));
1,803,310,088✔
531
    }
532
  } else if (pME->type == TSDB_NORMAL_TABLE) {
1,055,710,163✔
533
    if (!tDecodeIsEnd(pCoder)) {
237,048,850✔
534
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.ownerId));
474,153,336✔
535
    }
536
  }
537

538

539
  tEndDecode(pCoder);
1,957,622,416✔
540
  return 0;
1,957,710,927✔
541
}
542

543
int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { return metaDecodeEntryImpl(pCoder, pME, false); }
1,957,745,688✔
544

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

550
  pDst->nCols = pSrc->nCols;
343,765,169✔
551
  pDst->version = pSrc->version;
343,752,425✔
552
  pDst->pSchema = (SSchema *)taosMemoryMalloc(pSrc->nCols * sizeof(SSchema));
343,737,366✔
553
  if (pDst->pSchema == NULL) {
343,648,592✔
554
    return terrno;
×
555
  }
556
  memcpy(pDst->pSchema, pSrc->pSchema, pSrc->nCols * sizeof(SSchema));
343,671,768✔
557
  return TSDB_CODE_SUCCESS;
343,770,405✔
558
}
559

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

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

588
  return TSDB_CODE_SUCCESS;
76,095✔
589
}
590

591
static void metaCloneSchemaFree(SSchemaWrapper *pSchema) {
343,735,361✔
592
  if (pSchema) {
343,735,361✔
593
    taosMemoryFreeClear(pSchema->pSchema);
343,743,562✔
594
  }
595
}
343,735,025✔
596

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

610
void metaCloneEntryFree(SMetaEntry **ppEntry) {
202,356,798✔
611
  if (ppEntry == NULL || *ppEntry == NULL) {
202,356,798✔
612
    return;
80,217✔
613
  }
614

615
  taosMemoryFreeClear((*ppEntry)->name);
202,281,559✔
616

617
  if ((*ppEntry)->type < 0) {
202,281,903✔
618
    taosMemoryFreeClear(*ppEntry);
×
619
    return;
×
620
  }
621

622
  if (TSDB_SUPER_TABLE == (*ppEntry)->type) {
202,258,441✔
623
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaRow);
167,349,703✔
624
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaTag);
167,345,201✔
625
    if (TABLE_IS_ROLLUP((*ppEntry)->flags)) {
167,348,281✔
626
      metaFreeRsmaParam(&(*ppEntry)->stbEntry.rsmaParam, 1);
115,272✔
627
    }
628
  } else if (TSDB_CHILD_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_CHILD_TABLE == (*ppEntry)->type) {
34,911,051✔
629
    taosMemoryFreeClear((*ppEntry)->ctbEntry.comment);
25,883,042✔
630
    taosMemoryFreeClear((*ppEntry)->ctbEntry.pTags);
25,883,408✔
631
  } else if (TSDB_NORMAL_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_NORMAL_TABLE == (*ppEntry)->type) {
9,029,079✔
632
    metaCloneSchemaFree(&(*ppEntry)->ntbEntry.schemaRow);
9,029,079✔
633
    taosMemoryFreeClear((*ppEntry)->ntbEntry.comment);
9,029,079✔
634
  } else {
635
    return;
×
636
  }
637
  metaCloneColCmprFree(&(*ppEntry)->colCmpr);
202,274,244✔
638
  taosMemoryFreeClear((*ppEntry)->pExtSchemas);
202,244,909✔
639
  metaCloneColRefFree(&(*ppEntry)->colRef);
202,251,721✔
640

641
  taosMemoryFreeClear(*ppEntry);
202,250,432✔
642
  return;
202,253,700✔
643
}
644

645
int32_t metaCloneEntry(const SMetaEntry *pEntry, SMetaEntry **ppEntry) {
202,253,397✔
646
  int32_t code = TSDB_CODE_SUCCESS;
202,253,397✔
647

648
  if (NULL == pEntry || NULL == ppEntry) {
202,253,397✔
649
    return TSDB_CODE_INVALID_PARA;
×
650
  }
651

652
  *ppEntry = (SMetaEntry *)taosMemoryCalloc(1, sizeof(SMetaEntry));
202,286,321✔
653
  if (NULL == *ppEntry) {
202,210,161✔
654
    return terrno;
×
655
  }
656

657
  (*ppEntry)->version = pEntry->version;
202,232,855✔
658
  (*ppEntry)->type = pEntry->type;
202,271,698✔
659
  (*ppEntry)->uid = pEntry->uid;
202,262,764✔
660

661
  if (pEntry->type < 0) {
202,277,392✔
662
    return TSDB_CODE_SUCCESS;
×
663
  }
664

665
  if (pEntry->name) {
202,252,152✔
666
    (*ppEntry)->name = tstrdup(pEntry->name);
202,279,716✔
667
    if (NULL == (*ppEntry)->name) {
202,281,396✔
668
      code = terrno;
×
669
      metaCloneEntryFree(ppEntry);
×
670
      return code;
×
671
    }
672
  }
673

674
  if (pEntry->type == TSDB_SUPER_TABLE) {
202,272,733✔
675
    (*ppEntry)->flags = pEntry->flags;
167,364,536✔
676

677
    code = metaCloneSchema(&pEntry->stbEntry.schemaRow, &(*ppEntry)->stbEntry.schemaRow);
167,351,507✔
678
    if (code) {
167,362,118✔
679
      metaCloneEntryFree(ppEntry);
×
680
      return code;
×
681
    }
682

683
    code = metaCloneSchema(&pEntry->stbEntry.schemaTag, &(*ppEntry)->stbEntry.schemaTag);
167,362,118✔
684
    if (code) {
167,377,420✔
685
      metaCloneEntryFree(ppEntry);
×
686
      return code;
×
687
    }
688
    if (TABLE_IS_ROLLUP(pEntry->flags)) {
167,377,420✔
689
      code = metaCloneRsmaParam(&pEntry->stbEntry.rsmaParam, &(*ppEntry)->stbEntry.rsmaParam);
76,095✔
690
      if (code) {
76,095✔
691
        metaCloneEntryFree(ppEntry);
×
692
        return code;
×
693
      }
694
    }
695
    (*ppEntry)->stbEntry.keep = pEntry->stbEntry.keep;
167,378,046✔
696
    (*ppEntry)->stbEntry.ownerId = pEntry->stbEntry.ownerId;
167,363,134✔
697
  } else if (pEntry->type == TSDB_CHILD_TABLE || pEntry->type == TSDB_VIRTUAL_CHILD_TABLE) {
34,911,821✔
698
    (*ppEntry)->ctbEntry.btime = pEntry->ctbEntry.btime;
25,883,408✔
699
    (*ppEntry)->ctbEntry.ttlDays = pEntry->ctbEntry.ttlDays;
25,883,084✔
700
    (*ppEntry)->ctbEntry.suid = pEntry->ctbEntry.suid;
25,883,084✔
701

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

714
    // tags
715
    STag *pTags = (STag *)pEntry->ctbEntry.pTags;
25,883,084✔
716
    (*ppEntry)->ctbEntry.pTags = taosMemoryCalloc(1, pTags->len);
25,883,084✔
717
    if (NULL == (*ppEntry)->ctbEntry.pTags) {
25,883,042✔
718
      code = terrno;
×
719
      metaCloneEntryFree(ppEntry);
×
720
      return code;
×
721
    }
722
    memcpy((*ppEntry)->ctbEntry.pTags, pEntry->ctbEntry.pTags, pTags->len);
25,882,713✔
723
  } else if (pEntry->type == TSDB_NORMAL_TABLE || pEntry->type == TSDB_VIRTUAL_NORMAL_TABLE) {
9,028,413✔
724
    (*ppEntry)->ntbEntry.btime = pEntry->ntbEntry.btime;
9,028,413✔
725
    (*ppEntry)->ntbEntry.ttlDays = pEntry->ntbEntry.ttlDays;
9,029,079✔
726
    (*ppEntry)->ntbEntry.ncid = pEntry->ntbEntry.ncid;
9,029,079✔
727
    (*ppEntry)->ntbEntry.ownerId = pEntry->ntbEntry.ownerId;
9,029,079✔
728

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

736
    // comment
737
    (*ppEntry)->ntbEntry.commentLen = pEntry->ntbEntry.commentLen;
9,029,079✔
738
    if (pEntry->ntbEntry.commentLen > 0) {
9,029,079✔
739
      (*ppEntry)->ntbEntry.comment = taosMemoryMalloc(pEntry->ntbEntry.commentLen + 1);
6,091✔
740
      if (NULL == (*ppEntry)->ntbEntry.comment) {
6,091✔
741
        code = terrno;
×
742
        metaCloneEntryFree(ppEntry);
×
743
        return code;
×
744
      }
745
      memcpy((*ppEntry)->ntbEntry.comment, pEntry->ntbEntry.comment, pEntry->ntbEntry.commentLen + 1);
6,091✔
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) {
202,270,428✔
752
    code = metaCloneColRef(&pEntry->colRef, &(*ppEntry)->colRef);
1,280,263✔
753
    if (code) {
1,273,306✔
754
      metaCloneEntryFree(ppEntry);
×
755
      return code;
×
756
    }
757
  } else {
758
    code = metaCloneColCmpr(&pEntry->colCmpr, &(*ppEntry)->colCmpr);
201,005,320✔
759
    if (code) {
200,989,157✔
760
      metaCloneEntryFree(ppEntry);
×
761
      return code;
×
762
    }
763
  }
764
  if (pEntry->pExtSchemas && pEntry->colCmpr.nCols > 0) {
202,262,481✔
765
    (*ppEntry)->pExtSchemas = taosMemoryCalloc(pEntry->colCmpr.nCols, sizeof(SExtSchema));
9,802,015✔
766
    if (!(*ppEntry)->pExtSchemas) {
9,798,111✔
767
      code = terrno;
×
768
      metaCloneEntryFree(ppEntry);
×
769
      return code;
×
770
    }
771
    memcpy((*ppEntry)->pExtSchemas, pEntry->pExtSchemas, sizeof(SExtSchema) * pEntry->colCmpr.nCols);
9,793,105✔
772
  }
773

774
  return code;
202,272,603✔
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