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

taosdata / TDengine / #5015

03 Apr 2026 03:59PM UTC coverage: 72.289% (+0.03%) from 72.256%
#5015

push

travis-ci

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

4055 of 5985 new or added lines in 68 files covered. (67.75%)

13044 existing lines in 149 files now uncovered.

257390 of 356056 relevant lines covered (72.29%)

130247228.09 hits per line

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

78.71
/source/dnode/vnode/src/meta/metaEntry.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15

16
#include "meta.h"
17
#include "osMemPool.h"
18
#include "osMemory.h"
19
#include "tencode.h"
20
#include "tmsg.h"
21

22
static bool schemasHasTypeMod(const SSchema *pSchema, int32_t nCols) {
1,275,493,675✔
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,026,032✔
26
    }
27
  }
28
  return false;
1,116,289,986✔
29
}
30

31
static int32_t metaEncodeExtSchema(SEncoder* pCoder, const SMetaEntry* pME) {
208,637,416✔
32
  if (pME->pExtSchemas) {
208,637,416✔
33
    const SSchemaWrapper *pSchWrapper = NULL;
12,541,500✔
34
    bool                  hasTypeMods = false;
12,541,500✔
35
    if (pME->type == TSDB_SUPER_TABLE) {
12,541,500✔
36
      pSchWrapper = &pME->stbEntry.schemaRow;
12,435,983✔
37
    } else if (pME->type == TSDB_NORMAL_TABLE) {
101,968✔
38
      pSchWrapper = &pME->ntbEntry.schemaRow;
101,968✔
39
    } else {
40
      return 0;
×
41
    }
42
    hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
12,541,219✔
43

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

51
int meteEncodeColRefEntry(SEncoder *pCoder, const SMetaEntry *pME) {
2,014,410✔
52
  const SColRefWrapper *pw = &pME->colRef;
2,014,410✔
53
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
4,028,820✔
54
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
4,028,820✔
55
  uTrace("encode cols:%d", pw->nCols);
2,014,410✔
56

57
  for (int32_t i = 0; i < pw->nCols; i++) {
456,793,428✔
58
    SColRef *p = &pw->pColRef[i];
454,779,018✔
59
    TAOS_CHECK_RETURN(tEncodeI8(pCoder, p->hasRef));
909,558,036✔
60
    TAOS_CHECK_RETURN(tEncodeI16v(pCoder, p->id));
909,558,036✔
61
    if (p->hasRef) {
454,779,018✔
62
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refDbName));
602,636,456✔
63
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refTableName));
602,636,456✔
64
      TAOS_CHECK_RETURN(tEncodeCStr(pCoder, p->refColName));
602,636,456✔
65
    }
66
  }
67

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

81
  return 0;
2,014,410✔
82
}
83

84
static int32_t metaDecodeExtSchemas(SDecoder* pDecoder, SMetaEntry* pME) {
1,215,867,428✔
85
  bool hasExtSchema = false;
1,215,867,428✔
86
  SSchemaWrapper* pSchWrapper = NULL;
1,215,867,428✔
87
  if (pME->type == TSDB_SUPER_TABLE) {
1,215,867,428✔
88
    pSchWrapper = &pME->stbEntry.schemaRow;
930,932,114✔
89
  } else if (pME->type == TSDB_NORMAL_TABLE) {
285,015,362✔
90
    pSchWrapper = &pME->ntbEntry.schemaRow;
285,064,058✔
91
  } else {
92
    return 0;
×
93
  }
94

95
  hasExtSchema = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
1,215,928,435✔
96
  if (hasExtSchema && pSchWrapper->nCols > 0) {
1,216,131,656✔
97
    pME->pExtSchemas = (SExtSchema*)tDecoderMalloc(pDecoder, sizeof(SExtSchema) * pSchWrapper->nCols);
297,293,807✔
98
    if (pME->pExtSchemas == NULL) {
148,649,170✔
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,067,481,430✔
107
  }
108

109
  return 0;
1,216,147,451✔
110
}
111

112
SExtSchema* metaGetSExtSchema(const SMetaEntry *pME) {
47,105,338✔
113
  const SSchemaWrapper *pSchWrapper = NULL;
47,105,338✔
114
  bool                  hasTypeMods = false;
47,105,338✔
115
  if (pME->type == TSDB_SUPER_TABLE) {
47,105,338✔
116
    pSchWrapper = &pME->stbEntry.schemaRow;
34,294,722✔
117
  } else if (pME->type == TSDB_NORMAL_TABLE) {
12,837,533✔
118
    pSchWrapper = &pME->ntbEntry.schemaRow;
12,841,706✔
119
  } else {
120
    return NULL;
×
121
  }
122
  hasTypeMods = schemasHasTypeMod(pSchWrapper->pSchema, pSchWrapper->nCols);
47,135,845✔
123

124
  if (hasTypeMods) {
47,105,663✔
125
    SExtSchema *ret = taosMemoryMalloc(sizeof(SExtSchema) * pSchWrapper->nCols);
28,623✔
126
    if (ret != NULL) {
28,623✔
127
      memcpy(ret, pME->pExtSchemas, pSchWrapper->nCols * sizeof(SExtSchema));
28,623✔
128
    }
129
    return ret;
28,623✔
130
  }
131
  return NULL;
47,077,040✔
132
}
133

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

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

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

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

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

164
  func_id_t *pFuncIds = (*rsmaSchema)->funcIds;
28,120✔
165
  int32_t    i = 0, j = 0;
28,120✔
166
  for (i = 0; i < nCols; ++i) {
212,800✔
167
    while (j < pParam->nFuncs) {
335,920✔
168
      if (pParam->funcColIds[j] == pSchema[i].colId) {
322,240✔
169
        pFuncIds[i] = pParam->funcIds[j];
150,480✔
170
        break;
150,480✔
171
      }
172
      if (pParam->funcColIds[j] > pSchema[i].colId) {
171,760✔
173
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
34,200✔
174
        break;
34,200✔
175
      }
176
      ++j;
137,560✔
177
    }
178
    if (j >= pParam->nFuncs) {
198,360✔
179
      for (; i < nCols; ++i) {
27,360✔
180
        pFuncIds[i] = 36;  // use last if not specified, fmGetFuncId("last") = 36
13,680✔
181
      }
182
      break;
13,680✔
183
    }
184
  }
185
  pFuncIds[0] = 0;  // Primary TS column has no function
28,120✔
186

187
  return 0;
28,120✔
188
}
189

190
int meteDecodeColRefEntry(SDecoder *pDecoder, SMetaEntry *pME) {
39,897,145✔
191
  SColRefWrapper *pWrapper = &pME->colRef;
39,897,145✔
192
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
79,807,675✔
193
  if (pWrapper->nCols == 0) {
39,902,292✔
194
    return 0;
×
195
  }
196

197
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->version));
79,801,629✔
198
  uDebug("decode cols:%d", pWrapper->nCols);
39,903,099✔
199
  pWrapper->pColRef = (SColRef *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColRef));
79,802,019✔
200
  if (pWrapper->pColRef == NULL) {
39,898,735✔
201
    return terrno;
×
202
  }
203

204
  for (int i = 0; i < pWrapper->nCols; i++) {
677,942,293✔
205
    SColRef *p = &pWrapper->pColRef[i];
638,044,797✔
206
    TAOS_CHECK_RETURN(tDecodeI8(pDecoder, (int8_t *)&p->hasRef));
1,276,099,473✔
207
    TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &p->id));
1,276,122,882✔
208
    if (p->hasRef) {
638,067,665✔
209
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refDbName));
362,014,609✔
210
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refTableName));
362,008,005✔
211
      TAOS_CHECK_RETURN(tDecodeCStrTo(pDecoder, p->refColName));
362,013,957✔
212
    }
213
  }
214

215
  // Decode tag references (backward compatible)
216
  pWrapper->nTagRefs = 0;
39,886,950✔
217
  pWrapper->pTagRef = NULL;
39,908,053✔
218
  if (!tDecodeIsEnd(pDecoder)) {
39,904,805✔
219
    TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nTagRefs));
79,810,893✔
220
    if (pWrapper->nTagRefs > 0) {
39,904,848✔
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,900,626✔
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,286,264✔
259
  if (pSrc->nCols > 0) {
1,286,264✔
260
    pDst->nCols = pSrc->nCols;
1,287,510✔
261
    pDst->version = pSrc->version;
1,288,133✔
262
    pDst->pColRef = (SColRef*)taosMemoryCalloc(pSrc->nCols, sizeof(SColRef));
1,288,133✔
263
    if (NULL == pDst->pColRef) {
1,285,641✔
264
      return terrno;
×
265
    }
266
    memcpy(pDst->pColRef, pSrc->pColRef, pSrc->nCols * sizeof(SColRef));
1,285,641✔
267
  }
268
  return 0;
1,286,887✔
269
}
270

271
static int32_t metaEncodeComprEntryImpl(SEncoder *pCoder, SColCmprWrapper *pw) {
49,033,883✔
272
  int32_t code = 0;
49,033,883✔
273
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
98,042,153✔
274
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
98,063,574✔
275
  uTrace("encode cols:%d", pw->nCols);
49,055,304✔
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;
49,080,255✔
283
}
284
int meteEncodeColCmprEntry(SEncoder *pCoder, const SMetaEntry *pME) {
48,837,209✔
285
  const SColCmprWrapper *pw = &pME->colCmpr;
48,837,209✔
286
  return metaEncodeComprEntryImpl(pCoder, (SColCmprWrapper *)pw);
48,832,438✔
287
}
288
int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
1,215,880,852✔
289
  SColCmprWrapper *pWrapper = &pME->colCmpr;
1,215,880,852✔
290
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
2,147,483,647✔
291
  if (pWrapper->nCols == 0) {
1,216,004,955✔
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,215,844,933✔
297
  pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
2,147,483,647✔
298
  if (pWrapper->pColCmpr == NULL) {
1,216,103,843✔
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,216,404,699✔
308
}
309
static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder, SColCmprWrapper *pCmpr,
310
                                                            SSchemaWrapper *pSchema) {
311
  pCmpr->nCols = pSchema->nCols;
259,702✔
312

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

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

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

332
static int32_t metaCloneColCmpr(const SColCmprWrapper *pSrc, SColCmprWrapper *pDst) {
203,921,709✔
333
  if (pSrc->nCols > 0) {
203,921,709✔
334
    pDst->nCols = pSrc->nCols;
177,725,011✔
335
    pDst->version = pSrc->version;
177,724,754✔
336
    pDst->pColCmpr = (SColCmpr *)taosMemoryCalloc(pSrc->nCols, sizeof(SColCmpr));
177,721,858✔
337
    if (NULL == pDst->pColCmpr) {
177,696,330✔
338
      return terrno;
×
339
    }
340
    memcpy(pDst->pColCmpr, pSrc->pColCmpr, pSrc->nCols * sizeof(SColCmpr));
177,707,430✔
341
  }
342
  return 0;
203,923,055✔
343
}
344

345
static void metaCloneColRefFree(SColRefWrapper *pColRef) {
205,191,665✔
346
  if (pColRef) {
205,191,665✔
347
    taosMemoryFreeClear(pColRef->pColRef);
205,206,947✔
348
  }
349
}
205,208,958✔
350

351
static void metaCloneColCmprFree(SColCmprWrapper *pCmpr) {
205,196,303✔
352
  if (pCmpr) {
205,196,303✔
353
    taosMemoryFreeClear(pCmpr->pColCmpr);
205,209,619✔
354
  }
355
}
205,195,234✔
356

357
int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
213,989,014✔
358
  TAOS_CHECK_RETURN(tStartEncode(pCoder));
213,989,014✔
359
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->version));
427,986,853✔
360
  TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->type));
427,962,689✔
361
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->uid));
427,988,886✔
362

363
  if (pME->type > 0) {
213,998,022✔
364
    if (pME->name == NULL) {
208,640,690✔
365
      return TSDB_CODE_INVALID_PARA;
×
366
    }
367

368
    TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->name));
417,276,306✔
369

370
    if (pME->type == TSDB_SUPER_TABLE) {
208,650,775✔
371
      TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->flags));
53,243,228✔
372
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaRow));
53,297,745✔
373
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaTag));
53,341,623✔
374
      if (TABLE_IS_ROLLUP(pME->flags)) {
26,654,813✔
375
        TAOS_CHECK_RETURN(tEncodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
114,592✔
376
      }
377
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
181,995,102✔
378
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.btime));
317,483,392✔
379
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ctbEntry.ttlDays));
317,497,286✔
380
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ctbEntry.commentLen));
317,502,209✔
381
      if (pME->ctbEntry.commentLen > 0) {
158,748,072✔
382
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ctbEntry.comment));
30,216✔
383
      }
384
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.suid));
317,489,869✔
385
      TAOS_CHECK_RETURN(tEncodeTag(pCoder, (const STag *)pME->ctbEntry.pTags));
158,743,600✔
386
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
23,268,096✔
387
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.btime));
46,536,192✔
388
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ntbEntry.ttlDays));
46,536,192✔
389
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.commentLen));
46,536,192✔
390
      if (pME->ntbEntry.commentLen > 0) {
23,268,096✔
391
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ntbEntry.comment));
19,176✔
392
      }
393
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.ncid));
46,536,192✔
394
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->ntbEntry.schemaRow));
46,536,192✔
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) {
208,653,465✔
402
      TAOS_CHECK_RETURN(meteEncodeColRefEntry(pCoder, pME));
2,082,846✔
403
    } else {
404
      if (pME->type == TSDB_SUPER_TABLE && TABLE_IS_COL_COMPRESSED(pME->flags)) {
206,592,421✔
405
        TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
26,653,011✔
406
      } else if (pME->type == TSDB_NORMAL_TABLE) {
180,004,402✔
407
        if (pME->colCmpr.nCols != 0) {
22,430,028✔
408
          TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
22,170,326✔
409
        } else {
410
          metaWarn("meta/entry: failed to get compress cols, type:%d", pME->type);
259,702✔
411
          SColCmprWrapper colCmprs = {0};
259,702✔
412
          int32_t code = metatInitDefaultSColCmprWrapper(NULL, &colCmprs, (SSchemaWrapper *)&pME->ntbEntry.schemaRow);
259,702✔
413
          if (code != 0) {
259,702✔
414
            taosMemoryFree(colCmprs.pColCmpr);
×
415
            TAOS_CHECK_RETURN(code);
×
416
          }
417
          code = metaEncodeComprEntryImpl(pCoder, &colCmprs);
259,702✔
418
          taosMemoryFree(colCmprs.pColCmpr);
259,702✔
419
          TAOS_CHECK_RETURN(code);
259,702✔
420
        }
421
      }
422
    }
423
    TAOS_CHECK_RETURN(metaEncodeExtSchema(pCoder, pME));
208,660,729✔
424
  }
425
  if (pME->type == TSDB_SUPER_TABLE) {
214,009,235✔
426
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->stbEntry.keep));
53,271,256✔
427
    TAOS_CHECK_RETURN(tEncodeI64v(pCoder, pME->stbEntry.ownerId));
53,225,282✔
428
  } else if (pME->type == TSDB_NORMAL_TABLE) {
187,316,342✔
429
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.ownerId));
44,860,056✔
430
  }
431

432
  tEndEncode(pCoder);
213,948,913✔
433
  return 0;
213,969,960✔
434
}
435

436
int metaDecodeEntryImpl(SDecoder *pCoder, SMetaEntry *pME, bool headerOnly) {
2,049,465,558✔
437
  TAOS_CHECK_RETURN(tStartDecode(pCoder));
2,049,465,558✔
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,050,274,168✔
443
    tEndDecode(pCoder);
324,248✔
444
    return 0;
324,248✔
445
  }
446

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

450
    if (pME->type == TSDB_SUPER_TABLE) {
2,049,840,570✔
451
      TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pME->flags));
1,862,298,715✔
452
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaRow));
1,862,378,854✔
453
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaTag));
1,862,161,537✔
454
      if (TABLE_IS_ROLLUP(pME->flags)) {
931,034,760✔
455
        TAOS_CHECK_RETURN(tDecodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
348,144✔
456
      }
457
    } else if (pME->type == TSDB_CHILD_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
1,118,207,386✔
458
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.btime));
1,653,072,626✔
459
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ctbEntry.ttlDays));
1,653,186,476✔
460
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ctbEntry.commentLen));
1,653,022,550✔
461
      if (pME->ctbEntry.commentLen > 0) {
826,437,794✔
462
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ctbEntry.comment));
52,278✔
463
      }
464
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.suid));
1,652,988,970✔
465
      TAOS_CHECK_RETURN(tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags));
826,595,114✔
466
    } else if (pME->type == TSDB_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
291,981,754✔
467
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.btime));
584,137,447✔
468
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ntbEntry.ttlDays));
584,198,850✔
469
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.commentLen));
584,118,946✔
470
      if (pME->ntbEntry.commentLen > 0) {
292,022,180✔
471
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ntbEntry.comment));
39,858✔
472
      }
473
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.ncid));
584,055,310✔
474
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->ntbEntry.schemaRow));
584,128,893✔
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,049,571,115✔
486
      if (TABLE_IS_COL_COMPRESSED(pME->flags)) {
931,146,294✔
487
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
931,162,520✔
488

489
        if (pME->colCmpr.nCols == 0) {
931,032,359✔
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,118,172,808✔
497
      if (!tDecodeIsEnd(pCoder)) {
285,060,392✔
498
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
285,086,943✔
499
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
285,087,401✔
500
        if (pME->colCmpr.nCols == 0) {
285,038,237✔
501
          TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->ntbEntry.schemaRow));
×
502
        }
503
      } else {
UNCOV
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);
285,065,939✔
508
    } else if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE || pME->type == TSDB_VIRTUAL_CHILD_TABLE) {
833,180,235✔
509
      if (!tDecodeIsEnd(pCoder)) {
39,907,430✔
510
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
39,905,589✔
511
        TAOS_CHECK_RETURN(meteDecodeColRefEntry(pCoder, pME));
39,905,589✔
512
      } else {
513
        uDebug("set default type: %d, tableName:%s", pME->type, pME->name);
1,841✔
514
        if (pME->type == TSDB_VIRTUAL_NORMAL_TABLE) {
1,847✔
515
           TAOS_CHECK_RETURN(metatInitDefaultSColRefWrapper(pCoder, &pME->colRef, &pME->ntbEntry.schemaRow));
×
516
        }
517
      }
518
    }
519
    if (!tDecodeIsEnd(pCoder)) {
2,049,582,291✔
520
      TAOS_CHECK_RETURN(metaDecodeExtSchemas(pCoder, pME));
1,216,200,977✔
521
    } else {
522
      pME->pExtSchemas = NULL;
833,381,314✔
523
    }
524
  }
525
  if (pME->type == TSDB_SUPER_TABLE) {
2,049,419,379✔
526
    if (!tDecodeIsEnd(pCoder)) {
930,895,739✔
527
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->stbEntry.keep));
1,861,916,954✔
528
    }
529
    if (!tDecodeIsEnd(pCoder)) {
930,922,207✔
530
      TAOS_CHECK_RETURN(tDecodeI64v(pCoder, &pME->stbEntry.ownerId));
1,861,878,130✔
531
    }
532
  } else if (pME->type == TSDB_NORMAL_TABLE) {
1,118,150,251✔
533
    if (!tDecodeIsEnd(pCoder)) {
285,056,254✔
534
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.ownerId));
570,166,522✔
535
    }
536
  }
537

538

539
  tEndDecode(pCoder);
2,049,104,574✔
540
  return 0;
2,049,387,374✔
541
}
542

543
int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { return metaDecodeEntryImpl(pCoder, pME, false); }
2,049,349,059✔
544

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

550
  pDst->nCols = pSrc->nCols;
347,019,296✔
551
  pDst->version = pSrc->version;
347,013,155✔
552
  pDst->pSchema = (SSchema *)taosMemoryMalloc(pSrc->nCols * sizeof(SSchema));
346,999,598✔
553
  if (pDst->pSchema == NULL) {
346,901,125✔
554
    return terrno;
×
555
  }
556
  memcpy(pDst->pSchema, pSrc->pSchema, pSrc->nCols * sizeof(SSchema));
346,908,229✔
557
  return TSDB_CODE_SUCCESS;
347,019,710✔
558
}
559

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

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

588
  return TSDB_CODE_SUCCESS;
76,824✔
589
}
590

591
static void metaCloneSchemaFree(SSchemaWrapper *pSchema) {
346,947,906✔
592
  if (pSchema) {
346,947,906✔
593
    taosMemoryFreeClear(pSchema->pSchema);
346,959,232✔
594
  }
595
}
346,935,745✔
596

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

610
void metaCloneEntryFree(SMetaEntry **ppEntry) {
205,287,854✔
611
  if (ppEntry == NULL || *ppEntry == NULL) {
205,287,854✔
612
    return;
81,392✔
613
  }
614

615
  taosMemoryFreeClear((*ppEntry)->name);
205,214,649✔
616

617
  if ((*ppEntry)->type < 0) {
205,207,828✔
618
    taosMemoryFreeClear(*ppEntry);
×
619
    return;
×
620
  }
621

622
  if (TSDB_SUPER_TABLE == (*ppEntry)->type) {
205,202,510✔
623
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaRow);
168,776,345✔
624
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaTag);
168,748,593✔
625
    if (TABLE_IS_ROLLUP((*ppEntry)->flags)) {
168,747,424✔
626
      metaFreeRsmaParam(&(*ppEntry)->stbEntry.rsmaParam, 1);
117,136✔
627
    }
628
  } else if (TSDB_CHILD_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_CHILD_TABLE == (*ppEntry)->type) {
36,440,696✔
629
    taosMemoryFreeClear((*ppEntry)->ctbEntry.comment);
26,999,459✔
630
    taosMemoryFreeClear((*ppEntry)->ctbEntry.pTags);
26,998,038✔
631
  } else if (TSDB_NORMAL_TABLE == (*ppEntry)->type || TSDB_VIRTUAL_NORMAL_TABLE == (*ppEntry)->type) {
9,444,265✔
632
    metaCloneSchemaFree(&(*ppEntry)->ntbEntry.schemaRow);
9,444,265✔
633
    taosMemoryFreeClear((*ppEntry)->ntbEntry.comment);
9,444,265✔
634
  } else {
635
    return;
×
636
  }
637
  metaCloneColCmprFree(&(*ppEntry)->colCmpr);
205,211,485✔
638
  taosMemoryFreeClear((*ppEntry)->pExtSchemas);
205,184,274✔
639
  metaCloneColRefFree(&(*ppEntry)->colRef);
205,188,926✔
640

641
  taosMemoryFreeClear(*ppEntry);
205,168,866✔
642
  return;
205,189,567✔
643
}
644

645
int32_t metaCloneEntry(const SMetaEntry *pEntry, SMetaEntry **ppEntry) {
205,182,627✔
646
  int32_t code = TSDB_CODE_SUCCESS;
205,182,627✔
647

648
  if (NULL == pEntry || NULL == ppEntry) {
205,182,627✔
649
    return TSDB_CODE_INVALID_PARA;
×
650
  }
651

652
  *ppEntry = (SMetaEntry *)taosMemoryCalloc(1, sizeof(SMetaEntry));
205,217,026✔
653
  if (NULL == *ppEntry) {
205,159,240✔
654
    return terrno;
×
655
  }
656

657
  (*ppEntry)->version = pEntry->version;
205,179,807✔
658
  (*ppEntry)->type = pEntry->type;
205,209,071✔
659
  (*ppEntry)->uid = pEntry->uid;
205,203,430✔
660

661
  if (pEntry->type < 0) {
205,213,068✔
662
    return TSDB_CODE_SUCCESS;
×
663
  }
664

665
  if (pEntry->name) {
205,190,096✔
666
    (*ppEntry)->name = tstrdup(pEntry->name);
205,224,484✔
667
    if (NULL == (*ppEntry)->name) {
205,225,038✔
668
      code = terrno;
×
669
      metaCloneEntryFree(ppEntry);
×
670
      return code;
×
671
    }
672
  }
673

674
  if (pEntry->type == TSDB_SUPER_TABLE) {
205,211,019✔
675
    (*ppEntry)->flags = pEntry->flags;
168,778,892✔
676

677
    code = metaCloneSchema(&pEntry->stbEntry.schemaRow, &(*ppEntry)->stbEntry.schemaRow);
168,764,291✔
678
    if (code) {
168,782,618✔
679
      metaCloneEntryFree(ppEntry);
×
680
      return code;
×
681
    }
682

683
    code = metaCloneSchema(&pEntry->stbEntry.schemaTag, &(*ppEntry)->stbEntry.schemaTag);
168,782,618✔
684
    if (code) {
168,792,200✔
685
      metaCloneEntryFree(ppEntry);
×
686
      return code;
×
687
    }
688
    if (TABLE_IS_ROLLUP(pEntry->flags)) {
168,792,200✔
689
      code = metaCloneRsmaParam(&pEntry->stbEntry.rsmaParam, &(*ppEntry)->stbEntry.rsmaParam);
76,824✔
690
      if (code) {
76,824✔
691
        metaCloneEntryFree(ppEntry);
×
692
        return code;
×
693
      }
694
    }
695
    (*ppEntry)->stbEntry.keep = pEntry->stbEntry.keep;
168,790,143✔
696
    (*ppEntry)->stbEntry.ownerId = pEntry->stbEntry.ownerId;
168,778,372✔
697
  } else if (pEntry->type == TSDB_CHILD_TABLE || pEntry->type == TSDB_VIRTUAL_CHILD_TABLE) {
36,442,363✔
698
    (*ppEntry)->ctbEntry.btime = pEntry->ctbEntry.btime;
26,999,967✔
699
    (*ppEntry)->ctbEntry.ttlDays = pEntry->ctbEntry.ttlDays;
26,996,229✔
700
    (*ppEntry)->ctbEntry.suid = pEntry->ctbEntry.suid;
26,998,721✔
701

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

714
    // tags
715
    STag *pTags = (STag *)pEntry->ctbEntry.pTags;
26,996,852✔
716
    (*ppEntry)->ctbEntry.pTags = taosMemoryCalloc(1, pTags->len);
26,996,852✔
717
    if (NULL == (*ppEntry)->ctbEntry.pTags) {
26,997,396✔
718
      code = terrno;
×
719
      metaCloneEntryFree(ppEntry);
×
720
      return code;
×
721
    }
722
    memcpy((*ppEntry)->ctbEntry.pTags, pEntry->ctbEntry.pTags, pTags->len);
26,996,150✔
723
  } else if (pEntry->type == TSDB_NORMAL_TABLE || pEntry->type == TSDB_VIRTUAL_NORMAL_TABLE) {
9,444,265✔
724
    (*ppEntry)->ntbEntry.btime = pEntry->ntbEntry.btime;
9,444,265✔
725
    (*ppEntry)->ntbEntry.ttlDays = pEntry->ntbEntry.ttlDays;
9,444,265✔
726
    (*ppEntry)->ntbEntry.ncid = pEntry->ntbEntry.ncid;
9,444,265✔
727
    (*ppEntry)->ntbEntry.ownerId = pEntry->ntbEntry.ownerId;
9,444,265✔
728

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

736
    // comment
737
    (*ppEntry)->ntbEntry.commentLen = pEntry->ntbEntry.commentLen;
9,444,265✔
738
    if (pEntry->ntbEntry.commentLen > 0) {
9,444,265✔
739
      (*ppEntry)->ntbEntry.comment = taosMemoryMalloc(pEntry->ntbEntry.commentLen + 1);
6,165✔
740
      if (NULL == (*ppEntry)->ntbEntry.comment) {
6,165✔
741
        code = terrno;
×
742
        metaCloneEntryFree(ppEntry);
×
743
        return code;
×
744
      }
745
      memcpy((*ppEntry)->ntbEntry.comment, pEntry->ntbEntry.comment, pEntry->ntbEntry.commentLen + 1);
6,165✔
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) {
205,216,954✔
752
    code = metaCloneColRef(&pEntry->colRef, &(*ppEntry)->colRef);
1,284,958✔
753
    if (code) {
1,286,887✔
754
      metaCloneEntryFree(ppEntry);
×
755
      return code;
×
756
    }
757
  } else {
758
    code = metaCloneColCmpr(&pEntry->colCmpr, &(*ppEntry)->colCmpr);
203,925,845✔
759
    if (code) {
203,916,517✔
760
      metaCloneEntryFree(ppEntry);
×
761
      return code;
×
762
    }
763
  }
764
  if (pEntry->pExtSchemas && pEntry->colCmpr.nCols > 0) {
205,203,442✔
765
    (*ppEntry)->pExtSchemas = taosMemoryCalloc(pEntry->colCmpr.nCols, sizeof(SExtSchema));
9,817,181✔
766
    if (!(*ppEntry)->pExtSchemas) {
9,817,992✔
767
      code = terrno;
×
768
      metaCloneEntryFree(ppEntry);
×
769
      return code;
×
770
    }
771
    memcpy((*ppEntry)->pExtSchemas, pEntry->pExtSchemas, sizeof(SExtSchema) * pEntry->colCmpr.nCols);
9,814,135✔
772
  }
773

774
  return code;
205,204,684✔
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