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

taosdata / TDengine / #3659

14 Mar 2025 08:10AM UTC coverage: 63.314% (+0.06%) from 63.25%
#3659

push

travis-ci

web-flow
feat(keep): support keep on super table level. (#30097)

* Feat: support use keep while create super table.

* Test(keep): add test for create super table with keep option.

* Feat(keep): Add tmsg for create keep.

* Feat(keep): support alter table option keep.

* Fix(keep): Add baisc test for alter table option.

* Fix(keep): memory leek.

* Feat(keep): add keep to metaEntry&metaCache and fix earliestTs with stn keep.

* Test(keep): add some cases for select with stb keep.

* Fix: fix ci core while alter stb.

* Feat(keep): delete expired data in super table level.

* Feat: remove get stb keep while query.

* Fix : build error.

* Revert "Fix : build error."

This reverts commit 0ed66e4e8.

* Revert "Feat(keep): delete expired data in super table level."

This reverts commit 36330f6b4.

* Fix : build errors.

* Feat : support restart taosd.

* Fix : alter table comment problems.

* Test : add tests for super table keep.

* Fix: change sdb stb reserve size.

* Test: add more tests.

* Feat: Disable normal tables and sub tables from setting the keep parameter

* Fix: add more checks to avoid unknown address.

* Docs: Add docs for stable keep.

* Fix: some review changes.

* Fix: review errors.

149064 of 302527 branches covered (49.27%)

Branch coverage included in aggregate %.

88 of 99 new or added lines in 12 files covered. (88.89%)

3134 existing lines in 16 files now uncovered.

234231 of 302857 relevant lines covered (77.34%)

18177246.92 hits per line

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

68.35
/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

18
int meteEncodeColCmprEntry(SEncoder *pCoder, const SMetaEntry *pME) {
389,418✔
19
  const SColCmprWrapper *pw = &pME->colCmpr;
389,418✔
20
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->nCols));
778,836!
21
  TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pw->version));
778,836!
22
  uDebug("encode cols:%d", pw->nCols);
389,418✔
23

24
  for (int32_t i = 0; i < pw->nCols; i++) {
6,016,256✔
25
    SColCmpr *p = &pw->pColCmpr[i];
5,626,284✔
26
    TAOS_CHECK_RETURN(tEncodeI16v(pCoder, p->id));
11,252,568!
27
    TAOS_CHECK_RETURN(tEncodeU32(pCoder, p->alg));
11,252,568!
28
  }
29
  return 0;
389,972✔
30
}
31
int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
21,874,836✔
32
  SColCmprWrapper *pWrapper = &pME->colCmpr;
21,874,836✔
33
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->nCols));
43,637,107!
34
  if (pWrapper->nCols == 0) {
21,762,271!
35
    return 0;
×
36
  }
37

38
  TAOS_CHECK_RETURN(tDecodeI32v(pDecoder, &pWrapper->version));
43,492,740!
39
  uDebug("dencode cols:%d", pWrapper->nCols);
21,730,469✔
40
  pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
21,730,598✔
41
  if (pWrapper->pColCmpr == NULL) {
21,899,905!
42
    return terrno;
×
43
  }
44

45
  for (int i = 0; i < pWrapper->nCols; i++) {
449,390,443✔
46
    SColCmpr *p = &pWrapper->pColCmpr[i];
428,839,780✔
47
    TAOS_CHECK_RETURN(tDecodeI16v(pDecoder, &p->id));
855,455,938!
48
    TAOS_CHECK_RETURN(tDecodeU32(pDecoder, &p->alg));
854,106,696!
49
  }
50
  return 0;
20,550,663✔
51
}
52
static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder, SColCmprWrapper *pCmpr,
53
                                                            SSchemaWrapper *pSchema) {
54
  pCmpr->nCols = pSchema->nCols;
×
55
  if ((pCmpr->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pCmpr->nCols * sizeof(SColCmpr))) == NULL) {
40!
56
    return terrno;
×
57
  }
58

59
  for (int32_t i = 0; i < pCmpr->nCols; i++) {
320!
60
    SColCmpr *pColCmpr = &pCmpr->pColCmpr[i];
280✔
61
    SSchema  *pColSchema = &pSchema->pSchema[i];
280✔
62
    pColCmpr->id = pColSchema->colId;
280✔
63
    pColCmpr->alg = createDefaultColCmprByType(pColSchema->type);
280✔
64
  }
65
  return 0;
40✔
66
}
67

68
static int32_t metaCloneColCmpr(const SColCmprWrapper *pSrc, SColCmprWrapper *pDst) {
183,809✔
69
  if (pSrc->nCols > 0) {
183,809✔
70
    pDst->nCols = pSrc->nCols;
172,885✔
71
    pDst->version = pSrc->version;
172,885✔
72
    pDst->pColCmpr = (SColCmpr *)taosMemoryCalloc(pSrc->nCols, sizeof(SColCmpr));
172,885!
73
    if (NULL == pDst->pColCmpr) {
172,944!
74
      return terrno;
×
75
    }
76
    memcpy(pDst->pColCmpr, pSrc->pColCmpr, pSrc->nCols * sizeof(SColCmpr));
172,944✔
77
  }
78
  return 0;
183,868✔
79
}
80

81
static void metaCloneColCmprFree(SColCmprWrapper *pCmpr) {
183,844✔
82
  if (pCmpr) {
183,844!
83
    taosMemoryFreeClear(pCmpr->pColCmpr);
183,850!
84
  }
85
}
183,871✔
86

87
int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
399,815✔
88
  TAOS_CHECK_RETURN(tStartEncode(pCoder));
399,815✔
89
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->version));
800,926!
90
  TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->type));
800,926!
91
  TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->uid));
800,926!
92

93
  if (pME->type > 0) {
400,463✔
94
    if (pME->name == NULL) {
390,078!
95
      return TSDB_CODE_INVALID_PARA;
×
96
    }
97

98
    TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->name));
780,156!
99

100
    if (pME->type == TSDB_SUPER_TABLE) {
390,078✔
101
      TAOS_CHECK_RETURN(tEncodeI8(pCoder, pME->flags));
147,642!
102
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaRow));
147,642!
103
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->stbEntry.schemaTag));
147,642!
104
      if (TABLE_IS_ROLLUP(pME->flags)) {
73,821✔
105
        TAOS_CHECK_RETURN(tEncodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
13!
106
      }
107
    } else if (pME->type == TSDB_CHILD_TABLE) {
316,257✔
108
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.btime));
573,576!
109
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ctbEntry.ttlDays));
573,576!
110
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ctbEntry.commentLen));
573,576!
111
      if (pME->ctbEntry.commentLen > 0) {
286,788✔
112
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ctbEntry.comment));
140!
113
      }
114
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ctbEntry.suid));
573,576!
115
      TAOS_CHECK_RETURN(tEncodeTag(pCoder, (const STag *)pME->ctbEntry.pTags));
286,788!
116
    } else if (pME->type == TSDB_NORMAL_TABLE) {
29,469✔
117
      TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->ntbEntry.btime));
58,606!
118
      TAOS_CHECK_RETURN(tEncodeI32(pCoder, pME->ntbEntry.ttlDays));
58,606!
119
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.commentLen));
58,606!
120
      if (pME->ntbEntry.commentLen > 0) {
29,303✔
121
        TAOS_CHECK_RETURN(tEncodeCStr(pCoder, pME->ntbEntry.comment));
148!
122
      }
123
      TAOS_CHECK_RETURN(tEncodeI32v(pCoder, pME->ntbEntry.ncid));
58,606!
124
      TAOS_CHECK_RETURN(tEncodeSSchemaWrapper(pCoder, &pME->ntbEntry.schemaRow));
58,606!
125
    } else if (pME->type == TSDB_TSMA_TABLE) {
166✔
126
      TAOS_CHECK_RETURN(tEncodeTSma(pCoder, pME->smaEntry.tsma));
58!
127
    } else {
128
      metaError("meta/entry: invalide table type: %" PRId8 " encode failed.", pME->type);
108!
129
      return TSDB_CODE_INVALID_PARA;
×
130
    }
131
    TAOS_CHECK_RETURN(meteEncodeColCmprEntry(pCoder, pME));
389,955!
132
  }
133
  if (pME->type == TSDB_SUPER_TABLE) {
400,291✔
134
    TAOS_CHECK_RETURN(tEncodeI64(pCoder, pME->stbEntry.keep));
147,566!
135
  }
136

137
  tEndEncode(pCoder);
400,291✔
138
  return 0;
400,216✔
139
}
140

141
int metaDecodeEntryImpl(SDecoder *pCoder, SMetaEntry *pME, bool headerOnly) {
31,019,198✔
142
  TAOS_CHECK_RETURN(tStartDecode(pCoder));
31,019,198!
143
  TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->version));
61,841,297!
144
  TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pME->type));
61,349,325!
145
  TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->uid));
61,063,882!
146

147
  if (headerOnly) {
30,480,366✔
148
    tEndDecode(pCoder);
10,410✔
149
    return 0;
10,410✔
150
  }
151

152
  if (pME->type > 0) {
30,469,956!
153
    TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->name));
61,668,245!
154

155
    if (pME->type == TSDB_SUPER_TABLE) {
31,045,683✔
156
      TAOS_CHECK_RETURN(tDecodeI8(pCoder, &pME->flags));
39,241,049!
157
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaRow));
38,644,595!
158
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->stbEntry.schemaTag));
38,201,455!
159
      if (TABLE_IS_ROLLUP(pME->flags)) {
19,113,962✔
160
        TAOS_CHECK_RETURN(tDecodeSRSmaParam(pCoder, &pME->stbEntry.rsmaParam));
270!
161
      }
162
    } else if (pME->type == TSDB_CHILD_TABLE) {
11,361,736✔
163
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.btime));
18,343,963!
164
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ctbEntry.ttlDays));
18,276,314!
165
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ctbEntry.commentLen));
18,273,130!
166
      if (pME->ctbEntry.commentLen > 0) {
9,144,297✔
167
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ctbEntry.comment));
290!
168
      }
169
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ctbEntry.suid));
18,279,149!
170
      TAOS_CHECK_RETURN(tDecodeTag(pCoder, (STag **)&pME->ctbEntry.pTags));
9,134,852!
171
    } else if (pME->type == TSDB_NORMAL_TABLE) {
2,165,254!
172
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->ntbEntry.btime));
4,399,948!
173
      TAOS_CHECK_RETURN(tDecodeI32(pCoder, &pME->ntbEntry.ttlDays));
4,394,610!
174
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.commentLen));
4,393,870!
175
      if (pME->ntbEntry.commentLen > 0) {
2,197,404✔
176
        TAOS_CHECK_RETURN(tDecodeCStr(pCoder, &pME->ntbEntry.comment));
346!
177
      }
178
      TAOS_CHECK_RETURN(tDecodeI32v(pCoder, &pME->ntbEntry.ncid));
4,394,709!
179
      TAOS_CHECK_RETURN(tDecodeSSchemaWrapperEx(pCoder, &pME->ntbEntry.schemaRow));
4,363,247!
UNCOV
180
    } else if (pME->type == TSDB_TSMA_TABLE) {
×
181
      pME->smaEntry.tsma = tDecoderMalloc(pCoder, sizeof(STSma));
2✔
182
      if (!pME->smaEntry.tsma) {
2!
183
        return terrno;
×
184
      }
185
      TAOS_CHECK_RETURN(tDecodeTSma(pCoder, pME->smaEntry.tsma, true));
2!
186
    } else {
UNCOV
187
      metaError("meta/entry: invalide table type: %" PRId8 " decode failed.", pME->type);
×
UNCOV
188
      return TSDB_CODE_INVALID_PARA;
×
189
    }
190
    if (pME->type == TSDB_SUPER_TABLE) {
31,066,718✔
191
      if (TABLE_IS_COL_COMPRESSED(pME->flags)) {
19,677,898!
192
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
19,689,473!
193

194
        if (pME->colCmpr.nCols == 0) {
19,560,199!
UNCOV
195
          TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->stbEntry.schemaRow));
×
196
        }
197
      } else {
198
        TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->stbEntry.schemaRow));
×
199
        TABLE_SET_COL_COMPRESSED(pME->flags);
40✔
200
      }
201
    } else if (pME->type == TSDB_NORMAL_TABLE) {
11,388,820✔
202
      if (!tDecodeIsEnd(pCoder)) {
2,201,710!
203
        uDebug("set type: %d, tableName:%s", pME->type, pME->name);
2,201,814✔
204
        TAOS_CHECK_RETURN(meteDecodeColCmprEntry(pCoder, pME));
2,201,825✔
205
        if (pME->colCmpr.nCols == 0) {
2,197,542!
UNCOV
206
          TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->ntbEntry.schemaRow));
×
207
        }
208
      } else {
209
        uDebug("set default type: %d, tableName:%s", pME->type, pME->name);
×
UNCOV
210
        TAOS_CHECK_RETURN(metatInitDefaultSColCmprWrapper(pCoder, &pME->colCmpr, &pME->ntbEntry.schemaRow));
×
211
      }
212
      TABLE_SET_COL_COMPRESSED(pME->flags);
2,197,542✔
213
    }
214
  }
215
  if (pME->type == TSDB_SUPER_TABLE) {
30,792,285✔
216
    if (!tDecodeIsEnd(pCoder)) {
19,546,530!
217
      TAOS_CHECK_RETURN(tDecodeI64(pCoder, &pME->stbEntry.keep));
39,075,634!
218
    }
219
  }
220

221
  tEndDecode(pCoder);
30,764,847✔
222
  return 0;
30,748,930✔
223
}
224

225
int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) { return metaDecodeEntryImpl(pCoder, pME, false); }
31,033,664✔
226

227
static int32_t metaCloneSchema(const SSchemaWrapper *pSrc, SSchemaWrapper *pDst) {
343,390✔
228
  if (pSrc == NULL || pDst == NULL) {
343,390!
UNCOV
229
    return TSDB_CODE_INVALID_PARA;
×
230
  }
231

232
  pDst->nCols = pSrc->nCols;
343,430✔
233
  pDst->version = pSrc->version;
343,430✔
234
  pDst->pSchema = (SSchema *)taosMemoryMalloc(pSrc->nCols * sizeof(SSchema));
343,430!
235
  if (pDst->pSchema == NULL) {
343,454!
UNCOV
236
    return terrno;
×
237
  }
238
  memcpy(pDst->pSchema, pSrc->pSchema, pSrc->nCols * sizeof(SSchema));
343,454✔
239
  return TSDB_CODE_SUCCESS;
343,454✔
240
}
241

242
static void metaCloneSchemaFree(SSchemaWrapper *pSchema) {
343,429✔
243
  if (pSchema) {
343,429!
244
    taosMemoryFreeClear(pSchema->pSchema);
343,440!
245
  }
246
}
343,468✔
247

248
void metaCloneEntryFree(SMetaEntry **ppEntry) {
183,821✔
249
  if (ppEntry == NULL || *ppEntry == NULL) {
183,821!
UNCOV
250
    return;
×
251
  }
252

253
  taosMemoryFreeClear((*ppEntry)->name);
183,855!
254

255
  if ((*ppEntry)->type < 0) {
183,861!
UNCOV
256
    taosMemoryFreeClear(*ppEntry);
×
UNCOV
257
    return;
×
258
  }
259

260
  if (TSDB_SUPER_TABLE == (*ppEntry)->type) {
183,861✔
261
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaRow);
170,584✔
262
    metaCloneSchemaFree(&(*ppEntry)->stbEntry.schemaTag);
170,607✔
263
  } else if (TSDB_CHILD_TABLE == (*ppEntry)->type) {
13,277✔
264
    taosMemoryFreeClear((*ppEntry)->ctbEntry.comment);
10,938!
265
    taosMemoryFreeClear((*ppEntry)->ctbEntry.pTags);
10,938!
266
  } else if (TSDB_NORMAL_TABLE == (*ppEntry)->type) {
2,339✔
267
    metaCloneSchemaFree(&(*ppEntry)->ntbEntry.schemaRow);
2,325✔
268
    taosMemoryFreeClear((*ppEntry)->ntbEntry.comment);
2,325!
269
  } else {
270
    return;
14✔
271
  }
272
  metaCloneColCmprFree(&(*ppEntry)->colCmpr);
183,865✔
273

274
  taosMemoryFreeClear(*ppEntry);
183,854!
275
  return;
183,880✔
276
}
277

278
int32_t metaCloneEntry(const SMetaEntry *pEntry, SMetaEntry **ppEntry) {
183,768✔
279
  int32_t code = TSDB_CODE_SUCCESS;
183,768✔
280

281
  if (NULL == pEntry || NULL == ppEntry) {
183,768!
UNCOV
282
    return TSDB_CODE_INVALID_PARA;
×
283
  }
284

285
  *ppEntry = (SMetaEntry *)taosMemoryCalloc(1, sizeof(SMetaEntry));
183,803!
286
  if (NULL == *ppEntry) {
183,881!
UNCOV
287
    return terrno;
×
288
  }
289

290
  (*ppEntry)->version = pEntry->version;
183,881✔
291
  (*ppEntry)->type = pEntry->type;
183,881✔
292
  (*ppEntry)->uid = pEntry->uid;
183,881✔
293

294
  if (pEntry->type < 0) {
183,881!
295
    return TSDB_CODE_SUCCESS;
×
296
  }
297

298
  if (pEntry->name) {
183,881✔
299
    (*ppEntry)->name = tstrdup(pEntry->name);
183,876✔
300
    if (NULL == (*ppEntry)->name) {
183,851!
UNCOV
301
      code = terrno;
×
UNCOV
302
      metaCloneEntryFree(ppEntry);
×
303
      return code;
×
304
    }
305
  }
306

307
  if (pEntry->type == TSDB_SUPER_TABLE) {
183,861✔
308
    (*ppEntry)->flags = pEntry->flags;
170,597✔
309

310
    code = metaCloneSchema(&pEntry->stbEntry.schemaRow, &(*ppEntry)->stbEntry.schemaRow);
170,597✔
311
    if (code) {
170,558!
UNCOV
312
      metaCloneEntryFree(ppEntry);
×
UNCOV
313
      return code;
×
314
    }
315

316
    code = metaCloneSchema(&pEntry->stbEntry.schemaTag, &(*ppEntry)->stbEntry.schemaTag);
170,558✔
317
    if (code) {
170,569!
UNCOV
318
      metaCloneEntryFree(ppEntry);
×
UNCOV
319
      return code;
×
320
    }
321
    (*ppEntry)->stbEntry.keep = pEntry->stbEntry.keep;
170,584✔
322
  } else if (pEntry->type == TSDB_CHILD_TABLE) {
13,264✔
323
    (*ppEntry)->ctbEntry.btime = pEntry->ctbEntry.btime;
10,939✔
324
    (*ppEntry)->ctbEntry.ttlDays = pEntry->ctbEntry.ttlDays;
10,939✔
325
    (*ppEntry)->ctbEntry.suid = pEntry->ctbEntry.suid;
10,939✔
326

327
    // comment
328
    (*ppEntry)->ctbEntry.commentLen = pEntry->ctbEntry.commentLen;
10,939✔
329
    if (pEntry->ctbEntry.commentLen > 0) {
10,939✔
330
      (*ppEntry)->ctbEntry.comment = taosMemoryMalloc(pEntry->ctbEntry.commentLen + 1);
40!
331
      if (NULL == (*ppEntry)->ctbEntry.comment) {
40!
UNCOV
332
        code = terrno;
×
UNCOV
333
        metaCloneEntryFree(ppEntry);
×
UNCOV
334
        return code;
×
335
      }
336
      memcpy((*ppEntry)->ctbEntry.comment, pEntry->ctbEntry.comment, pEntry->ctbEntry.commentLen + 1);
40✔
337
    }
338

339
    // tags
340
    STag *pTags = (STag *)pEntry->ctbEntry.pTags;
10,939✔
341
    (*ppEntry)->ctbEntry.pTags = taosMemoryCalloc(1, pTags->len);
10,939!
342
    if (NULL == (*ppEntry)->ctbEntry.pTags) {
10,941!
343
      code = terrno;
×
UNCOV
344
      metaCloneEntryFree(ppEntry);
×
UNCOV
345
      return code;
×
346
    }
347
    memcpy((*ppEntry)->ctbEntry.pTags, pEntry->ctbEntry.pTags, pTags->len);
10,941✔
348
  } else if (pEntry->type == TSDB_NORMAL_TABLE) {
2,325!
349
    (*ppEntry)->ntbEntry.btime = pEntry->ntbEntry.btime;
2,325✔
350
    (*ppEntry)->ntbEntry.ttlDays = pEntry->ntbEntry.ttlDays;
2,325✔
351
    (*ppEntry)->ntbEntry.ncid = pEntry->ntbEntry.ncid;
2,325✔
352

353
    // schema
354
    code = metaCloneSchema(&pEntry->ntbEntry.schemaRow, &(*ppEntry)->ntbEntry.schemaRow);
2,325✔
355
    if (code) {
2,325!
UNCOV
356
      metaCloneEntryFree(ppEntry);
×
UNCOV
357
      return code;
×
358
    }
359

360
    // comment
361
    (*ppEntry)->ntbEntry.commentLen = pEntry->ntbEntry.commentLen;
2,325✔
362
    if (pEntry->ntbEntry.commentLen > 0) {
2,325✔
363
      (*ppEntry)->ntbEntry.comment = taosMemoryMalloc(pEntry->ntbEntry.commentLen + 1);
46!
364
      if (NULL == (*ppEntry)->ntbEntry.comment) {
46!
365
        code = terrno;
×
366
        metaCloneEntryFree(ppEntry);
×
UNCOV
367
        return code;
×
368
      }
369
      memcpy((*ppEntry)->ntbEntry.comment, pEntry->ntbEntry.comment, pEntry->ntbEntry.commentLen + 1);
46✔
370
    }
371
  } else {
UNCOV
372
    return TSDB_CODE_INVALID_PARA;
×
373
  }
374

375
  code = metaCloneColCmpr(&pEntry->colCmpr, &(*ppEntry)->colCmpr);
183,850✔
376
  if (code) {
183,852!
UNCOV
377
    metaCloneEntryFree(ppEntry);
×
UNCOV
378
    return code;
×
379
  }
380

381
  return code;
183,867✔
382
}
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