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

taosdata / TDengine / #5007

29 Mar 2026 04:32AM UTC coverage: 72.25% (-0.02%) from 72.274%
#5007

push

travis-ci

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

253624 of 351039 relevant lines covered (72.25%)

132531546.97 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,247,085,620✔
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,111,018✔
26
    }
27
  }
28
  return false;
1,090,046,103✔
29
}
30

31
static int32_t metaEncodeExtSchema(SEncoder* pCoder, const SMetaEntry* pME) {
205,977,261✔
32
  if (pME->pExtSchemas) {
205,977,261✔
33
    const SSchemaWrapper *pSchWrapper = NULL;
12,515,218✔
34
    bool                  hasTypeMods = false;
12,515,218✔
35
    if (pME->type == TSDB_SUPER_TABLE) {
12,515,218✔
36
      pSchWrapper = &pME->stbEntry.schemaRow;
12,390,941✔
37
    } else if (pME->type == TSDB_NORMAL_TABLE) {
117,514✔
38
      pSchWrapper = &pME->ntbEntry.schemaRow;
117,496✔
39
    } else {
40
      return 0;
18✔
41
    }
42
    hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
12,502,150✔
43

44
    for (int32_t i = 0; i < pSchWrapper->nCols && hasTypeMods; ++i) {
1,298,257,364✔
45
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->pExtSchemas[i].typeMod));
2,147,483,647✔
46
    }
47
  }
48
  return 0;
205,994,801✔
49
}
50

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

57
  for (int32_t i = 0; i < pw->nCols; i++) {
447,823,986✔
58
    SColRef *p = &pw->pColRef[i];
445,892,781✔
59
    TAOS_CHECK_RETURN(tEncodeI8(pCoder, p->hasRef));
891,786,181✔
60
    TAOS_CHECK_RETURN(tEncodeI16v(pCoder, p->id));
891,786,800✔
61
    if (p->hasRef) {
445,892,781✔
62
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refDbName));
591,041,688✔
63
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refTableName));
591,041,688✔
64
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refColName));
591,039,212✔
65
    }
66
  }
67

68
  // Encode tag references
69
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nTagRefs));
3,867,362✔
70
  for (int32_t i = 0; i < pw->nTagRefs; i++) {
1,934,300✔
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,933,681✔
82
}
83

84
static int32_t metaDecodeExtSchemas(SDecoder* pDecoder, SMetaEntry* pME) {
1,187,905,877✔
85
  bool hasExtSchema = false;
1,187,905,877✔
86
  SSchemaWrapper* pSchWrapper = NULL;
1,187,905,877✔
87
  if (pME->type == TSDB_SUPER_TABLE) {
1,187,905,877✔
88
    pSchWrapper = &pME->stbEntry.schemaRow;
918,381,026✔
89
  } else if (pME->type == TSDB_NORMAL_TABLE) {
269,681,859✔
90
    pSchWrapper = &pME->ntbEntry.schemaRow;
269,742,434✔
91
  } else {
92
    return 0;
×
93
  }
94

95
  hasExtSchema = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
1,188,033,849✔
96
  if (hasExtSchema && pSchWrapper->nCols > 0) {
1,188,288,125✔
97
    pME->pExtSchemas = (SExtSchema*)tDecoderMalloc(pDecoder, sizeof(SExtSchema) * pSchWrapper->nCols);
295,455,634✔
98
    if (pME->pExtSchemas == NULL) {
147,735,018✔
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,040,554,561✔
107
  }
108

109
  return 0;
1,188,241,031✔
110
}
111

112
SExtSchema* metaGetSExtSchema(const SMetaEntry *pME) {
46,717,431✔
113
  const SSchemaWrapper *pSchWrapper = NULL;
46,717,431✔
114
  bool                  hasTypeMods = false;
46,717,431✔
115
  if (pME->type == TSDB_SUPER_TABLE) {
46,717,431✔
116
    pSchWrapper = &pME->stbEntry.schemaRow;
34,256,236✔
117
  } else if (pME->type == TSDB_NORMAL_TABLE) {
12,487,142✔
118
    pSchWrapper = &pME->ntbEntry.schemaRow;
12,502,477✔
119
  } else {
120
    return NULL;
×
121
  }
122
  hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
46,756,241✔
123

124
  if (hasTypeMods) {
46,717,044✔
125
    SExtSchema *ret = taosMemoryMalloc(sizeof(SExtSchema) * pSchWrapper->nCols);
28,525✔
126
    if (ret != NULL) {
28,525✔
127
      memcpy(ret, pME->pExtSchemas, pSchWrapper->nCols * sizeof(SExtSchema));
28,525✔
128
    }
129
    return ret;
28,525✔
130
  }
131
  return NULL;
46,688,519✔
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) {
46,815,606✔
191
  SColRefWrapper *pWrapper = &pME->colRef;
46,815,606✔
192
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
93,636,842✔
193
  if (pWrapper->nCols == 0) {
46,818,934✔
194
    return 0;
×
195
  }
196

197
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->version));
93,637,236✔
198
  uDebug("decode cols:%d", pWrapper->nCols);
46,821,809✔
199
  pWrapper->pColRef = (SColRef *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColRef));
93,632,338✔
200
  if (pWrapper->pColRef == NULL) {
46,812,199✔
201
    return terrno;
×
202
  }
203

204
  for (int i = 0; i < pWrapper->nCols; i++) {
796,856,330✔
205
    SColRef *p = &pWrapper->pColRef[i];
750,054,131✔
206
    TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&p->hasRef));
1,500,135,301✔
207
    TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &p->id));
1,500,177,757✔
208
    if (p->hasRef) {
750,108,954✔
209
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refDbName));
417,448,505✔
210
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refTableName));
417,440,980✔
211
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refColName));
417,444,535✔
212
    }
213
  }
214

215
  // Decode tag references (backward compatible)
216
  pWrapper->nTagRefs = 0;
46,778,677✔
217
  pWrapper->pTagRef = NULL;
46,823,039✔
218
  if (!tDecodeIsEnd(pDecoder)) {
46,822,420✔
219
    TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nTagRefs));
93,640,519✔
220
    if (pWrapper->nTagRefs > 0) {
46,818,706✔
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;
46,816,230✔
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,273,895✔
259
  if (pSrc->nCols > 0) {
1,273,895✔
260
    pDst->nCols = pSrc->nCols;
1,273,895✔
261
    pDst->version = pSrc->version;
1,273,895✔
262
    pDst->pColRef = (SColRef*)taosMemoryCalloc(pSrc->nCols, sizeof(SColRef));
1,272,657✔
263
    if (NULL == pDst->pColRef) {
1,272,657✔
264
      return terrno;
×
265
    }
266
    memcpy(pDst->pColRef, pSrc->pColRef, pSrc->nCols * sizeof(SColRef));
1,272,657✔
267
  }
268
  return 0;
1,273,895✔
269
}
270

271
static int32_t metaEncodeComprEntryImpl(SEncoder *pCoder, SColCmprWrapper *pw) {
47,924,962✔
272
  int32_t code = 0;
47,924,962✔
273
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
95,844,814✔
274
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
95,860,730✔
275
  uTrace("encode cols:%d", pw->nCols);
47,940,878✔
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,001,451✔
283
}
284
int meteEncodeColCmprEntry(SEncoder *pCoder, const SMetaEntry *pME) {
47,710,660✔
285
  const SColCmprWrapper *pw = &pME->colCmpr;
47,710,660✔
286
  return metaEncodeComprEntryImpl(pCoder, (SColCmprWrapper *)pw);
47,720,435✔
287
}
288
int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
1,187,934,727✔
289
  SColCmprWrapper *pWrapper = &pME->colCmpr;
1,187,934,727✔
290
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
2,147,483,647✔
291
  if (pWrapper->nCols == 0) {
1,188,148,651✔
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,187,746,820✔
297
  pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
2,147,483,647✔
298
  if (pWrapper->pColCmpr == NULL) {
1,188,190,683✔
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,188,557,856✔
308
}
309
static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder, SColCmprWrapper *pCmpr,
310
                                                            SSchemaWrapper *pSchema) {
311
  pCmpr->nCols = pSchema->nCols;
259,300✔
312

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

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

323
  for (int32_t i = 0; i < pCmpr->nCols; i++) {
1,284,932✔
324
    SColCmpr *pColCmpr = &pCmpr->pColCmpr[i];
1,025,632✔
325
    SSchema  *pColSchema = &pSchema->pSchema[i];
1,025,632✔
326
    pColCmpr->id = pColSchema->colId;
1,025,632✔
327
    pColCmpr->alg = createDefaultColCmprByType(pColSchema->type);
1,025,632✔
328
  }
329
  return 0;
259,300✔
330
}
331

332
static int32_t metaCloneColCmpr(const SColCmprWrapper *pSrc, SColCmprWrapper *pDst) {
203,705,996✔
333
  if (pSrc->nCols > 0) {
203,705,996✔
334
    pDst->nCols = pSrc->nCols;
175,592,268✔
335
    pDst->version = pSrc->version;
175,584,376✔
336
    pDst->pColCmpr = (SColCmpr *)taosMemoryCalloc(pSrc->nCols, sizeof(SColCmpr));
175,573,834✔
337
    if (NULL == pDst->pColCmpr) {
175,545,291✔
338
      return terrno;
×
339
    }
340
    memcpy(pDst->pColCmpr, pSrc->pColCmpr, pSrc->nCols * sizeof(SColCmpr));
175,557,840✔
341
  }
342
  return 0;
203,692,816✔
343
}
344

345
static void metaCloneColRefFree(SColRefWrapper *pColRef) {
204,974,044✔
346
  if (pColRef) {
204,974,044✔
347
    taosMemoryFreeClear(pColRef->pColRef);
204,986,929✔
348
  }
349
}
204,985,578✔
350

351
static void metaCloneColCmprFree(SColCmprWrapper *pCmpr) {
204,976,204✔
352
  if (pCmpr) {
204,976,204✔
353
    taosMemoryFreeClear(pCmpr->pColCmpr);
204,987,845✔
354
  }
355
}
204,978,755✔
356

357
int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
210,950,089✔
358
  TAOS_CHECK_RETURN(tStartEncode(pCoder));
210,950,089✔
359
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->version));
421,866,449✔
360
  TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->type));
421,859,892✔
361
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->uid));
421,883,971✔
362

363
  if (pME->type > 0) {
210,946,447✔
364
    if (pME->name == NULL) {
205,967,505✔
365
      return TSDB_CODE_INVALID_PARA;
×
366
    }
367

368
    TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->name));
411,945,884✔
369

370
    if (pME->type == TSDB_SUPER_TABLE) {
205,979,827✔
371
      TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->flags));
52,370,523✔
372
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaRow));
52,442,204✔
373
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaTag));
52,470,671✔
374
      if (TABLE_IS_ROLLUP(pME->flags)) {
26,209,211✔
375
        TAOS_CHECK_RETURN(tEncodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
112,787✔
376
      }
377
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
179,748,299✔
378
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.btime));
314,383,785✔
379
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ctbEntry.ttlDays));
314,388,579✔
380
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ctbEntry.commentLen));
314,398,452✔
381
      if (pME->ctbEntry.commentLen > 0) {
157,201,956✔
382
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ctbEntry.comment));
29,848✔
383
      }
384
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.suid));
314,395,469✔
385
      TAOS_CHECK_RETURN(tEncodeTag(pCoder, (const STag *)pME->ctbEntry.pTags));
157,193,825✔
386
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
22,572,030✔
387
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.btime));
45,144,060✔
388
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ntbEntry.ttlDays));
45,144,060✔
389
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.commentLen));
45,144,060✔
390
      if (pME->ntbEntry.commentLen > 0) {
22,572,030✔
391
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ntbEntry.comment));
18,936✔
392
      }
393
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.ncid));
45,144,060✔
394
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->ntbEntry.schemaRow));
45,144,060✔
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) {
205,980,720✔
402
      TAOS_CHECK_RETURN(meteEncodeColRefEntry(pCoder, pME));
2,007,915✔
403
    } else {
404
      if (pME->type == TSDB_SUPER_TABLE && TABLE_IS_COL_COMPRESSED(pME->flags)) {
203,970,061✔
405
        TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
26,210,856✔
406
      } else if (pME->type == TSDB_NORMAL_TABLE) {
177,848,707✔
407
        if (pME->colCmpr.nCols != 0) {
21,765,972✔
408
          TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
21,506,672✔
409
        } else {
410
          metaWarn("meta/entry: failed to get compress cols, type:%d", pME->type);
259,300✔
411
          SColCmprWrapper colCmprs = {0};
259,300✔
412
          int32_t code = metatInitDefaultSColCmprWrapper(NULL, &colCmprs, (SSchemaWrapper *)&pME->ntbEntry.schemaRow);
259,300✔
413
          if (code != 0) {
259,300✔
414
            taosMemoryFree(colCmprs.pColCmpr);
×
415
            TAOS_CHECK_RETURN(code);
×
416
          }
417
          code = metaEncodeComprEntryImpl(pCoder, &colCmprs);
259,300✔
418
          taosMemoryFree(colCmprs.pColCmpr);
259,300✔
419
          TAOS_CHECK_RETURN(code);
259,300✔
420
        }
421
      }
422
    }
423
    TAOS_CHECK_RETURN(metaEncodeExtSchema(pCoder, pME));
206,009,223✔
424
  }
425
  if (pME->type == TSDB_SUPER_TABLE) {
210,962,096✔
426
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->stbEntry.keep));
52,406,502✔
427
    TAOS_CHECK_RETURN(tEncodeI64v(pCoder, pME->stbEntry.ownerId));
52,369,903✔
428
  } else if (pME->type == TSDB_NORMAL_TABLE) {
184,697,016✔
429
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.ownerId));
43,531,944✔
430
  }
431

432
  tEndEncode(pCoder);
210,907,696✔
433
  return 0;
210,909,631✔
434
}
435

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

442
  if (headerOnly) {
2,052,109,339✔
443
    tEndDecode(pCoder);
323,528✔
444
    return 0;
323,528✔
445
  }
446

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

450
    if (pME->type == TSDB_SUPER_TABLE) {
2,051,596,834✔
451
      TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pME->flags));
1,837,126,000✔
452
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaRow));
1,837,205,660✔
453
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaTag));
1,836,962,925✔
454
      if (TABLE_IS_ROLLUP(pME->flags)) {
918,416,101✔
455
        TAOS_CHECK_RETURN(tDecodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
344,187✔
456
      }
457
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
1,132,489,386✔
458
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.btime));
1,710,245,536✔
459
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ctbEntry.ttlDays));
1,710,425,129✔
460
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ctbEntry.commentLen));
1,710,145,992✔
461
      if (pME->ctbEntry.commentLen > 0) {
854,930,874✔
462
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ctbEntry.comment));
51,652✔
463
      }
464
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.suid));
1,710,146,413✔
465
      TAOS_CHECK_RETURN(tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags));
855,206,707✔
466
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
277,787,833✔
467
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.btime));
555,760,627✔
468
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ntbEntry.ttlDays));
555,868,398✔
469
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.commentLen));
555,769,227✔
470
      if (pME->ntbEntry.commentLen > 0) {
277,828,369✔
471
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ntbEntry.comment));
39,376✔
472
      }
473
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.ncid));
555,682,355✔
474
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->ntbEntry.schemaRow));
555,813,316✔
475
    } else if (pME->type == TSDB_TSMA_TABLE) {
×
476
      pME->smaEntry.tsma = tDecoderMalloc(pCoder, sizeof(STSma));
×
477
      if (!pME->smaEntry.tsma) {
×
478
        return terrno;
×
479
      }
480
      TAOS_CHECK_RETURN(tDecodeTSma(pCoder, pME->smaEntry.tsma, true));
×
481
    } else {
482
      metaError("meta/entry: invalide table type: %" PRId8 " decode failed.", pME->type);
×
483
      return TSDB_CODE_INVALID_PARA;
×
484
    }
485
    if (pME->type == TSDB_SUPER_TABLE) {
2,051,326,059✔
486
      if (TABLE_IS_COL_COMPRESSED(pME->flags)) {
918,594,650✔
487
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
918,571,840✔
488

489
        if (pME->colCmpr.nCols == 0) {
918,447,111✔
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,132,492,791✔
497
      if (!tDecodeIsEnd(pCoder)) {
269,744,499✔
498
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
269,781,690✔
499
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
269,781,690✔
500
        if (pME->colCmpr.nCols == 0) {
269,782,431✔
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);
269,824,766✔
508
    } else if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
862,746,814✔
509
      if (!tDecodeIsEnd(pCoder)) {
46,822,021✔
510
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
46,821,402✔
511
        TAOS_CHECK_RETURN(meteDecodeColRefEntry(pCoder, pME));
46,821,402✔
512
      } else {
513
        uDebug("set default type: %d, tableName:%s", pME->type, pME->name);
619✔
514
        if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
637✔
515
           TAOS_CHECK_RETURN(metatInitDefaultSColRefWrapper(pCoder, &pME->colRef, &pME->ntbEntry.schemaRow));
×
516
        }
517
      }
518
    }
519
    if (!tDecodeIsEnd(pCoder)) {
2,051,435,668✔
520
      TAOS_CHECK_RETURN(metaDecodeExtSchemas(pCoder, pME));
1,188,356,933✔
521
    } else {
522
      pME->pExtSchemas = NULL;
863,078,735✔
523
    }
524
  }
525
  if (pME->type == TSDB_SUPER_TABLE) {
2,051,211,087✔
526
    if (!tDecodeIsEnd(pCoder)) {
918,391,330✔
527
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->stbEntry.keep));
1,836,787,812✔
528
    }
529
    if (!tDecodeIsEnd(pCoder)) {
918,321,728✔
530
      TAOS_CHECK_RETURN(tDecodeI64v(pCoder, &pME->stbEntry.ownerId));
1,836,828,956✔
531
    }
532
  } else if (pME->type == TSDB_NORMAL_TABLE) {
1,132,310,104✔
533
    if (!tDecodeIsEnd(pCoder)) {
269,812,002✔
534
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.ownerId));
539,669,874✔
535
    }
536
  }
537

538

539
  tEndDecode(pCoder);
2,050,950,977✔
540
  return 0;
2,050,990,537✔
541
}
542

543
int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { return metaDecodeEntryImpl(pCoder, pME, false); }
2,051,132,274✔
544

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

550
  pDst->nCols = pSrc->nCols;
343,043,349✔
551
  pDst->version = pSrc->version;
343,022,190✔
552
  pDst->pSchema = (SSchema *)taosMemoryMalloc(pSrc->nCols * sizeof(SSchema));
343,001,771✔
553
  if (pDst->pSchema == NULL) {
342,911,700✔
554
    return terrno;
×
555
  }
556
  memcpy(pDst->pSchema, pSrc->pSchema, pSrc->nCols * sizeof(SSchema));
342,936,303✔
557
  return TSDB_CODE_SUCCESS;
343,046,504✔
558
}
559

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

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

588
  return TSDB_CODE_SUCCESS;
76,119✔
589
}
590

591
static void metaCloneSchemaFree(SSchemaWrapper *pSchema) {
342,972,228✔
592
  if (pSchema) {
342,972,228✔
593
    taosMemoryFreeClear(pSchema->pSchema);
343,007,877✔
594
  }
595
}
342,944,224✔
596

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

610
void metaCloneEntryFree(SMetaEntry **ppEntry) {
205,061,253✔
611
  if (ppEntry == NULL || *ppEntry == NULL) {
205,061,253✔
612
    return;
79,970✔
613
  }
614

615
  taosMemoryFreeClear((*ppEntry)->name);
204,990,431✔
616

617
  if ((*ppEntry)->type < 0) {
204,989,381✔
618
    taosMemoryFreeClear(*ppEntry);
×
619
    return;
×
620
  }
621

622
  if (TSDB_SUPER_TABLE == (*ppEntry)->type) {
204,965,503✔
623
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaRow);
166,927,484✔
624
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaTag);
166,935,845✔
625
    if (TABLE_IS_ROLLUP((*ppEntry)->flags)) {
166,937,092✔
626
      metaFreeRsmaParam(&(*ppEntry)->stbEntry.rsmaParam, 1);
116,061✔
627
    }
628
  } else if (TSDB_CHILD_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_CHILD_TABLE == (*ppEntry)->type) {
38,017,075✔
629
    taosMemoryFreeClear((*ppEntry)->ctbEntry.comment);
28,918,372✔
630
    taosMemoryFreeClear((*ppEntry)->ctbEntry.pTags);
28,919,066✔
631
  } else if (TSDB_NORMAL_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_NORMAL_TABLE == (*ppEntry)->type) {
9,105,486✔
632
    metaCloneSchemaFree(&(*ppEntry)->ntbEntry.schemaRow);
9,105,486✔
633
    taosMemoryFreeClear((*ppEntry)->ntbEntry.comment);
9,105,486✔
634
  } else {
635
    return;
×
636
  }
637
  metaCloneColCmprFree(&(*ppEntry)->colCmpr);
204,977,940✔
638
  taosMemoryFreeClear((*ppEntry)->pExtSchemas);
204,947,634✔
639
  metaCloneColRefFree(&(*ppEntry)->colRef);
204,947,835✔
640

641
  taosMemoryFreeClear(*ppEntry);
204,930,908✔
642
  return;
204,952,880✔
643
}
644

645
int32_t metaCloneEntry(const SMetaEntry *pEntry, SMetaEntry **ppEntry) {
204,958,532✔
646
  int32_t code = TSDB_CODE_SUCCESS;
204,958,532✔
647

648
  if (NULL == pEntry || NULL == ppEntry) {
204,958,532✔
649
    return TSDB_CODE_INVALID_PARA;
×
650
  }
651

652
  *ppEntry = (SMetaEntry *)taosMemoryCalloc(1, sizeof(SMetaEntry));
204,992,561✔
653
  if (NULL == *ppEntry) {
204,917,294✔
654
    return terrno;
×
655
  }
656

657
  (*ppEntry)->version = pEntry->version;
204,944,819✔
658
  (*ppEntry)->type = pEntry->type;
204,985,114✔
659
  (*ppEntry)->uid = pEntry->uid;
204,965,307✔
660

661
  if (pEntry->type < 0) {
204,984,374✔
662
    return TSDB_CODE_SUCCESS;
×
663
  }
664

665
  if (pEntry->name) {
204,961,874✔
666
    (*ppEntry)->name = tstrdup(pEntry->name);
204,983,810✔
667
    if (NULL == (*ppEntry)->name) {
204,992,127✔
668
      code = terrno;
×
669
      metaCloneEntryFree(ppEntry);
×
670
      return code;
×
671
    }
672
  }
673

674
  if (pEntry->type == TSDB_SUPER_TABLE) {
204,988,191✔
675
    (*ppEntry)->flags = pEntry->flags;
166,956,444✔
676

677
    code = metaCloneSchema(&pEntry->stbEntry.schemaRow, &(*ppEntry)->stbEntry.schemaRow);
166,946,578✔
678
    if (code) {
166,964,701✔
679
      metaCloneEntryFree(ppEntry);
×
680
      return code;
×
681
    }
682

683
    code = metaCloneSchema(&pEntry->stbEntry.schemaTag, &(*ppEntry)->stbEntry.schemaTag);
166,964,701✔
684
    if (code) {
166,985,184✔
685
      metaCloneEntryFree(ppEntry);
×
686
      return code;
×
687
    }
688
    if (TABLE_IS_ROLLUP(pEntry->flags)) {
166,985,184✔
689
      code = metaCloneRsmaParam(&pEntry->stbEntry.rsmaParam, &(*ppEntry)->stbEntry.rsmaParam);
76,119✔
690
      if (code) {
76,119✔
691
        metaCloneEntryFree(ppEntry);
×
692
        return code;
×
693
      }
694
    }
695
    (*ppEntry)->stbEntry.keep = pEntry->stbEntry.keep;
166,976,300✔
696
    (*ppEntry)->stbEntry.ownerId = pEntry->stbEntry.ownerId;
166,955,413✔
697
  } else if (pEntry->type == TSDB_CHILD_TABLE || pEntry->type == TSDB_VIRTUAL_CHILD_TABLE) {
38,018,560✔
698
    (*ppEntry)->ctbEntry.btime = pEntry->ctbEntry.btime;
28,915,521✔
699
    (*ppEntry)->ctbEntry.ttlDays = pEntry->ctbEntry.ttlDays;
28,913,439✔
700
    (*ppEntry)->ctbEntry.suid = pEntry->ctbEntry.suid;
28,917,678✔
701

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

714
    // tags
715
    STag *pTags = (STag *)pEntry->ctbEntry.pTags;
28,917,603✔
716
    (*ppEntry)->ctbEntry.pTags = taosMemoryCalloc(1, pTags->len);
28,913,439✔
717
    if (NULL == (*ppEntry)->ctbEntry.pTags) {
28,919,685✔
718
      code = terrno;
×
719
      metaCloneEntryFree(ppEntry);
×
720
      return code;
×
721
    }
722
    memcpy((*ppEntry)->ctbEntry.pTags, pEntry->ctbEntry.pTags, pTags->len);
28,916,215✔
723
  } else if (pEntry->type == TSDB_NORMAL_TABLE || pEntry->type == TSDB_VIRTUAL_NORMAL_TABLE) {
9,105,486✔
724
    (*ppEntry)->ntbEntry.btime = pEntry->ntbEntry.btime;
9,105,486✔
725
    (*ppEntry)->ntbEntry.ttlDays = pEntry->ntbEntry.ttlDays;
9,105,486✔
726
    (*ppEntry)->ntbEntry.ncid = pEntry->ntbEntry.ncid;
9,105,486✔
727
    (*ppEntry)->ntbEntry.ownerId = pEntry->ntbEntry.ownerId;
9,105,486✔
728

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

736
    // comment
737
    (*ppEntry)->ntbEntry.commentLen = pEntry->ntbEntry.commentLen;
9,105,486✔
738
    if (pEntry->ntbEntry.commentLen > 0) {
9,105,486✔
739
      (*ppEntry)->ntbEntry.comment = taosMemoryMalloc(pEntry->ntbEntry.commentLen + 1);
6,088✔
740
      if (NULL == (*ppEntry)->ntbEntry.comment) {
6,088✔
741
        code = terrno;
×
742
        metaCloneEntryFree(ppEntry);
×
743
        return code;
×
744
      }
745
      memcpy((*ppEntry)->ntbEntry.comment, pEntry->ntbEntry.comment, pEntry->ntbEntry.commentLen + 1);
6,088✔
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) {
204,976,791✔
752
    code = metaCloneColRef(&pEntry->colRef, &(*ppEntry)->colRef);
1,288,161✔
753
    if (code) {
1,273,895✔
754
      metaCloneEntryFree(ppEntry);
×
755
      return code;
×
756
    }
757
  } else {
758
    code = metaCloneColCmpr(&pEntry->colCmpr, &(*ppEntry)->colCmpr);
203,705,263✔
759
    if (code) {
203,690,248✔
760
      metaCloneEntryFree(ppEntry);
×
761
      return code;
×
762
    }
763
  }
764
  if (pEntry->pExtSchemas && pEntry->colCmpr.nCols > 0) {
204,964,179✔
765
    (*ppEntry)->pExtSchemas = taosMemoryCalloc(pEntry->colCmpr.nCols, sizeof(SExtSchema));
9,834,040✔
766
    if (!(*ppEntry)->pExtSchemas) {
9,828,041✔
767
      code = terrno;
×
768
      metaCloneEntryFree(ppEntry);
×
769
      return code;
×
770
    }
771
    memcpy((*ppEntry)->pExtSchemas, pEntry->pExtSchemas, sizeof(SExtSchema) * pEntry->colCmpr.nCols);
9,826,260✔
772
  }
773

774
  return code;
204,967,877✔
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