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

taosdata / TDengine / #5008

29 Mar 2026 04:32AM UTC coverage: 72.241% (-0.009%) from 72.25%
#5008

push

travis-ci

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

253593 of 351039 relevant lines covered (72.24%)

130989730.42 hits per line

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

79.3
/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,170,041,731✔
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,336,900✔
26
    }
27
  }
28
  return false;
1,010,880,190✔
29
}
30

31
static int32_t metaEncodeExtSchema(SEncoder* pCoder, const SMetaEntry* pME) {
204,666,939✔
32
  if (pME->pExtSchemas) {
204,666,939✔
33
    const SSchemaWrapper *pSchWrapper = NULL;
12,486,877✔
34
    bool                  hasTypeMods = false;
12,486,877✔
35
    if (pME->type == TSDB_SUPER_TABLE) {
12,486,877✔
36
      pSchWrapper = &pME->stbEntry.schemaRow;
12,389,284✔
37
    } else if (pME->type == TSDB_NORMAL_TABLE) {
96,710✔
38
      pSchWrapper = &pME->ntbEntry.schemaRow;
96,710✔
39
    } else {
40
      return 0;
×
41
    }
42
    hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
12,482,904✔
43

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

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

57
  for (int32_t i = 0; i < pw->nCols; i++) {
451,454,216✔
58
    SColRef *p = &pw->pColRef[i];
449,543,242✔
59
    TAOS_CHECK_RETURN(tEncodeI8(pCoder, p->hasRef));
899,086,484✔
60
    TAOS_CHECK_RETURN(tEncodeI16v(pCoder, p->id));
899,086,484✔
61
    if (p->hasRef) {
449,543,242✔
62
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refDbName));
595,945,960✔
63
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refTableName));
595,945,960✔
64
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refColName));
595,945,960✔
65
    }
66
  }
67

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

84
static int32_t metaDecodeExtSchemas(SDecoder* pDecoder, SMetaEntry* pME) {
1,111,284,516✔
85
  bool hasExtSchema = false;
1,111,284,516✔
86
  SSchemaWrapper* pSchWrapper = NULL;
1,111,284,516✔
87
  if (pME->type == TSDB_SUPER_TABLE) {
1,111,284,516✔
88
    pSchWrapper = &pME->stbEntry.schemaRow;
887,928,303✔
89
  } else if (pME->type == TSDB_NORMAL_TABLE) {
223,482,651✔
90
    pSchWrapper = &pME->ntbEntry.schemaRow;
223,517,940✔
91
  } else {
92
    return 0;
×
93
  }
94

95
  hasExtSchema = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
1,111,367,376✔
96
  if (hasExtSchema && pSchWrapper->nCols > 0) {
1,111,554,421✔
97
    pME->pExtSchemas = (SExtSchema*)tDecoderMalloc(pDecoder, sizeof(SExtSchema) * pSchWrapper->nCols);
297,980,971✔
98
    if (pME->pExtSchemas == NULL) {
148,991,443✔
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;
962,559,245✔
107
  }
108

109
  return 0;
1,111,581,441✔
110
}
111

112
SExtSchema* metaGetSExtSchema(const SMetaEntry *pME) {
46,289,038✔
113
  const SSchemaWrapper *pSchWrapper = NULL;
46,289,038✔
114
  bool                  hasTypeMods = false;
46,289,038✔
115
  if (pME->type == TSDB_SUPER_TABLE) {
46,289,038✔
116
    pSchWrapper = &pME->stbEntry.schemaRow;
33,682,952✔
117
  } else if (pME->type == TSDB_NORMAL_TABLE) {
12,625,936✔
118
    pSchWrapper = &pME->ntbEntry.schemaRow;
12,638,576✔
119
  } else {
120
    return NULL;
×
121
  }
122
  hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
46,323,601✔
123

124
  if (hasTypeMods) {
46,305,159✔
125
    SExtSchema *ret = taosMemoryMalloc(sizeof(SExtSchema) * pSchWrapper->nCols);
28,546✔
126
    if (ret != NULL) {
28,546✔
127
      memcpy(ret, pME->pExtSchemas, pSchWrapper->nCols * sizeof(SExtSchema));
28,546✔
128
    }
129
    return ret;
28,546✔
130
  }
131
  return NULL;
46,276,613✔
132
}
133

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

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

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

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

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

164
  func_id_t *pFuncIds = (*rsmaSchema)->funcIds;
28,231✔
165
  int32_t    i = 0, j = 0;
28,231✔
166
  for (i = 0; i < nCols; ++i) {
213,640✔
167
    while (j < pParam->nFuncs) {
337,246✔
168
      if (pParam->funcColIds[j] == pSchema[i].colId) {
323,512✔
169
        pFuncIds[i] = pParam->funcIds[j];
151,074✔
170
        break;
151,074✔
171
      }
172
      if (pParam->funcColIds[j] > pSchema[i].colId) {
172,438✔
173
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
34,335✔
174
        break;
34,335✔
175
      }
176
      ++j;
138,103✔
177
    }
178
    if (j >= pParam->nFuncs) {
199,143✔
179
      for (; i < nCols; ++i) {
27,468✔
180
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
13,734✔
181
      }
182
      break;
13,734✔
183
    }
184
  }
185
  pFuncIds[0] = 0;  // Primary TS column has no function
28,231✔
186

187
  return 0;
28,231✔
188
}
189

190
int meteDecodeColRefEntry(SDecoder *pDecoder, SMetaEntry *pME) {
36,551,449✔
191
  SColRefWrapper *pWrapper = &pME->colRef;
36,551,449✔
192
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
73,115,567✔
193
  if (pWrapper->nCols == 0) {
36,559,213✔
194
    return 0;
×
195
  }
196

197
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->version));
73,114,170✔
198
  uDebug("decode cols:%d", pWrapper->nCols);
36,559,038✔
199
  pWrapper->pColRef = (SColRef *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColRef));
73,111,334✔
200
  if (pWrapper->pColRef == NULL) {
36,553,951✔
201
    return terrno;
×
202
  }
203

204
  for (int i = 0; i < pWrapper->nCols; i++) {
656,453,523✔
205
    SColRef *p = &pWrapper->pColRef[i];
619,904,276✔
206
    TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&p->hasRef));
1,239,816,201✔
207
    TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &p->id));
1,239,836,134✔
208
    if (p->hasRef) {
619,927,864✔
209
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refDbName));
348,218,758✔
210
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refTableName));
348,216,240✔
211
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refColName));
348,223,593✔
212
    }
213
  }
214

215
  // Decode tag references (backward compatible)
216
  pWrapper->nTagRefs = 0;
36,539,349✔
217
  pWrapper->pTagRef = NULL;
36,563,107✔
218
  if (!tDecodeIsEnd(pDecoder)) {
36,561,268✔
219
    TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nTagRefs));
73,118,858✔
220
    if (pWrapper->nTagRefs > 0) {
36,556,364✔
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;
36,553,907✔
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,271,570✔
259
  if (pSrc->nCols > 0) {
1,271,570✔
260
    pDst->nCols = pSrc->nCols;
1,271,570✔
261
    pDst->version = pSrc->version;
1,271,570✔
262
    pDst->pColRef = (SColRef*)taosMemoryCalloc(pSrc->nCols, sizeof(SColRef));
1,271,570✔
263
    if (NULL == pDst->pColRef) {
1,270,957✔
264
      return terrno;
×
265
    }
266
    memcpy(pDst->pColRef, pSrc->pColRef, pSrc->nCols * sizeof(SColRef));
1,270,957✔
267
  }
268
  return 0;
1,271,570✔
269
}
270

271
static int32_t metaEncodeComprEntryImpl(SEncoder *pCoder, SColCmprWrapper *pw) {
47,587,011✔
272
  int32_t code = 0;
47,587,011✔
273
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
95,167,254✔
274
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
95,174,785✔
275
  uTrace("encode cols:%d", pw->nCols);
47,594,542✔
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,643,862✔
283
}
284
int meteEncodeColCmprEntry(SEncoder *pCoder, const SMetaEntry *pME) {
47,438,894✔
285
  const SColCmprWrapper *pw = &pME->colCmpr;
47,438,894✔
286
  return metaEncodeComprEntryImpl(pCoder, (SColCmprWrapper *)pw);
47,450,559✔
287
}
288
int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
1,111,339,927✔
289
  SColCmprWrapper *pWrapper = &pME->colCmpr;
1,111,339,927✔
290
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
2,147,483,647✔
291
  if (pWrapper->nCols == 0) {
1,111,397,630✔
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,111,175,013✔
297
  pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
2,147,483,647✔
298
  if (pWrapper->pColCmpr == NULL) {
1,111,539,713✔
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,111,807,803✔
308
}
309
static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder, SColCmprWrapper *pCmpr,
310
                                                            SSchemaWrapper *pSchema) {
311
  pCmpr->nCols = pSchema->nCols;
179,752✔
312

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

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

323
  for (int32_t i = 0; i < pCmpr->nCols; i++) {
823,596✔
324
    SColCmpr *pColCmpr = &pCmpr->pColCmpr[i];
643,844✔
325
    SSchema  *pColSchema = &pSchema->pSchema[i];
643,844✔
326
    pColCmpr->id = pColSchema->colId;
643,844✔
327
    pColCmpr->alg = createDefaultColCmprByType(pColSchema->type);
643,844✔
328
  }
329
  return 0;
179,752✔
330
}
331

332
static int32_t metaCloneColCmpr(const SColCmprWrapper *pSrc, SColCmprWrapper *pDst) {
199,355,886✔
333
  if (pSrc->nCols > 0) {
199,355,886✔
334
    pDst->nCols = pSrc->nCols;
174,750,029✔
335
    pDst->version = pSrc->version;
174,751,058✔
336
    pDst->pColCmpr = (SColCmpr *)taosMemoryCalloc(pSrc->nCols, sizeof(SColCmpr));
174,745,351✔
337
    if (NULL == pDst->pColCmpr) {
174,725,384✔
338
      return terrno;
×
339
    }
340
    memcpy(pDst->pColCmpr, pSrc->pColCmpr, pSrc->nCols * sizeof(SColCmpr));
174,729,458✔
341
  }
342
  return 0;
199,351,885✔
343
}
344

345
static void metaCloneColRefFree(SColRefWrapper *pColRef) {
200,626,173✔
346
  if (pColRef) {
200,626,173✔
347
    taosMemoryFreeClear(pColRef->pColRef);
200,634,698✔
348
  }
349
}
200,634,549✔
350

351
static void metaCloneColCmprFree(SColCmprWrapper *pCmpr) {
200,623,981✔
352
  if (pCmpr) {
200,623,981✔
353
    taosMemoryFreeClear(pCmpr->pColCmpr);
200,631,485✔
354
  }
355
}
200,618,965✔
356

357
int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
210,071,523✔
358
  TAOS_CHECK_RETURN(tStartEncode(pCoder));
210,071,523✔
359
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->version));
420,142,584✔
360
  TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->type));
420,116,905✔
361
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->uid));
420,124,447✔
362

363
  if (pME->type > 0) {
210,066,110✔
364
    if (pME->name == NULL) {
204,685,334✔
365
      return TSDB_CODE_INVALID_PARA;
×
366
    }
367

368
    TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->name));
409,365,100✔
369

370
    if (pME->type == TSDB_SUPER_TABLE) {
204,693,153✔
371
      TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->flags));
52,022,411✔
372
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaRow));
52,056,522✔
373
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaTag));
52,096,449✔
374
      if (TABLE_IS_ROLLUP(pME->flags)) {
26,031,361✔
375
        TAOS_CHECK_RETURN(tEncodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
115,068✔
376
      }
377
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
178,649,310✔
378
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.btime));
312,506,693✔
379
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ctbEntry.ttlDays));
312,513,901✔
380
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ctbEntry.commentLen));
312,511,566✔
381
      if (pME->ctbEntry.commentLen > 0) {
156,253,882✔
382
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ctbEntry.comment));
29,752✔
383
      }
384
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.suid));
312,512,441✔
385
      TAOS_CHECK_RETURN(tEncodeTag(pCoder, (const STag *)pME->ctbEntry.pTags));
156,256,975✔
386
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
22,403,188✔
387
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.btime));
44,806,376✔
388
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ntbEntry.ttlDays));
44,806,376✔
389
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.commentLen));
44,806,376✔
390
      if (pME->ntbEntry.commentLen > 0) {
22,403,188✔
391
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ntbEntry.comment));
18,904✔
392
      }
393
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.ncid));
44,806,376✔
394
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->ntbEntry.schemaRow));
44,806,376✔
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) {
204,691,532✔
402
      TAOS_CHECK_RETURN(meteEncodeColRefEntry(pCoder, pME));
1,948,361✔
403
    } else {
404
      if (pME->type == TSDB_SUPER_TABLE && TABLE_IS_COL_COMPRESSED(pME->flags)) {
202,743,997✔
405
        TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
26,036,771✔
406
      } else if (pME->type == TSDB_NORMAL_TABLE) {
176,765,476✔
407
        if (pME->colCmpr.nCols != 0) {
21,597,854✔
408
          TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
21,418,102✔
409
        } else {
410
          metaWarn("meta/entry: failed to get compress cols, type:%d", pME->type);
179,752✔
411
          SColCmprWrapper colCmprs = {0};
179,752✔
412
          int32_t code = metatInitDefaultSColCmprWrapper(NULL, &colCmprs, (SSchemaWrapper *)&pME->ntbEntry.schemaRow);
179,752✔
413
          if (code != 0) {
179,752✔
414
            taosMemoryFree(colCmprs.pColCmpr);
×
415
            TAOS_CHECK_RETURN(code);
×
416
          }
417
          code = metaEncodeComprEntryImpl(pCoder, &colCmprs);
179,752✔
418
          taosMemoryFree(colCmprs.pColCmpr);
179,752✔
419
          TAOS_CHECK_RETURN(code);
179,752✔
420
        }
421
      }
422
    }
423
    TAOS_CHECK_RETURN(metaEncodeExtSchema(pCoder, pME));
204,696,659✔
424
  }
425
  if (pME->type == TSDB_SUPER_TABLE) {
210,070,654✔
426
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->stbEntry.keep));
52,049,724✔
427
    TAOS_CHECK_RETURN(tEncodeI64v(pCoder, pME->stbEntry.ownerId));
51,988,234✔
428
  } else if (pME->type == TSDB_NORMAL_TABLE) {
184,020,200✔
429
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.ownerId));
43,195,708✔
430
  }
431

432
  tEndEncode(pCoder);
210,015,247✔
433
  return 0;
210,041,204✔
434
}
435

436
int metaDecodeEntryImpl(SDecoder *pCoder, SMetaEntry *pME, bool headerOnly) {
1,935,650,308✔
437
  TAOS_CHECK_RETURN(tStartDecode(pCoder));
1,935,650,308✔
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,936,327,293✔
443
    tEndDecode(pCoder);
336,746✔
444
    return 0;
336,746✔
445
  }
446

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

450
    if (pME->type == TSDB_SUPER_TABLE) {
1,935,794,320✔
451
      TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pME->flags));
1,776,149,057✔
452
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaRow));
1,776,235,673✔
453
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaTag));
1,776,049,653✔
454
      if (TABLE_IS_ROLLUP(pME->flags)) {
887,974,159✔
455
        TAOS_CHECK_RETURN(tDecodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
350,299✔
456
      }
457
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
1,047,237,956✔
458
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.btime));
1,634,267,739✔
459
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ctbEntry.ttlDays));
1,634,419,189✔
460
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ctbEntry.commentLen));
1,634,096,218✔
461
      if (pME->ctbEntry.commentLen > 0) {
816,885,442✔
462
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ctbEntry.comment));
51,438✔
463
      }
464
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.suid));
1,634,125,159✔
465
      TAOS_CHECK_RETURN(tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags));
817,168,209✔
466
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
230,497,161✔
467
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.btime));
461,102,327✔
468
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ntbEntry.ttlDays));
461,179,735✔
469
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.commentLen));
461,096,457✔
470
      if (pME->ntbEntry.commentLen > 0) {
230,504,484✔
471
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ntbEntry.comment));
39,234✔
472
      }
473
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.ncid));
461,031,219✔
474
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->ntbEntry.schemaRow));
461,128,305✔
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,935,537,492✔
486
      if (TABLE_IS_COL_COMPRESSED(pME->flags)) {
888,115,910✔
487
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
888,083,176✔
488

489
        if (pME->colCmpr.nCols == 0) {
887,996,353✔
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,047,231,367✔
497
      if (!tDecodeIsEnd(pCoder)) {
223,530,524✔
498
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
223,540,691✔
499
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
223,540,912✔
500
        if (pME->colCmpr.nCols == 0) {
223,545,247✔
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);
8✔
505
        TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->ntbEntry.schemaRow));
8✔
506
      }
507
      TABLE_SET_COL_COMPRESSED(pME->flags);
223,570,413✔
508
    } else if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
823,731,533✔
509
      if (!tDecodeIsEnd(pCoder)) {
36,560,655✔
510
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
36,561,268✔
511
        TAOS_CHECK_RETURN(meteDecodeColRefEntry(pCoder, pME));
36,561,268✔
512
      } else {
513
        uDebug("set default type: %d, tableName:%s", pME->type, pME->name);
×
514
        if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
13✔
515
           TAOS_CHECK_RETURN(metatInitDefaultSColRefWrapper(pCoder, &pME->colRef, &pME->ntbEntry.schemaRow));
×
516
        }
517
      }
518
    }
519
    if (!tDecodeIsEnd(pCoder)) {
1,935,638,236✔
520
      TAOS_CHECK_RETURN(metaDecodeExtSchemas(pCoder, pME));
1,111,618,629✔
521
    } else {
522
      pME->pExtSchemas = NULL;
824,019,607✔
523
    }
524
  }
525
  if (pME->type == TSDB_SUPER_TABLE) {
1,935,429,857✔
526
    if (!tDecodeIsEnd(pCoder)) {
887,927,933✔
527
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->stbEntry.keep));
1,775,898,380✔
528
    }
529
    if (!tDecodeIsEnd(pCoder)) {
887,893,202✔
530
      TAOS_CHECK_RETURN(tDecodeI64v(pCoder, &pME->stbEntry.ownerId));
1,775,904,298✔
531
    }
532
  } else if (pME->type == TSDB_NORMAL_TABLE) {
1,047,165,769✔
533
    if (!tDecodeIsEnd(pCoder)) {
223,551,275✔
534
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.ownerId));
447,165,532✔
535
    }
536
  }
537

538

539
  tEndDecode(pCoder);
1,935,215,493✔
540
  return 0;
1,935,272,474✔
541
}
542

543
int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { return metaDecodeEntryImpl(pCoder, pME, false); }
1,935,379,056✔
544

545
static int32_t metaCloneSchema(const SSchemaWrapper *pSrc, SSchemaWrapper *pDst) {
341,442,516✔
546
  if (pSrc == NULL || pDst == NULL) {
341,442,516✔
547
    return TSDB_CODE_INVALID_PARA;
18✔
548
  }
549

550
  pDst->nCols = pSrc->nCols;
341,469,992✔
551
  pDst->version = pSrc->version;
341,463,157✔
552
  pDst->pSchema = (SSchema *)taosMemoryMalloc(pSrc->nCols * sizeof(SSchema));
341,438,809✔
553
  if (pDst->pSchema == NULL) {
341,351,739✔
554
    return terrno;
×
555
  }
556
  memcpy(pDst->pSchema, pSrc->pSchema, pSrc->nCols * sizeof(SSchema));
341,386,440✔
557
  return TSDB_CODE_SUCCESS;
341,467,739✔
558
}
559

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

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

588
  return TSDB_CODE_SUCCESS;
77,145✔
589
}
590

591
static void metaCloneSchemaFree(SSchemaWrapper *pSchema) {
341,429,847✔
592
  if (pSchema) {
341,429,847✔
593
    taosMemoryFreeClear(pSchema->pSchema);
341,442,535✔
594
  }
595
}
341,417,122✔
596

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

610
void metaCloneEntryFree(SMetaEntry **ppEntry) {
200,713,385✔
611
  if (ppEntry == NULL || *ppEntry == NULL) {
200,713,385✔
612
    return;
80,518✔
613
  }
614

615
  taosMemoryFreeClear((*ppEntry)->name);
200,635,877✔
616

617
  if ((*ppEntry)->type < 0) {
200,641,033✔
618
    taosMemoryFreeClear(*ppEntry);
×
619
    return;
×
620
  }
621

622
  if (TSDB_SUPER_TABLE == (*ppEntry)->type) {
200,631,850✔
623
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaRow);
166,211,095✔
624
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaTag);
166,190,324✔
625
    if (TABLE_IS_ROLLUP((*ppEntry)->flags)) {
166,197,442✔
626
      metaFreeRsmaParam(&(*ppEntry)->stbEntry.rsmaParam, 1);
117,625✔
627
    }
628
  } else if (TSDB_CHILD_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_CHILD_TABLE == (*ppEntry)->type) {
34,419,591✔
629
    taosMemoryFreeClear((*ppEntry)->ctbEntry.comment);
25,394,702✔
630
    taosMemoryFreeClear((*ppEntry)->ctbEntry.pTags);
25,394,702✔
631
  } else if (TSDB_NORMAL_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_NORMAL_TABLE == (*ppEntry)->type) {
9,026,896✔
632
    metaCloneSchemaFree(&(*ppEntry)->ntbEntry.schemaRow);
9,026,896✔
633
    taosMemoryFreeClear((*ppEntry)->ntbEntry.comment);
9,026,896✔
634
  } else {
635
    return;
×
636
  }
637
  metaCloneColCmprFree(&(*ppEntry)->colCmpr);
200,635,456✔
638
  taosMemoryFreeClear((*ppEntry)->pExtSchemas);
200,591,004✔
639
  metaCloneColRefFree(&(*ppEntry)->colRef);
200,607,473✔
640

641
  taosMemoryFreeClear(*ppEntry);
200,596,587✔
642
  return;
200,601,472✔
643
}
644

645
int32_t metaCloneEntry(const SMetaEntry *pEntry, SMetaEntry **ppEntry) {
200,609,391✔
646
  int32_t code = TSDB_CODE_SUCCESS;
200,609,391✔
647

648
  if (NULL == pEntry || NULL == ppEntry) {
200,609,391✔
649
    return TSDB_CODE_INVALID_PARA;
×
650
  }
651

652
  *ppEntry = (SMetaEntry *)taosMemoryCalloc(1, sizeof(SMetaEntry));
200,641,894✔
653
  if (NULL == *ppEntry) {
200,577,270✔
654
    return terrno;
×
655
  }
656

657
  (*ppEntry)->version = pEntry->version;
200,596,858✔
658
  (*ppEntry)->type = pEntry->type;
200,635,202✔
659
  (*ppEntry)->uid = pEntry->uid;
200,626,494✔
660

661
  if (pEntry->type < 0) {
200,631,620✔
662
    return TSDB_CODE_SUCCESS;
×
663
  }
664

665
  if (pEntry->name) {
200,625,718✔
666
    (*ppEntry)->name = tstrdup(pEntry->name);
200,637,637✔
667
    if (NULL == (*ppEntry)->name) {
200,629,820✔
668
      code = terrno;
×
669
      metaCloneEntryFree(ppEntry);
×
670
      return code;
×
671
    }
672
  }
673

674
  if (pEntry->type == TSDB_SUPER_TABLE) {
200,635,659✔
675
    (*ppEntry)->flags = pEntry->flags;
166,219,605✔
676

677
    code = metaCloneSchema(&pEntry->stbEntry.schemaRow, &(*ppEntry)->stbEntry.schemaRow);
166,196,077✔
678
    if (code) {
166,214,006✔
679
      metaCloneEntryFree(ppEntry);
×
680
      return code;
×
681
    }
682

683
    code = metaCloneSchema(&pEntry->stbEntry.schemaTag, &(*ppEntry)->stbEntry.schemaTag);
166,214,006✔
684
    if (code) {
166,225,361✔
685
      metaCloneEntryFree(ppEntry);
×
686
      return code;
×
687
    }
688
    if (TABLE_IS_ROLLUP(pEntry->flags)) {
166,225,361✔
689
      code = metaCloneRsmaParam(&pEntry->stbEntry.rsmaParam, &(*ppEntry)->stbEntry.rsmaParam);
77,145✔
690
      if (code) {
77,145✔
691
        metaCloneEntryFree(ppEntry);
×
692
        return code;
×
693
      }
694
    }
695
    (*ppEntry)->stbEntry.keep = pEntry->stbEntry.keep;
166,219,640✔
696
    (*ppEntry)->stbEntry.ownerId = pEntry->stbEntry.ownerId;
166,208,353✔
697
  } else if (pEntry->type == TSDB_CHILD_TABLE || pEntry->type == TSDB_VIRTUAL_CHILD_TABLE) {
34,420,331✔
698
    (*ppEntry)->ctbEntry.btime = pEntry->ctbEntry.btime;
25,394,707✔
699
    (*ppEntry)->ctbEntry.ttlDays = pEntry->ctbEntry.ttlDays;
25,394,707✔
700
    (*ppEntry)->ctbEntry.suid = pEntry->ctbEntry.suid;
25,394,707✔
701

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

714
    // tags
715
    STag *pTags = (STag *)pEntry->ctbEntry.pTags;
25,394,707✔
716
    (*ppEntry)->ctbEntry.pTags = taosMemoryCalloc(1, pTags->len);
25,394,094✔
717
    if (NULL == (*ppEntry)->ctbEntry.pTags) {
25,394,707✔
718
      code = terrno;
×
719
      metaCloneEntryFree(ppEntry);
×
720
      return code;
×
721
    }
722
    memcpy((*ppEntry)->ctbEntry.pTags, pEntry->ctbEntry.pTags, pTags->len);
25,394,707✔
723
  } else if (pEntry->type == TSDB_NORMAL_TABLE || pEntry->type == TSDB_VIRTUAL_NORMAL_TABLE) {
9,026,237✔
724
    (*ppEntry)->ntbEntry.btime = pEntry->ntbEntry.btime;
9,026,896✔
725
    (*ppEntry)->ntbEntry.ttlDays = pEntry->ntbEntry.ttlDays;
9,026,896✔
726
    (*ppEntry)->ntbEntry.ncid = pEntry->ntbEntry.ncid;
9,026,896✔
727
    (*ppEntry)->ntbEntry.ownerId = pEntry->ntbEntry.ownerId;
9,026,896✔
728

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

736
    // comment
737
    (*ppEntry)->ntbEntry.commentLen = pEntry->ntbEntry.commentLen;
9,026,896✔
738
    if (pEntry->ntbEntry.commentLen > 0) {
9,026,896✔
739
      (*ppEntry)->ntbEntry.comment = taosMemoryMalloc(pEntry->ntbEntry.commentLen + 1);
6,077✔
740
      if (NULL == (*ppEntry)->ntbEntry.comment) {
6,077✔
741
        code = terrno;
×
742
        metaCloneEntryFree(ppEntry);
×
743
        return code;
×
744
      }
745
      memcpy((*ppEntry)->ntbEntry.comment, pEntry->ntbEntry.comment, pEntry->ntbEntry.commentLen + 1);
6,077✔
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) {
200,632,562✔
752
    code = metaCloneColRef(&pEntry->colRef, &(*ppEntry)->colRef);
1,282,174✔
753
    if (code) {
1,271,570✔
754
      metaCloneEntryFree(ppEntry);
×
755
      return code;
×
756
    }
757
  } else {
758
    code = metaCloneColCmpr(&pEntry->colCmpr, &(*ppEntry)->colCmpr);
199,360,201✔
759
    if (code) {
199,347,466✔
760
      metaCloneEntryFree(ppEntry);
13✔
761
      return code;
×
762
    }
763
  }
764
  if (pEntry->pExtSchemas && pEntry->colCmpr.nCols > 0) {
200,619,023✔
765
    (*ppEntry)->pExtSchemas = taosMemoryCalloc(pEntry->colCmpr.nCols, sizeof(SExtSchema));
9,780,391✔
766
    if (!(*ppEntry)->pExtSchemas) {
9,778,408✔
767
      code = terrno;
×
768
      metaCloneEntryFree(ppEntry);
×
769
      return code;
×
770
    }
771
    memcpy((*ppEntry)->pExtSchemas, pEntry->pExtSchemas, sizeof(SExtSchema) * pEntry->colCmpr.nCols);
9,775,056✔
772
  }
773

774
  return code;
200,627,258✔
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