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

taosdata / TDengine / #5006

29 Mar 2026 04:32AM UTC coverage: 72.274% (+0.1%) from 72.152%
#5006

push

travis-ci

web-flow
refactor: do some internal refactor for TDgpt. (#34955)

253711 of 351039 relevant lines covered (72.27%)

131490495.89 hits per line

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

79.1
/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,215,212,678✔
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;
158,128,358✔
26
    }
27
  }
28
  return false;
1,056,007,635✔
29
}
30

31
static int32_t metaEncodeExtSchema(SEncoder* pCoder, const SMetaEntry* pME) {
206,164,566✔
32
  if (pME->pExtSchemas) {
206,164,566✔
33
    const SSchemaWrapper *pSchWrapper = NULL;
12,425,596✔
34
    bool                  hasTypeMods = false;
12,425,596✔
35
    if (pME->type == TSDB_SUPER_TABLE) {
12,425,596✔
36
      pSchWrapper = &pME->stbEntry.schemaRow;
12,324,471✔
37
    } else if (pME->type == TSDB_NORMAL_TABLE) {
96,282✔
38
      pSchWrapper = &pME->ntbEntry.schemaRow;
96,282✔
39
    } else {
40
      return 0;
×
41
    }
42
    hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
12,417,482✔
43

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

51
int meteEncodeColRefEntry(SEncoder *pCoder, const SMetaEntry *pME) {
1,911,508✔
52
  const SColRefWrapper *pw = &pME->colRef;
1,911,508✔
53
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
3,823,016✔
54
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
3,822,403✔
55
  uTrace("encode cols:%d", pw->nCols);
1,910,895✔
56

57
  for (int32_t i = 0; i < pw->nCols; i++) {
466,426,983✔
58
    SColRef *p = &pw->pColRef[i];
464,516,088✔
59
    TAOS_CHECK_RETURN(tEncodeI8(pCoder, p->hasRef));
929,031,563✔
60
    TAOS_CHECK_RETURN(tEncodeI16v(pCoder, p->id));
929,031,563✔
61
    if (p->hasRef) {
464,516,088✔
62
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refDbName));
615,948,871✔
63
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refTableName));
615,948,258✔
64
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refColName));
615,948,258✔
65
    }
66
  }
67

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

84
static int32_t metaDecodeExtSchemas(SDecoder* pDecoder, SMetaEntry* pME) {
1,156,617,529✔
85
  bool hasExtSchema = false;
1,156,617,529✔
86
  SSchemaWrapper* pSchWrapper = NULL;
1,156,617,529✔
87
  if (pME->type == TSDB_SUPER_TABLE) {
1,156,617,529✔
88
    pSchWrapper = &pME->stbEntry.schemaRow;
926,262,493✔
89
  } else if (pME->type == TSDB_NORMAL_TABLE) {
230,408,743✔
90
    pSchWrapper = &pME->ntbEntry.schemaRow;
230,427,217✔
91
  } else {
92
    return 0;
×
93
  }
94

95
  hasExtSchema = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
1,156,623,416✔
96
  if (hasExtSchema && pSchWrapper->nCols > 0) {
1,156,777,152✔
97
    pME->pExtSchemas = (SExtSchema*)tDecoderMalloc(pDecoder, sizeof(SExtSchema) * pSchWrapper->nCols);
297,682,806✔
98
    if (pME->pExtSchemas == NULL) {
148,840,696✔
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,007,933,092✔
107
  }
108

109
  return 0;
1,156,828,073✔
110
}
111

112
SExtSchema* metaGetSExtSchema(const SMetaEntry *pME) {
46,229,719✔
113
  const SSchemaWrapper *pSchWrapper = NULL;
46,229,719✔
114
  bool                  hasTypeMods = false;
46,229,719✔
115
  if (pME->type == TSDB_SUPER_TABLE) {
46,229,719✔
116
    pSchWrapper = &pME->stbEntry.schemaRow;
33,655,285✔
117
  } else if (pME->type == TSDB_NORMAL_TABLE) {
12,595,403✔
118
    pSchWrapper = &pME->ntbEntry.schemaRow;
12,601,073✔
119
  } else {
120
    return NULL;
×
121
  }
122
  hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
46,260,052✔
123

124
  if (hasTypeMods) {
46,230,731✔
125
    SExtSchema *ret = taosMemoryMalloc(sizeof(SExtSchema) * pSchWrapper->nCols);
28,402✔
126
    if (ret != NULL) {
28,402✔
127
      memcpy(ret, pME->pExtSchemas, pSchWrapper->nCols * sizeof(SExtSchema));
28,402✔
128
    }
129
    return ret;
28,402✔
130
  }
131
  return NULL;
46,202,329✔
132
}
133

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

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

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

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

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

164
  func_id_t *pFuncIds = (*rsmaSchema)->funcIds;
28,194✔
165
  int32_t    i = 0, j = 0;
28,194✔
166
  for (i = 0; i < nCols; ++i) {
213,360✔
167
    while (j < pParam->nFuncs) {
336,804✔
168
      if (pParam->funcColIds[j] == pSchema[i].colId) {
323,088✔
169
        pFuncIds[i] = pParam->funcIds[j];
150,876✔
170
        break;
150,876✔
171
      }
172
      if (pParam->funcColIds[j] > pSchema[i].colId) {
172,212✔
173
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
34,290✔
174
        break;
34,290✔
175
      }
176
      ++j;
137,922✔
177
    }
178
    if (j >= pParam->nFuncs) {
198,882✔
179
      for (; i < nCols; ++i) {
27,432✔
180
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
13,716✔
181
      }
182
      break;
13,716✔
183
    }
184
  }
185
  pFuncIds[0] = 0;  // Primary TS column has no function
28,194✔
186

187
  return 0;
28,194✔
188
}
189

190
int meteDecodeColRefEntry(SDecoder *pDecoder, SMetaEntry *pME) {
39,262,366✔
191
  SColRefWrapper *pWrapper = &pME->colRef;
39,262,366✔
192
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
78,534,037✔
193
  if (pWrapper->nCols == 0) {
39,267,954✔
194
    return 0;
×
195
  }
196

197
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->version));
78,534,011✔
198
  uDebug("decode cols:%d", pWrapper->nCols);
39,267,312✔
199
  pWrapper->pColRef = (SColRef *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColRef));
78,526,860✔
200
  if (pWrapper->pColRef == NULL) {
39,259,980✔
201
    return terrno;
×
202
  }
203

204
  for (int i = 0; i < pWrapper->nCols; i++) {
680,920,389✔
205
    SColRef *p = &pWrapper->pColRef[i];
641,664,225✔
206
    TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&p->hasRef));
1,283,335,791✔
207
    TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &p->id));
1,283,345,942✔
208
    if (p->hasRef) {
641,674,925✔
209
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refDbName));
363,834,249✔
210
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refTableName));
363,830,914✔
211
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refColName));
363,841,273✔
212
    }
213
  }
214

215
  // Decode tag references (backward compatible)
216
  pWrapper->nTagRefs = 0;
39,247,373✔
217
  pWrapper->pTagRef = NULL;
39,269,759✔
218
  if (!tDecodeIsEnd(pDecoder)) {
39,269,146✔
219
    TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nTagRefs));
78,538,292✔
220
    if (pWrapper->nTagRefs > 0) {
39,269,146✔
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;
39,262,403✔
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,261,864✔
259
  if (pSrc->nCols > 0) {
1,261,864✔
260
    pDst->nCols = pSrc->nCols;
1,262,477✔
261
    pDst->version = pSrc->version;
1,263,090✔
262
    pDst->pColRef = (SColRef*)taosMemoryCalloc(pSrc->nCols, sizeof(SColRef));
1,261,864✔
263
    if (NULL == pDst->pColRef) {
1,261,864✔
264
      return terrno;
×
265
    }
266
    memcpy(pDst->pColRef, pSrc->pColRef, pSrc->nCols * sizeof(SColRef));
1,262,477✔
267
  }
268
  return 0;
1,261,864✔
269
}
270

271
static int32_t metaEncodeComprEntryImpl(SEncoder *pCoder, SColCmprWrapper *pw) {
47,788,432✔
272
  int32_t code = 0;
47,788,432✔
273
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
95,547,223✔
274
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
95,550,909✔
275
  uTrace("encode cols:%d", pw->nCols);
47,792,118✔
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;
47,824,808✔
283
}
284
int meteEncodeColCmprEntry(SEncoder *pCoder, const SMetaEntry *pME) {
47,538,821✔
285
  const SColCmprWrapper *pw = &pME->colCmpr;
47,538,821✔
286
  return metaEncodeComprEntryImpl(pCoder, (SColCmprWrapper *)pw);
47,551,267✔
287
}
288
int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
1,156,644,450✔
289
  SColCmprWrapper *pWrapper = &pME->colCmpr;
1,156,644,450✔
290
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
2,147,483,647✔
291
  if (pWrapper->nCols == 0) {
1,156,671,370✔
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,156,437,771✔
297
  pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
2,147,483,647✔
298
  if (pWrapper->pColCmpr == NULL) {
1,156,772,028✔
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,157,011,688✔
308
}
309
static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder, SColCmprWrapper *pCmpr,
310
                                                            SSchemaWrapper *pSchema) {
311
  pCmpr->nCols = pSchema->nCols;
257,088✔
312

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

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

323
  for (int32_t i = 0; i < pCmpr->nCols; i++) {
1,273,994✔
324
    SColCmpr *pColCmpr = &pCmpr->pColCmpr[i];
1,016,906✔
325
    SSchema  *pColSchema = &pSchema->pSchema[i];
1,016,906✔
326
    pColCmpr->id = pColSchema->colId;
1,016,906✔
327
    pColCmpr->alg = createDefaultColCmprByType(pColSchema->type);
1,016,906✔
328
  }
329
  return 0;
257,088✔
330
}
331

332
static int32_t metaCloneColCmpr(const SColCmprWrapper *pSrc, SColCmprWrapper *pDst) {
202,704,531✔
333
  if (pSrc->nCols > 0) {
202,704,531✔
334
    pDst->nCols = pSrc->nCols;
175,954,054✔
335
    pDst->version = pSrc->version;
175,953,803✔
336
    pDst->pColCmpr = (SColCmpr *)taosMemoryCalloc(pSrc->nCols, sizeof(SColCmpr));
175,935,588✔
337
    if (NULL == pDst->pColCmpr) {
175,927,605✔
338
      return terrno;
×
339
    }
340
    memcpy(pDst->pColCmpr, pSrc->pColCmpr, pSrc->nCols * sizeof(SColCmpr));
175,929,631✔
341
  }
342
  return 0;
202,695,173✔
343
}
344

345
static void metaCloneColRefFree(SColRefWrapper *pColRef) {
203,955,387✔
346
  if (pColRef) {
203,955,387✔
347
    taosMemoryFreeClear(pColRef->pColRef);
203,965,580✔
348
  }
349
}
203,964,547✔
350

351
static void metaCloneColCmprFree(SColCmprWrapper *pCmpr) {
203,957,113✔
352
  if (pCmpr) {
203,957,113✔
353
    taosMemoryFreeClear(pCmpr->pColCmpr);
203,968,538✔
354
  }
355
}
203,960,347✔
356

357
int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
211,257,724✔
358
  TAOS_CHECK_RETURN(tStartEncode(pCoder));
211,257,724✔
359
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->version));
422,510,521✔
360
  TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->type));
422,504,041✔
361
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->uid));
422,506,618✔
362

363
  if (pME->type > 0) {
211,253,494✔
364
    if (pME->name == NULL) {
206,169,528✔
365
      return TSDB_CODE_INVALID_PARA;
×
366
    }
367

368
    TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->name));
412,332,842✔
369

370
    if (pME->type == TSDB_SUPER_TABLE) {
206,180,202✔
371
      TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->flags));
51,744,515✔
372
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaRow));
51,784,780✔
373
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaTag));
51,805,229✔
374
      if (TABLE_IS_ROLLUP(pME->flags)) {
25,877,536✔
375
        TAOS_CHECK_RETURN(tEncodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
113,468✔
376
      }
377
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
180,268,735✔
378
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.btime));
315,117,589✔
379
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ctbEntry.ttlDays));
315,127,780✔
380
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ctbEntry.commentLen));
315,128,845✔
381
      if (pME->ctbEntry.commentLen > 0) {
157,560,355✔
382
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ctbEntry.comment));
29,720✔
383
      }
384
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.suid));
315,122,113✔
385
      TAOS_CHECK_RETURN(tEncodeTag(pCoder, (const STag *)pME->ctbEntry.pTags));
157,561,213✔
386
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
22,717,154✔
387
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.btime));
45,434,308✔
388
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ntbEntry.ttlDays));
45,434,308✔
389
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.commentLen));
45,434,308✔
390
      if (pME->ntbEntry.commentLen > 0) {
22,717,154✔
391
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ntbEntry.comment));
18,872✔
392
      }
393
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.ncid));
45,434,308✔
394
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->ntbEntry.schemaRow));
45,434,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,157,354✔
402
      TAOS_CHECK_RETURN(meteEncodeColRefEntry(pCoder, pME));
1,954,643✔
403
    } else {
404
      if (pME->type == TSDB_SUPER_TABLE && TABLE_IS_COL_COMPRESSED(pME->flags)) {
204,207,178✔
405
        TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
25,892,114✔
406
      } else if (pME->type == TSDB_NORMAL_TABLE) {
178,372,968✔
407
        if (pME->colCmpr.nCols != 0) {
21,918,976✔
408
          TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
21,661,888✔
409
        } else {
410
          metaWarn("meta/entry: failed to get compress cols, type:%d", pME->type);
257,088✔
411
          SColCmprWrapper colCmprs = {0};
257,088✔
412
          int32_t code = metatInitDefaultSColCmprWrapper(NULL, &colCmprs, (SSchemaWrapper *)&pME->ntbEntry.schemaRow);
257,088✔
413
          if (code != 0) {
257,088✔
414
            taosMemoryFree(colCmprs.pColCmpr);
×
415
            TAOS_CHECK_RETURN(code);
×
416
          }
417
          code = metaEncodeComprEntryImpl(pCoder, &colCmprs);
257,088✔
418
          taosMemoryFree(colCmprs.pColCmpr);
257,088✔
419
          TAOS_CHECK_RETURN(code);
257,088✔
420
        }
421
      }
422
    }
423
    TAOS_CHECK_RETURN(metaEncodeExtSchema(pCoder, pME));
206,187,980✔
424
  }
425
  if (pME->type == TSDB_SUPER_TABLE) {
211,262,994✔
426
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->stbEntry.keep));
51,777,569✔
427
    TAOS_CHECK_RETURN(tEncodeI64v(pCoder, pME->stbEntry.ownerId));
51,746,649✔
428
  } else if (pME->type == TSDB_NORMAL_TABLE) {
185,352,286✔
429
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.ownerId));
43,837,952✔
430
  }
431

432
  tEndEncode(pCoder);
211,234,771✔
433
  return 0;
211,236,236✔
434
}
435

436
int metaDecodeEntryImpl(SDecoder *pCoder, SMetaEntry *pME, bool headerOnly) {
1,934,326,417✔
437
  TAOS_CHECK_RETURN(tStartDecode(pCoder));
1,934,326,417✔
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,934,831,885✔
443
    tEndDecode(pCoder);
319,238✔
444
    return 0;
319,238✔
445
  }
446

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

450
    if (pME->type == TSDB_SUPER_TABLE) {
1,934,347,764✔
451
      TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pME->flags));
1,852,780,770✔
452
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaRow));
1,852,882,193✔
453
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaTag));
1,852,690,235✔
454
      if (TABLE_IS_ROLLUP(pME->flags)) {
926,283,812✔
455
        TAOS_CHECK_RETURN(tDecodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
348,372✔
456
      }
457
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
1,007,626,796✔
458
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.btime));
1,541,007,240✔
459
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ctbEntry.ttlDays));
1,541,112,746✔
460
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ctbEntry.commentLen));
1,540,903,231✔
461
      if (pME->ctbEntry.commentLen > 0) {
770,345,996✔
462
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ctbEntry.comment));
51,402✔
463
      }
464
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.suid));
1,540,957,550✔
465
      TAOS_CHECK_RETURN(tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags));
770,560,981✔
466
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
237,389,215✔
467
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.btime));
474,884,673✔
468
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ntbEntry.ttlDays));
474,940,366✔
469
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.commentLen));
474,882,713✔
470
      if (pME->ntbEntry.commentLen > 0) {
237,410,338✔
471
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ntbEntry.comment));
39,198✔
472
      }
473
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.ncid));
474,811,279✔
474
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->ntbEntry.schemaRow));
474,906,102✔
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,934,177,991✔
486
      if (TABLE_IS_COL_COMPRESSED(pME->flags)) {
926,401,799✔
487
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
926,425,932✔
488

489
        if (pME->colCmpr.nCols == 0) {
926,331,712✔
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,007,621,023✔
497
      if (!tDecodeIsEnd(pCoder)) {
230,454,463✔
498
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
230,470,651✔
499
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
230,470,651✔
500
        if (pME->colCmpr.nCols == 0) {
230,471,144✔
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);
46✔
505
        TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->ntbEntry.schemaRow));
46✔
506
      }
507
      TABLE_SET_COL_COMPRESSED(pME->flags);
230,483,573✔
508
    } else if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
777,165,714✔
509
      if (!tDecodeIsEnd(pCoder)) {
39,268,533✔
510
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
39,267,307✔
511
        TAOS_CHECK_RETURN(meteDecodeColRefEntry(pCoder, pME));
39,268,071✔
512
      } else {
513
        uDebug("set default type: %d, tableName:%s", pME->type, pME->name);
1,226✔
514
        if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
1,226✔
515
           TAOS_CHECK_RETURN(metatInitDefaultSColRefWrapper(pCoder, &pME->colRef, &pME->ntbEntry.schemaRow));
×
516
        }
517
      }
518
    }
519
    if (!tDecodeIsEnd(pCoder)) {
1,934,188,594✔
520
      TAOS_CHECK_RETURN(metaDecodeExtSchemas(pCoder, pME));
1,156,846,122✔
521
    } else {
522
      pME->pExtSchemas = NULL;
777,342,472✔
523
    }
524
  }
525
  if (pME->type == TSDB_SUPER_TABLE) {
1,934,009,695✔
526
    if (!tDecodeIsEnd(pCoder)) {
926,261,287✔
527
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->stbEntry.keep));
1,852,562,987✔
528
    }
529
    if (!tDecodeIsEnd(pCoder)) {
926,249,243✔
530
      TAOS_CHECK_RETURN(tDecodeI64v(pCoder, &pME->stbEntry.ownerId));
1,852,595,011✔
531
    }
532
  } else if (pME->type == TSDB_NORMAL_TABLE) {
1,007,554,238✔
533
    if (!tDecodeIsEnd(pCoder)) {
230,471,084✔
534
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.ownerId));
460,957,907✔
535
    }
536
  }
537

538

539
  tEndDecode(pCoder);
1,933,911,040✔
540
  return 0;
1,933,968,855✔
541
}
542

543
int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { return metaDecodeEntryImpl(pCoder, pME, false); }
1,934,098,660✔
544

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

550
  pDst->nCols = pSrc->nCols;
343,776,781✔
551
  pDst->version = pSrc->version;
343,762,685✔
552
  pDst->pSchema = (SSchema *)taosMemoryMalloc(pSrc->nCols * sizeof(SSchema));
343,755,036✔
553
  if (pDst->pSchema == NULL) {
343,682,891✔
554
    return terrno;
×
555
  }
556
  memcpy(pDst->pSchema, pSrc->pSchema, pSrc->nCols * sizeof(SSchema));
343,696,893✔
557
  return TSDB_CODE_SUCCESS;
343,771,870✔
558
}
559

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

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

588
  return TSDB_CODE_SUCCESS;
77,100✔
589
}
590

591
static void metaCloneSchemaFree(SSchemaWrapper *pSchema) {
343,746,974✔
592
  if (pSchema) {
343,746,974✔
593
    taosMemoryFreeClear(pSchema->pSchema);
343,752,482✔
594
  }
595
}
343,742,824✔
596

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

610
void metaCloneEntryFree(SMetaEntry **ppEntry) {
204,035,392✔
611
  if (ppEntry == NULL || *ppEntry == NULL) {
204,035,392✔
612
    return;
79,331✔
613
  }
614

615
  taosMemoryFreeClear((*ppEntry)->name);
203,958,127✔
616

617
  if ((*ppEntry)->type < 0) {
203,971,929✔
618
    taosMemoryFreeClear(*ppEntry);
×
619
    return;
×
620
  }
621

622
  if (TSDB_SUPER_TABLE == (*ppEntry)->type) {
203,951,273✔
623
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaRow);
167,330,559✔
624
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaTag);
167,328,479✔
625
    if (TABLE_IS_ROLLUP((*ppEntry)->flags)) {
167,323,332✔
626
      metaFreeRsmaParam(&(*ppEntry)->stbEntry.rsmaParam, 1);
117,555✔
627
    }
628
  } else if (TSDB_CHILD_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_CHILD_TABLE == (*ppEntry)->type) {
36,615,222✔
629
    taosMemoryFreeClear((*ppEntry)->ctbEntry.comment);
27,536,578✔
630
    taosMemoryFreeClear((*ppEntry)->ctbEntry.pTags);
27,538,557✔
631
  } else if (TSDB_NORMAL_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_NORMAL_TABLE == (*ppEntry)->type) {
9,080,861✔
632
    metaCloneSchemaFree(&(*ppEntry)->ntbEntry.schemaRow);
9,080,861✔
633
    taosMemoryFreeClear((*ppEntry)->ntbEntry.comment);
9,080,861✔
634
  } else {
635
    return;
×
636
  }
637
  metaCloneColCmprFree(&(*ppEntry)->colCmpr);
203,954,247✔
638
  taosMemoryFreeClear((*ppEntry)->pExtSchemas);
203,937,414✔
639
  metaCloneColRefFree(&(*ppEntry)->colRef);
203,944,659✔
640

641
  taosMemoryFreeClear(*ppEntry);
203,936,384✔
642
  return;
203,936,677✔
643
}
644

645
int32_t metaCloneEntry(const SMetaEntry *pEntry, SMetaEntry **ppEntry) {
203,952,704✔
646
  int32_t code = TSDB_CODE_SUCCESS;
203,952,704✔
647

648
  if (NULL == pEntry || NULL == ppEntry) {
203,952,704✔
649
    return TSDB_CODE_INVALID_PARA;
×
650
  }
651

652
  *ppEntry = (SMetaEntry *)taosMemoryCalloc(1, sizeof(SMetaEntry));
203,973,030✔
653
  if (NULL == *ppEntry) {
203,911,191✔
654
    return terrno;
×
655
  }
656

657
  (*ppEntry)->version = pEntry->version;
203,931,244✔
658
  (*ppEntry)->type = pEntry->type;
203,958,915✔
659
  (*ppEntry)->uid = pEntry->uid;
203,959,551✔
660

661
  if (pEntry->type < 0) {
203,964,358✔
662
    return TSDB_CODE_SUCCESS;
×
663
  }
664

665
  if (pEntry->name) {
203,947,332✔
666
    (*ppEntry)->name = tstrdup(pEntry->name);
203,965,288✔
667
    if (NULL == (*ppEntry)->name) {
203,962,718✔
668
      code = terrno;
×
669
      metaCloneEntryFree(ppEntry);
×
670
      return code;
×
671
    }
672
  }
673

674
  if (pEntry->type == TSDB_SUPER_TABLE) {
203,956,746✔
675
    (*ppEntry)->flags = pEntry->flags;
167,349,919✔
676

677
    code = metaCloneSchema(&pEntry->stbEntry.schemaRow, &(*ppEntry)->stbEntry.schemaRow);
167,338,124✔
678
    if (code) {
167,343,499✔
679
      metaCloneEntryFree(ppEntry);
×
680
      return code;
×
681
    }
682

683
    code = metaCloneSchema(&pEntry->stbEntry.schemaTag, &(*ppEntry)->stbEntry.schemaTag);
167,343,499✔
684
    if (code) {
167,351,787✔
685
      metaCloneEntryFree(ppEntry);
×
686
      return code;
×
687
    }
688
    if (TABLE_IS_ROLLUP(pEntry->flags)) {
167,351,787✔
689
      code = metaCloneRsmaParam(&pEntry->stbEntry.rsmaParam, &(*ppEntry)->stbEntry.rsmaParam);
77,100✔
690
      if (code) {
77,100✔
691
        metaCloneEntryFree(ppEntry);
×
692
        return code;
×
693
      }
694
    }
695
    (*ppEntry)->stbEntry.keep = pEntry->stbEntry.keep;
167,352,011✔
696
    (*ppEntry)->stbEntry.ownerId = pEntry->stbEntry.ownerId;
167,347,498✔
697
  } else if (pEntry->type == TSDB_CHILD_TABLE || pEntry->type == TSDB_VIRTUAL_CHILD_TABLE) {
36,618,192✔
698
    (*ppEntry)->ctbEntry.btime = pEntry->ctbEntry.btime;
27,539,170✔
699
    (*ppEntry)->ctbEntry.ttlDays = pEntry->ctbEntry.ttlDays;
27,537,331✔
700
    (*ppEntry)->ctbEntry.suid = pEntry->ctbEntry.suid;
27,537,874✔
701

702
    // comment
703
    (*ppEntry)->ctbEntry.commentLen = pEntry->ctbEntry.commentLen;
27,537,874✔
704
    if (pEntry->ctbEntry.commentLen > 0) {
27,537,944✔
705
      (*ppEntry)->ctbEntry.comment = taosMemoryMalloc(pEntry->ctbEntry.commentLen + 1);
8,779✔
706
      if (NULL == (*ppEntry)->ctbEntry.comment) {
8,779✔
707
        code = terrno;
×
708
        metaCloneEntryFree(ppEntry);
×
709
        return code;
×
710
      }
711
      memcpy((*ppEntry)->ctbEntry.comment, pEntry->ctbEntry.comment, pEntry->ctbEntry.commentLen + 1);
8,779✔
712
    }
713

714
    // tags
715
    STag *pTags = (STag *)pEntry->ctbEntry.pTags;
27,537,944✔
716
    (*ppEntry)->ctbEntry.pTags = taosMemoryCalloc(1, pTags->len);
27,537,331✔
717
    if (NULL == (*ppEntry)->ctbEntry.pTags) {
27,538,179✔
718
      code = terrno;
×
719
      metaCloneEntryFree(ppEntry);
×
720
      return code;
×
721
    }
722
    memcpy((*ppEntry)->ctbEntry.pTags, pEntry->ctbEntry.pTags, pTags->len);
27,537,331✔
723
  } else if (pEntry->type == TSDB_NORMAL_TABLE || pEntry->type == TSDB_VIRTUAL_NORMAL_TABLE) {
9,080,861✔
724
    (*ppEntry)->ntbEntry.btime = pEntry->ntbEntry.btime;
9,080,861✔
725
    (*ppEntry)->ntbEntry.ttlDays = pEntry->ntbEntry.ttlDays;
9,080,861✔
726
    (*ppEntry)->ntbEntry.ncid = pEntry->ntbEntry.ncid;
9,080,861✔
727
    (*ppEntry)->ntbEntry.ownerId = pEntry->ntbEntry.ownerId;
9,080,861✔
728

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

736
    // comment
737
    (*ppEntry)->ntbEntry.commentLen = pEntry->ntbEntry.commentLen;
9,080,861✔
738
    if (pEntry->ntbEntry.commentLen > 0) {
9,080,861✔
739
      (*ppEntry)->ntbEntry.comment = taosMemoryMalloc(pEntry->ntbEntry.commentLen + 1);
6,067✔
740
      if (NULL == (*ppEntry)->ntbEntry.comment) {
6,067✔
741
        code = terrno;
×
742
        metaCloneEntryFree(ppEntry);
×
743
        return code;
×
744
      }
745
      memcpy((*ppEntry)->ntbEntry.comment, pEntry->ntbEntry.comment, pEntry->ntbEntry.commentLen + 1);
6,067✔
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) {
203,960,986✔
752
    code = metaCloneColRef(&pEntry->colRef, &(*ppEntry)->colRef);
1,262,237✔
753
    if (code) {
1,261,864✔
754
      metaCloneEntryFree(ppEntry);
×
755
      return code;
×
756
    }
757
  } else {
758
    code = metaCloneColCmpr(&pEntry->colCmpr, &(*ppEntry)->colCmpr);
202,703,388✔
759
    if (code) {
202,692,777✔
760
      metaCloneEntryFree(ppEntry);
×
761
      return code;
×
762
    }
763
  }
764
  if (pEntry->pExtSchemas && pEntry->colCmpr.nCols > 0) {
203,954,641✔
765
    (*ppEntry)->pExtSchemas = taosMemoryCalloc(pEntry->colCmpr.nCols, sizeof(SExtSchema));
9,726,473✔
766
    if (!(*ppEntry)->pExtSchemas) {
9,723,961✔
767
      code = terrno;
×
768
      metaCloneEntryFree(ppEntry);
×
769
      return code;
×
770
    }
771
    memcpy((*ppEntry)->pExtSchemas, pEntry->pExtSchemas, sizeof(SExtSchema) * pEntry->colCmpr.nCols);
9,720,497✔
772
  }
773

774
  return code;
203,970,369✔
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