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

taosdata / TDengine / #3565

25 Dec 2024 05:34AM UTC coverage: 51.098% (-11.1%) from 62.21%
#3565

push

travis-ci

web-flow
Merge pull request #29316 from taosdata/enh/3.0/TD-33266

enh(ut):Add wal & config UT.

111558 of 284773 branches covered (39.17%)

Branch coverage included in aggregate %.

1 of 2 new or added lines in 2 files covered. (50.0%)

39015 existing lines in 102 files now uncovered.

177882 of 281666 relevant lines covered (63.15%)

15090998.35 hits per line

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

0.0
/source/dnode/vnode/src/meta/metaTable.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
extern SDmNotifyHandle dmNotifyHdl;
19

20
int32_t metaAddTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMetaRsp *pRsp);
21
int32_t metaDropTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMetaRsp *pRsp);
22
int32_t metaAlterTableColumnName(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMetaRsp *pRsp);
23
int32_t metaAlterTableColumnBytes(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMetaRsp *pRsp);
24
int32_t metaUpdateTableTagValue(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq);
25
int32_t metaUpdateTableMultiTagValue(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq);
26
int32_t metaUpdateTableOptions2(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq);
27
int32_t metaUpdateTableColCompress2(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq);
28

29
int32_t metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema);
30

31
int32_t    metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema);
32
static int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs);
33
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *pSuid, int8_t *pSysTbl);
34
void       metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey);
35
// opt ins_tables query
36
static int metaDeleteBtimeIdx(SMeta *pMeta, const SMetaEntry *pME);
37
static int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME);
38

UNCOV
39
int32_t updataTableColCmpr(SColCmprWrapper *pWp, SSchema *pSchema, int8_t add, uint32_t compress) {
×
UNCOV
40
  int32_t nCols = pWp->nCols;
×
UNCOV
41
  int32_t ver = pWp->version;
×
UNCOV
42
  if (add) {
×
UNCOV
43
    SColCmpr *p = taosMemoryRealloc(pWp->pColCmpr, sizeof(SColCmpr) * (nCols + 1));
×
UNCOV
44
    if (p == NULL) {
×
UNCOV
45
      return terrno;
×
46
    }
UNCOV
47
    pWp->pColCmpr = p;
×
48

UNCOV
49
    SColCmpr *pCol = p + nCols;
×
UNCOV
50
    pCol->id = pSchema->colId;
×
UNCOV
51
    pCol->alg = compress;
×
UNCOV
52
    pWp->nCols = nCols + 1;
×
UNCOV
53
    pWp->version = ver;
×
54
  } else {
UNCOV
55
    for (int32_t i = 0; i < nCols; i++) {
×
UNCOV
56
      SColCmpr *pOCmpr = &pWp->pColCmpr[i];
×
57
      if (pOCmpr->id == pSchema->colId) {
×
UNCOV
58
        int32_t left = (nCols - i - 1) * sizeof(SColCmpr);
×
UNCOV
59
        if (left) {
×
UNCOV
60
          memmove(pWp->pColCmpr + i, pWp->pColCmpr + i + 1, left);
×
61
        }
UNCOV
62
        nCols--;
×
UNCOV
63
        break;
×
64
      }
65
    }
UNCOV
66
    pWp->nCols = nCols;
×
UNCOV
67
    pWp->version = ver;
×
68
  }
UNCOV
69
  return 0;
×
70
}
71

UNCOV
72
int metaUpdateMetaRsp(tb_uid_t uid, char *tbName, SSchemaWrapper *pSchema, STableMetaRsp *pMetaRsp) {
×
UNCOV
73
  pMetaRsp->pSchemas = taosMemoryMalloc(pSchema->nCols * sizeof(SSchema));
×
UNCOV
74
  if (NULL == pMetaRsp->pSchemas) {
×
UNCOV
75
    return terrno;
×
76
  }
77

UNCOV
78
  pMetaRsp->pSchemaExt = taosMemoryMalloc(pSchema->nCols * sizeof(SSchemaExt));
×
UNCOV
79
  if (pMetaRsp->pSchemaExt == NULL) {
×
UNCOV
80
    taosMemoryFree(pMetaRsp->pSchemas);
×
UNCOV
81
    return terrno;
×
82
  }
83

84
  tstrncpy(pMetaRsp->tbName, tbName, TSDB_TABLE_NAME_LEN);
×
85
  pMetaRsp->numOfColumns = pSchema->nCols;
×
86
  pMetaRsp->tableType = TSDB_NORMAL_TABLE;
×
87
  pMetaRsp->sversion = pSchema->version;
×
88
  pMetaRsp->tuid = uid;
×
89

90
  memcpy(pMetaRsp->pSchemas, pSchema->pSchema, pSchema->nCols * sizeof(SSchema));
×
91

92
  return 0;
×
93
}
94

UNCOV
95
int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema) {
×
96
  int32_t code = 0;
×
97

98
#ifdef USE_INVERTED_INDEX
UNCOV
99
  if (pMeta->pTagIvtIdx == NULL || pCtbEntry == NULL) {
×
UNCOV
100
    return TSDB_CODE_INVALID_PARA;
×
101
  }
UNCOV
102
  void       *data = pCtbEntry->ctbEntry.pTags;
×
103
  const char *tagName = pSchema->name;
×
104

UNCOV
105
  tb_uid_t    suid = pCtbEntry->ctbEntry.suid;
×
UNCOV
106
  tb_uid_t    tuid = pCtbEntry->uid;
×
UNCOV
107
  const void *pTagData = pCtbEntry->ctbEntry.pTags;
×
108
  int32_t     nTagData = 0;
×
109

UNCOV
110
  SArray *pTagVals = NULL;
×
UNCOV
111
  code = tTagToValArray((const STag *)data, &pTagVals);
×
UNCOV
112
  if (code) {
×
UNCOV
113
    return code;
×
114
  }
115

UNCOV
116
  SIndexMultiTerm *terms = indexMultiTermCreate();
×
UNCOV
117
  if (terms == NULL) {
×
UNCOV
118
    return terrno;
×
119
  }
120

UNCOV
121
  int16_t nCols = taosArrayGetSize(pTagVals);
×
UNCOV
122
  for (int i = 0; i < nCols; i++) {
×
UNCOV
123
    STagVal *pTagVal = (STagVal *)taosArrayGet(pTagVals, i);
×
UNCOV
124
    char     type = pTagVal->type;
×
125

UNCOV
126
    char   *key = pTagVal->pKey;
×
UNCOV
127
    int32_t nKey = strlen(key);
×
128

UNCOV
129
    SIndexTerm *term = NULL;
×
UNCOV
130
    if (type == TSDB_DATA_TYPE_NULL) {
×
UNCOV
131
      term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, NULL, 0);
×
UNCOV
132
    } else if (type == TSDB_DATA_TYPE_NCHAR) {
×
UNCOV
133
      if (pTagVal->nData > 0) {
×
UNCOV
134
        char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
×
UNCOV
135
        if (val == NULL) {
×
UNCOV
136
          TAOS_CHECK_GOTO(terrno, NULL, _exception);
×
137
        }
UNCOV
138
        int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE, NULL);
×
UNCOV
139
        if (len < 0) {
×
UNCOV
140
          TAOS_CHECK_GOTO(len, NULL, _exception);
×
141
        }
UNCOV
142
        memcpy(val, (uint16_t *)&len, VARSTR_HEADER_SIZE);
×
UNCOV
143
        type = TSDB_DATA_TYPE_VARCHAR;
×
UNCOV
144
        term = indexTermCreate(suid, ADD_VALUE, type, key, nKey, val, len);
×
UNCOV
145
        taosMemoryFree(val);
×
146
      } else if (pTagVal->nData == 0) {
×
UNCOV
147
        term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, pTagVal->pData, 0);
×
148
      }
UNCOV
149
    } else if (type == TSDB_DATA_TYPE_DOUBLE) {
×
UNCOV
150
      double val = *(double *)(&pTagVal->i64);
×
UNCOV
151
      int    len = sizeof(val);
×
UNCOV
152
      term = indexTermCreate(suid, ADD_VALUE, type, key, nKey, (const char *)&val, len);
×
UNCOV
153
    } else if (type == TSDB_DATA_TYPE_BOOL) {
×
UNCOV
154
      int val = *(int *)(&pTagVal->i64);
×
UNCOV
155
      int len = sizeof(val);
×
UNCOV
156
      term = indexTermCreate(suid, ADD_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len);
×
157
    }
158

UNCOV
159
    if (term != NULL) {
×
UNCOV
160
      int32_t ret = indexMultiTermAdd(terms, term);
×
UNCOV
161
      if (ret < 0) {
×
UNCOV
162
        metaError("vgId:%d, failed to add term to multi term, uid: %" PRId64 ", key: %s, type: %d, ret: %d",
×
163
                  TD_VID(pMeta->pVnode), tuid, key, type, ret);
164
      }
165
    } else {
UNCOV
166
      code = terrno;
×
UNCOV
167
      goto _exception;
×
168
    }
169
  }
UNCOV
170
  code = indexJsonPut(pMeta->pTagIvtIdx, terms, tuid);
×
UNCOV
171
  indexMultiTermDestroy(terms);
×
172

UNCOV
173
  taosArrayDestroy(pTagVals);
×
174
#endif
UNCOV
175
  return code;
×
UNCOV
176
_exception:
×
UNCOV
177
  indexMultiTermDestroy(terms);
×
UNCOV
178
  taosArrayDestroy(pTagVals);
×
UNCOV
179
  return code;
×
180
}
UNCOV
181
int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSchema *pSchema) {
×
182
#ifdef USE_INVERTED_INDEX
UNCOV
183
  if (pMeta->pTagIvtIdx == NULL || pCtbEntry == NULL) {
×
UNCOV
184
    return TSDB_CODE_INVALID_PARA;
×
185
  }
UNCOV
186
  void       *data = pCtbEntry->ctbEntry.pTags;
×
UNCOV
187
  const char *tagName = pSchema->name;
×
188

UNCOV
189
  tb_uid_t    suid = pCtbEntry->ctbEntry.suid;
×
190
  tb_uid_t    tuid = pCtbEntry->uid;
×
UNCOV
191
  const void *pTagData = pCtbEntry->ctbEntry.pTags;
×
UNCOV
192
  int32_t     nTagData = 0;
×
193

194
  SArray *pTagVals = NULL;
×
195
  int32_t code = tTagToValArray((const STag *)data, &pTagVals);
×
UNCOV
196
  if (code) {
×
UNCOV
197
    return code;
×
198
  }
199

UNCOV
200
  SIndexMultiTerm *terms = indexMultiTermCreate();
×
UNCOV
201
  if (terms == NULL) {
×
UNCOV
202
    return terrno;
×
203
  }
204

205
  int16_t nCols = taosArrayGetSize(pTagVals);
×
206
  for (int i = 0; i < nCols; i++) {
×
207
    STagVal *pTagVal = (STagVal *)taosArrayGet(pTagVals, i);
×
UNCOV
208
    char     type = pTagVal->type;
×
209

UNCOV
210
    char   *key = pTagVal->pKey;
×
UNCOV
211
    int32_t nKey = strlen(key);
×
212

UNCOV
213
    SIndexTerm *term = NULL;
×
UNCOV
214
    if (type == TSDB_DATA_TYPE_NULL) {
×
UNCOV
215
      term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, NULL, 0);
×
UNCOV
216
    } else if (type == TSDB_DATA_TYPE_NCHAR) {
×
UNCOV
217
      if (pTagVal->nData > 0) {
×
UNCOV
218
        char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
×
UNCOV
219
        if (val == NULL) {
×
UNCOV
220
          TAOS_CHECK_GOTO(terrno, NULL, _exception);
×
221
        }
UNCOV
222
        int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE, NULL);
×
UNCOV
223
        if (len < 0) {
×
UNCOV
224
          TAOS_CHECK_GOTO(len, NULL, _exception);
×
225
        }
UNCOV
226
        memcpy(val, (uint16_t *)&len, VARSTR_HEADER_SIZE);
×
UNCOV
227
        type = TSDB_DATA_TYPE_VARCHAR;
×
UNCOV
228
        term = indexTermCreate(suid, DEL_VALUE, type, key, nKey, val, len);
×
UNCOV
229
        taosMemoryFree(val);
×
230
      } else if (pTagVal->nData == 0) {
×
UNCOV
231
        term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_VARCHAR, key, nKey, pTagVal->pData, 0);
×
232
      }
UNCOV
233
    } else if (type == TSDB_DATA_TYPE_DOUBLE) {
×
UNCOV
234
      double val = *(double *)(&pTagVal->i64);
×
UNCOV
235
      int    len = sizeof(val);
×
UNCOV
236
      term = indexTermCreate(suid, DEL_VALUE, type, key, nKey, (const char *)&val, len);
×
UNCOV
237
    } else if (type == TSDB_DATA_TYPE_BOOL) {
×
UNCOV
238
      int val = *(int *)(&pTagVal->i64);
×
UNCOV
239
      int len = sizeof(val);
×
UNCOV
240
      term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len);
×
241
    }
UNCOV
242
    if (term != NULL) {
×
243
      int32_t ret = indexMultiTermAdd(terms, term);
×
UNCOV
244
      if (ret < 0) {
×
UNCOV
245
        metaError("vgId:%d, failed to add term to multi term, uid: %" PRId64 ", key: %s, type: %d, ret: %d",
×
246
                  TD_VID(pMeta->pVnode), tuid, key, type, ret);
247
      }
248
    } else {
UNCOV
249
      code = terrno;
×
UNCOV
250
      goto _exception;
×
251
    }
252
  }
UNCOV
253
  code = indexJsonPut(pMeta->pTagIvtIdx, terms, tuid);
×
UNCOV
254
  indexMultiTermDestroy(terms);
×
UNCOV
255
  taosArrayDestroy(pTagVals);
×
256
#endif
UNCOV
257
  return code;
×
258
_exception:
×
259
  indexMultiTermDestroy(terms);
×
UNCOV
260
  taosArrayDestroy(pTagVals);
×
UNCOV
261
  return code;
×
262
}
263

UNCOV
264
void metaTimeSeriesNotifyCheck(SMeta *pMeta) {
×
265
#if defined(TD_ENTERPRISE)
UNCOV
266
  int64_t nTimeSeries = metaGetTimeSeriesNum(pMeta, 0);
×
UNCOV
267
  int64_t deltaTS = nTimeSeries - pMeta->pVnode->config.vndStats.numOfReportedTimeSeries;
×
UNCOV
268
  if (deltaTS > tsTimeSeriesThreshold) {
×
UNCOV
269
    if (0 == atomic_val_compare_exchange_8(&dmNotifyHdl.state, 1, 2)) {
×
UNCOV
270
      if (tsem_post(&dmNotifyHdl.sem) != 0) {
×
UNCOV
271
        metaError("vgId:%d, failed to post semaphore, errno:%d", TD_VID(pMeta->pVnode), errno);
×
272
      }
273
    }
274
  }
275
#endif
UNCOV
276
}
×
277

278
static int32_t metaDropTables(SMeta *pMeta, SArray *tbUids) {
×
UNCOV
279
  int32_t code = 0;
×
UNCOV
280
  if (taosArrayGetSize(tbUids) == 0) return TSDB_CODE_SUCCESS;
×
281

UNCOV
282
  int64_t    nCtbDropped = 0;
×
UNCOV
283
  SSHashObj *suidHash = tSimpleHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT));
×
UNCOV
284
  if (suidHash == NULL) {
×
UNCOV
285
    return terrno;
×
286
  }
287

288
  metaWLock(pMeta);
×
289
  for (int i = 0; i < taosArrayGetSize(tbUids); ++i) {
×
UNCOV
290
    tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUids, i);
×
UNCOV
291
    tb_uid_t suid = 0;
×
UNCOV
292
    int8_t   sysTbl = 0;
×
293
    int      type;
UNCOV
294
    code = metaDropTableByUid(pMeta, uid, &type, &suid, &sysTbl);
×
UNCOV
295
    if (code) return code;
×
UNCOV
296
    if (!sysTbl && type == TSDB_CHILD_TABLE && suid != 0 && suidHash) {
×
UNCOV
297
      int64_t *pVal = tSimpleHashGet(suidHash, &suid, sizeof(tb_uid_t));
×
UNCOV
298
      if (pVal) {
×
299
        nCtbDropped = *pVal + 1;
×
300
      } else {
UNCOV
301
        nCtbDropped = 1;
×
302
      }
UNCOV
303
      code = tSimpleHashPut(suidHash, &suid, sizeof(tb_uid_t), &nCtbDropped, sizeof(int64_t));
×
UNCOV
304
      if (code) return code;
×
305
    }
306
    /*
307
    if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
308
      tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
309
    }
310
    */
311
    metaDebug("batch drop table:%" PRId64, uid);
×
312
  }
313
  metaULock(pMeta);
×
314

315
  // update timeseries
UNCOV
316
  void   *pCtbDropped = NULL;
×
UNCOV
317
  int32_t iter = 0;
×
318
  while ((pCtbDropped = tSimpleHashIterate(suidHash, pCtbDropped, &iter))) {
×
319
    tb_uid_t    *pSuid = tSimpleHashGetKey(pCtbDropped, NULL);
×
320
    int32_t      nCols = 0;
×
321
    SVnodeStats *pStats = &pMeta->pVnode->config.vndStats;
×
322
    if (metaGetStbStats(pMeta->pVnode, *pSuid, NULL, &nCols) == 0) {
×
UNCOV
323
      pStats->numOfTimeSeries -= *(int64_t *)pCtbDropped * (nCols - 1);
×
324
    }
325
  }
UNCOV
326
  tSimpleHashCleanup(suidHash);
×
327

328
  pMeta->changed = true;
×
UNCOV
329
  return 0;
×
330
}
331

UNCOV
332
static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
×
UNCOV
333
  int32_t code = 0;
×
334
  // 1, tranverse table's
335
  // 2, validate table name using vnodeValidateTableHash
336
  // 3, push invalidated table's uid into uidList
337

338
  TBC *pCur;
339
  code = tdbTbcOpen(pMeta->pTbDb, &pCur, NULL);
×
340
  if (code < 0) {
×
341
    return code;
×
342
  }
343

UNCOV
344
  code = tdbTbcMoveToFirst(pCur);
×
345
  if (code) {
×
346
    tdbTbcClose(pCur);
×
347
    return code;
×
348
  }
349

350
  void *pData = NULL, *pKey = NULL;
×
351
  int   nData = 0, nKey = 0;
×
352

353
  while (1) {
×
UNCOV
354
    int32_t ret = tdbTbcNext(pCur, &pKey, &nKey, &pData, &nData);
×
355
    if (ret < 0) {
×
356
      break;
×
357
    }
358

UNCOV
359
    SMetaEntry me = {0};
×
360
    SDecoder   dc = {0};
×
361
    tDecoderInit(&dc, pData, nData);
×
UNCOV
362
    code = metaDecodeEntry(&dc, &me);
×
363
    if (code < 0) {
×
UNCOV
364
      tDecoderClear(&dc);
×
UNCOV
365
      return code;
×
366
    }
367

368
    if (me.type != TSDB_SUPER_TABLE) {
×
369
      char tbFName[TSDB_TABLE_FNAME_LEN + 1];
370
      snprintf(tbFName, sizeof(tbFName), "%s.%s", pMeta->pVnode->config.dbname, me.name);
×
371
      tbFName[TSDB_TABLE_FNAME_LEN] = '\0';
×
372
      int32_t ret = vnodeValidateTableHash(pMeta->pVnode, tbFName);
×
UNCOV
373
      if (ret < 0 && terrno == TSDB_CODE_VND_HASH_MISMATCH) {
×
UNCOV
374
        if (taosArrayPush(uidList, &me.uid) == NULL) {
×
UNCOV
375
          code = terrno;
×
UNCOV
376
          break;
×
377
        }
378
      }
379
    }
380
    tDecoderClear(&dc);
×
381
  }
UNCOV
382
  tdbFree(pData);
×
UNCOV
383
  tdbFree(pKey);
×
384
  tdbTbcClose(pCur);
×
385

386
  return 0;
×
387
}
388

UNCOV
389
int32_t metaTrimTables(SMeta *pMeta, int64_t version) {
×
UNCOV
390
  int32_t code = 0;
×
391

392
  SArray *tbUids = taosArrayInit(8, sizeof(int64_t));
×
393
  if (tbUids == NULL) {
×
394
    return terrno;
×
395
  }
396

UNCOV
397
  code = metaFilterTableByHash(pMeta, tbUids);
×
UNCOV
398
  if (code != 0) {
×
399
    goto end;
×
400
  }
UNCOV
401
  if (TARRAY_SIZE(tbUids) == 0) {
×
402
    goto end;
×
403
  }
404

405
  metaInfo("vgId:%d, trim %ld tables", TD_VID(pMeta->pVnode), taosArrayGetSize(tbUids));
×
UNCOV
406
  code = metaDropTables(pMeta, tbUids);
×
UNCOV
407
  if (code) goto end;
×
408

409
end:
×
410
  taosArrayDestroy(tbUids);
×
411

UNCOV
412
  return code;
×
413
}
414

415
int metaTtlFindExpired(SMeta *pMeta, int64_t timePointMs, SArray *tbUids, int32_t ttlDropMaxCount) {
×
UNCOV
416
  metaRLock(pMeta);
×
417

418
  int ret = ttlMgrFindExpired(pMeta->pTtlMgr, timePointMs, tbUids, ttlDropMaxCount);
×
419

UNCOV
420
  metaULock(pMeta);
×
421

UNCOV
422
  if (ret != 0) {
×
423
    metaError("ttl failed to find expired table, ret:%d", ret);
×
424
  }
425

426
  return ret;
×
427
}
428

429
static int metaBuildBtimeIdxKey(SBtimeIdxKey *btimeKey, const SMetaEntry *pME) {
×
430
  int64_t btime;
UNCOV
431
  if (pME->type == TSDB_CHILD_TABLE) {
×
UNCOV
432
    btime = pME->ctbEntry.btime;
×
UNCOV
433
  } else if (pME->type == TSDB_NORMAL_TABLE) {
×
UNCOV
434
    btime = pME->ntbEntry.btime;
×
435
  } else {
436
    return TSDB_CODE_FAILED;
×
437
  }
438

439
  btimeKey->btime = btime;
×
440
  btimeKey->uid = pME->uid;
×
UNCOV
441
  return 0;
×
442
}
443

444
static int metaBuildNColIdxKey(SNcolIdxKey *ncolKey, const SMetaEntry *pME) {
×
445
  if (pME->type == TSDB_NORMAL_TABLE) {
×
446
    ncolKey->ncol = pME->ntbEntry.schemaRow.nCols;
×
UNCOV
447
    ncolKey->uid = pME->uid;
×
448
  } else {
UNCOV
449
    return TSDB_CODE_FAILED;
×
450
  }
451
  return 0;
×
452
}
453

UNCOV
454
static void metaDeleteTtl(SMeta *pMeta, const SMetaEntry *pME) {
×
UNCOV
455
  if (pME->type != TSDB_CHILD_TABLE && pME->type != TSDB_NORMAL_TABLE) return;
×
456

457
  STtlDelTtlCtx ctx = {.uid = pME->uid, .pTxn = pMeta->txn};
×
458
  if (pME->type == TSDB_CHILD_TABLE) {
×
UNCOV
459
    ctx.ttlDays = pME->ctbEntry.ttlDays;
×
460
  } else {
UNCOV
461
    ctx.ttlDays = pME->ntbEntry.ttlDays;
×
462
  }
463

464
  int32_t ret = ttlMgrDeleteTtl(pMeta->pTtlMgr, &ctx);
×
UNCOV
465
  if (ret < 0) {
×
UNCOV
466
    metaError("vgId:%d, failed to delete ttl for table:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pME->name,
×
467
              pME->uid, tstrerror(ret));
468
  }
469
  return;
×
470
}
471

UNCOV
472
static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *pSuid, int8_t *pSysTbl) {
×
UNCOV
473
  void      *pData = NULL;
×
474
  int        nData = 0;
×
UNCOV
475
  int        rc = 0;
×
476
  SMetaEntry e = {0};
×
UNCOV
477
  SDecoder   dc = {0};
×
478
  int32_t    ret = 0;
×
479

480
  rc = tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData);
×
481
  if (rc < 0) {
×
482
    return rc;
×
483
  }
484
  int64_t version = ((SUidIdxVal *)pData)[0].version;
×
485

UNCOV
486
  rc = tdbTbGet(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pData, &nData);
×
487
  if (rc < 0) {
×
488
    tdbFree(pData);
×
UNCOV
489
    return rc;
×
490
  }
491

492
  tDecoderInit(&dc, pData, nData);
×
493
  rc = metaDecodeEntry(&dc, &e);
×
UNCOV
494
  if (rc < 0) {
×
495
    tDecoderClear(&dc);
×
496
    return rc;
×
497
  }
498

499
  if (type) *type = e.type;
×
500

UNCOV
501
  if (e.type == TSDB_CHILD_TABLE) {
×
UNCOV
502
    if (pSuid) *pSuid = e.ctbEntry.suid;
×
UNCOV
503
    void *tData = NULL;
×
504
    int   tLen = 0;
×
505

UNCOV
506
    if (tdbTbGet(pMeta->pUidIdx, &e.ctbEntry.suid, sizeof(tb_uid_t), &tData, &tLen) == 0) {
×
507
      STbDbKey tbDbKey = {.uid = e.ctbEntry.suid, .version = ((SUidIdxVal *)tData)[0].version};
×
508
      if (tdbTbGet(pMeta->pTbDb, &tbDbKey, sizeof(tbDbKey), &tData, &tLen) == 0) {
×
509
        SDecoder   tdc = {0};
×
510
        SMetaEntry stbEntry = {0};
×
511

UNCOV
512
        tDecoderInit(&tdc, tData, tLen);
×
513
        int32_t ret = metaDecodeEntry(&tdc, &stbEntry);
×
514
        if (ret < 0) {
×
515
          tDecoderClear(&tdc);
×
516
          metaError("vgId:%d, failed to decode child table:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name,
×
517
                    e.ctbEntry.suid, tstrerror(ret));
UNCOV
518
          return ret;
×
519
        }
520

UNCOV
521
        if (pSysTbl) *pSysTbl = metaTbInFilterCache(pMeta, stbEntry.name, 1) ? 1 : 0;
×
522

523
        SSchema        *pTagColumn = NULL;
×
UNCOV
524
        SSchemaWrapper *pTagSchema = &stbEntry.stbEntry.schemaTag;
×
UNCOV
525
        if (pTagSchema->nCols == 1 && pTagSchema->pSchema[0].type == TSDB_DATA_TYPE_JSON) {
×
526
          pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0];
×
527
          ret = metaDelJsonVarFromIdx(pMeta, &e, pTagColumn);
×
528
          if (ret < 0) {
×
529
            metaError("vgId:%d, failed to delete json var from idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode),
×
530
                      e.name, e.uid, tstrerror(ret));
531
          }
532
        } else {
UNCOV
533
          for (int i = 0; i < pTagSchema->nCols; i++) {
×
534
            pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[i];
×
UNCOV
535
            if (!IS_IDX_ON(pTagColumn)) continue;
×
536
            STagIdxKey *pTagIdxKey = NULL;
×
537
            int32_t     nTagIdxKey;
538

539
            const void *pTagData = NULL;
×
540
            int32_t     nTagData = 0;
×
541

UNCOV
542
            STagVal tagVal = {.cid = pTagColumn->colId};
×
543
            if (tTagGet((const STag *)e.ctbEntry.pTags, &tagVal)) {
×
UNCOV
544
              if (IS_VAR_DATA_TYPE(pTagColumn->type)) {
×
UNCOV
545
                pTagData = tagVal.pData;
×
546
                nTagData = (int32_t)tagVal.nData;
×
547
              } else {
548
                pTagData = &(tagVal.i64);
×
UNCOV
549
                nTagData = tDataTypes[pTagColumn->type].bytes;
×
550
              }
551
            } else {
UNCOV
552
              if (!IS_VAR_DATA_TYPE(pTagColumn->type)) {
×
553
                nTagData = tDataTypes[pTagColumn->type].bytes;
×
554
              }
555
            }
556

557
            if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid,
×
558
                                    &pTagIdxKey, &nTagIdxKey) == 0) {
559
              ret = tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
×
UNCOV
560
              if (ret < 0) {
×
561
                metaError("vgId:%d, failed to delete tag idx key:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode),
×
562
                          e.name, e.uid, tstrerror(ret));
563
              }
564
            }
565
            metaDestroyTagIdxKey(pTagIdxKey);
×
566
            pTagIdxKey = NULL;
×
567
          }
568
        }
UNCOV
569
        tDecoderClear(&tdc);
×
570
      }
UNCOV
571
      tdbFree(tData);
×
572
    }
573
  }
574

575
  ret = tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), pMeta->txn);
×
576
  if (ret < 0) {
×
UNCOV
577
    metaError("vgId:%d, failed to delete table:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
×
578
              tstrerror(ret));
579
  }
580
  ret = tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, pMeta->txn);
×
581
  if (ret < 0) {
×
582
    metaError("vgId:%d, failed to delete name idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
×
583
              tstrerror(ret));
584
  }
585
  ret = tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), pMeta->txn);
×
586
  if (ret < 0) {
×
587
    metaError("vgId:%d, failed to delete uid idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
×
588
              tstrerror(ret));
589
  }
590

591
  if (e.type == TSDB_CHILD_TABLE || e.type == TSDB_NORMAL_TABLE) metaDeleteBtimeIdx(pMeta, &e);
×
592
  if (e.type == TSDB_NORMAL_TABLE) metaDeleteNcolIdx(pMeta, &e);
×
593

594
  if (e.type != TSDB_SUPER_TABLE) metaDeleteTtl(pMeta, &e);
×
595

596
  if (e.type == TSDB_CHILD_TABLE) {
×
597
    ret =
UNCOV
598
        tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), pMeta->txn);
×
599
    if (ret < 0) {
×
600
      metaError("vgId:%d, failed to delete ctb idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
×
601
                tstrerror(ret));
602
    }
603

604
    --pMeta->pVnode->config.vndStats.numOfCTables;
×
605
    metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1, 0);
×
606
    ret = metaUidCacheClear(pMeta, e.ctbEntry.suid);
×
607
    if (ret < 0) {
×
608
      metaError("vgId:%d, failed to clear uid cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name,
×
609
                e.ctbEntry.suid, tstrerror(ret));
610
    }
611
    ret = metaTbGroupCacheClear(pMeta, e.ctbEntry.suid);
×
612
    if (ret < 0) {
×
UNCOV
613
      metaError("vgId:%d, failed to clear group cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name,
×
614
                e.ctbEntry.suid, tstrerror(ret));
615
    }
616
    /*
617
    if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
618
      tsdbCacheDropTable(pMeta->pVnode->pTsdb, e.uid, e.ctbEntry.suid, NULL);
619
    }
620
    */
621
  } else if (e.type == TSDB_NORMAL_TABLE) {
×
622
    // drop schema.db (todo)
623

624
    --pMeta->pVnode->config.vndStats.numOfNTables;
×
UNCOV
625
    pMeta->pVnode->config.vndStats.numOfNTimeSeries -= e.ntbEntry.schemaRow.nCols - 1;
×
626

627
    /*
628
    if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
629
      tsdbCacheDropTable(pMeta->pVnode->pTsdb, e.uid, -1, &e.ntbEntry.schemaRow);
630
    }
631
    */
UNCOV
632
  } else if (e.type == TSDB_SUPER_TABLE) {
×
633
    ret = tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), pMeta->txn);
×
634
    if (ret < 0) {
×
635
      metaError("vgId:%d, failed to delete suid idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
×
636
                tstrerror(ret));
637
    }
638
    // drop schema.db (todo)
639

640
    ret = metaStatsCacheDrop(pMeta, uid);
×
UNCOV
641
    if (ret < 0) {
×
UNCOV
642
      metaError("vgId:%d, failed to drop stats cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
×
643
                tstrerror(ret));
644
    }
645
    ret = metaUidCacheClear(pMeta, uid);
×
646
    if (ret < 0) {
×
647
      metaError("vgId:%d, failed to clear uid cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
×
648
                tstrerror(ret));
649
    }
UNCOV
650
    ret = metaTbGroupCacheClear(pMeta, uid);
×
UNCOV
651
    if (ret < 0) {
×
UNCOV
652
      metaError("vgId:%d, failed to clear group cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name,
×
653
                e.uid, tstrerror(ret));
654
    }
655
    --pMeta->pVnode->config.vndStats.numOfSTables;
×
656
  }
657

UNCOV
658
  ret = metaCacheDrop(pMeta, uid);
×
UNCOV
659
  if (ret < 0) {
×
UNCOV
660
    metaError("vgId:%d, failed to drop cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
×
661
              tstrerror(ret));
662
  }
663

UNCOV
664
  tDecoderClear(&dc);
×
UNCOV
665
  tdbFree(pData);
×
666

UNCOV
667
  return 0;
×
668
}
669

670
static int metaDeleteBtimeIdx(SMeta *pMeta, const SMetaEntry *pME) {
×
UNCOV
671
  SBtimeIdxKey btimeKey = {0};
×
672
  if (metaBuildBtimeIdxKey(&btimeKey, pME) < 0) {
×
UNCOV
673
    return 0;
×
674
  }
UNCOV
675
  return tdbTbDelete(pMeta->pBtimeIdx, &btimeKey, sizeof(btimeKey), pMeta->txn);
×
676
}
677

678
int metaDeleteNcolIdx(SMeta *pMeta, const SMetaEntry *pME) {
×
UNCOV
679
  SNcolIdxKey ncolKey = {0};
×
UNCOV
680
  if (metaBuildNColIdxKey(&ncolKey, pME) < 0) {
×
681
    return 0;
×
682
  }
UNCOV
683
  return tdbTbDelete(pMeta->pNcolIdx, &ncolKey, sizeof(ncolKey), pMeta->txn);
×
684
}
685

UNCOV
686
int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMetaRsp *pMetaRsp) {
×
687
  pMeta->changed = true;
×
688
  switch (pReq->action) {
×
689
    case TSDB_ALTER_TABLE_ADD_COLUMN:
×
690
    case TSDB_ALTER_TABLE_ADD_COLUMN_WITH_COMPRESS_OPTION:
691
      return metaAddTableColumn(pMeta, version, pReq, pMetaRsp);
×
692
    case TSDB_ALTER_TABLE_DROP_COLUMN:
×
UNCOV
693
      return metaDropTableColumn(pMeta, version, pReq, pMetaRsp);
×
UNCOV
694
    case TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES:
×
695
      return metaAlterTableColumnBytes(pMeta, version, pReq, pMetaRsp);
×
696
    case TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME:
×
697
      return metaAlterTableColumnName(pMeta, version, pReq, pMetaRsp);
×
698
    case TSDB_ALTER_TABLE_UPDATE_TAG_VAL:
×
UNCOV
699
      return metaUpdateTableTagValue(pMeta, version, pReq);
×
700
    case TSDB_ALTER_TABLE_UPDATE_MULTI_TAG_VAL:
×
701
      return metaUpdateTableMultiTagValue(pMeta, version, pReq);
×
702
    case TSDB_ALTER_TABLE_UPDATE_OPTIONS:
×
703
      return metaUpdateTableOptions2(pMeta, version, pReq);
×
UNCOV
704
    case TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS:
×
705
      return metaUpdateTableColCompress2(pMeta, version, pReq);
×
UNCOV
706
    default:
×
707
      return terrno = TSDB_CODE_VND_INVALID_TABLE_ACTION;
×
708
      break;
709
  }
710
}
711

712
static int metaUpdateChangeTime(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) {
×
713
  if (!tsTtlChangeOnWrite) return 0;
×
714

UNCOV
715
  if (changeTimeMs <= 0) {
×
716
    metaWarn("Skip to change ttl deletetion time on write, uid: %" PRId64, uid);
×
717
    return TSDB_CODE_VERSION_NOT_COMPATIBLE;
×
718
  }
719

UNCOV
720
  STtlUpdCtimeCtx ctx = {.uid = uid, .changeTimeMs = changeTimeMs, .pTxn = pMeta->txn};
×
721

722
  return ttlMgrUpdateChangeTime(pMeta->pTtlMgr, &ctx);
×
723
}
724

725
int metaUpdateChangeTimeWithLock(SMeta *pMeta, tb_uid_t uid, int64_t changeTimeMs) {
×
UNCOV
726
  if (!tsTtlChangeOnWrite) return 0;
×
727

728
  metaWLock(pMeta);
×
729
  int ret = metaUpdateChangeTime(pMeta, uid, changeTimeMs);
×
730
  metaULock(pMeta);
×
UNCOV
731
  return ret;
×
732
}
733

734
int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void *pTagData, int32_t nTagData, int8_t type, tb_uid_t uid,
×
735
                        STagIdxKey **ppTagIdxKey, int32_t *nTagIdxKey) {
UNCOV
736
  if (IS_VAR_DATA_TYPE(type)) {
×
UNCOV
737
    *nTagIdxKey = sizeof(STagIdxKey) + nTagData + VARSTR_HEADER_SIZE + sizeof(tb_uid_t);
×
738
  } else {
739
    *nTagIdxKey = sizeof(STagIdxKey) + nTagData + sizeof(tb_uid_t);
×
740
  }
741

UNCOV
742
  *ppTagIdxKey = (STagIdxKey *)taosMemoryMalloc(*nTagIdxKey);
×
743
  if (*ppTagIdxKey == NULL) {
×
744
    return terrno;
×
745
  }
746

747
  (*ppTagIdxKey)->suid = suid;
×
748
  (*ppTagIdxKey)->cid = cid;
×
749
  (*ppTagIdxKey)->isNull = (pTagData == NULL) ? 1 : 0;
×
750
  (*ppTagIdxKey)->type = type;
×
751

752
  // refactor
UNCOV
753
  if (IS_VAR_DATA_TYPE(type)) {
×
754
    memcpy((*ppTagIdxKey)->data, (uint16_t *)&nTagData, VARSTR_HEADER_SIZE);
×
755
    if (pTagData != NULL) memcpy((*ppTagIdxKey)->data + VARSTR_HEADER_SIZE, pTagData, nTagData);
×
UNCOV
756
    *(tb_uid_t *)((*ppTagIdxKey)->data + VARSTR_HEADER_SIZE + nTagData) = uid;
×
757
  } else {
UNCOV
758
    if (pTagData != NULL) memcpy((*ppTagIdxKey)->data, pTagData, nTagData);
×
759
    *(tb_uid_t *)((*ppTagIdxKey)->data + nTagData) = uid;
×
760
  }
761

UNCOV
762
  return 0;
×
763
}
764

765
void metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey) {
×
766
  if (pTagIdxKey) taosMemoryFree(pTagIdxKey);
×
767
}
×
768

UNCOV
769
static void colCompressDebug(SHashObj *pColCmprObj) {
×
770
  void *p = taosHashIterate(pColCmprObj, NULL);
×
UNCOV
771
  while (p) {
×
UNCOV
772
    uint32_t cmprAlg = *(uint32_t *)p;
×
UNCOV
773
    col_id_t colId = *(col_id_t *)taosHashGetKey(p, NULL);
×
UNCOV
774
    p = taosHashIterate(pColCmprObj, p);
×
775

776
    uint8_t l1, l2, lvl;
777
    tcompressDebug(cmprAlg, &l1, &l2, &lvl);
×
778

UNCOV
779
    const char *l1str = columnEncodeStr(l1);
×
UNCOV
780
    const char *l2str = columnCompressStr(l2);
×
781
    const char *lvlstr = columnLevelStr(lvl);
×
782
    metaDebug("colId: %d, encode:%s, compress:%s,level:%s", colId, l1str, l2str, lvlstr);
×
783
  }
784
  return;
×
785
}
786

787
int32_t metaGetColCmpr(SMeta *pMeta, tb_uid_t uid, SHashObj **ppColCmprObj) {
×
788
  int rc = 0;
×
789

790
  SHashObj *pColCmprObj = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_SMALLINT), false, HASH_NO_LOCK);
×
791
  if (pColCmprObj == NULL) {
×
792
    pColCmprObj = NULL;
×
793
    return TSDB_CODE_OUT_OF_MEMORY;
×
794
  }
795

UNCOV
796
  void      *pData = NULL;
×
797
  int        nData = 0;
×
798
  SMetaEntry e = {0};
×
799
  SDecoder   dc = {0};
×
800

UNCOV
801
  *ppColCmprObj = NULL;
×
802

UNCOV
803
  metaRLock(pMeta);
×
UNCOV
804
  rc = tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData);
×
805
  if (rc < 0) {
×
806
    taosHashClear(pColCmprObj);
×
UNCOV
807
    metaULock(pMeta);
×
808
    return TSDB_CODE_FAILED;
×
809
  }
810
  int64_t version = ((SUidIdxVal *)pData)[0].version;
×
811
  rc = tdbTbGet(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pData, &nData);
×
812
  if (rc < 0) {
×
813
    metaULock(pMeta);
×
UNCOV
814
    taosHashClear(pColCmprObj);
×
815
    metaError("failed to get table entry");
×
816
    return rc;
×
817
  }
818

819
  tDecoderInit(&dc, pData, nData);
×
820
  rc = metaDecodeEntry(&dc, &e);
×
UNCOV
821
  if (rc < 0) {
×
UNCOV
822
    tDecoderClear(&dc);
×
823
    tdbFree(pData);
×
824
    metaULock(pMeta);
×
825
    taosHashClear(pColCmprObj);
×
826
    return rc;
×
827
  }
828
  if (useCompress(e.type)) {
×
829
    SColCmprWrapper *p = &e.colCmpr;
×
UNCOV
830
    for (int32_t i = 0; i < p->nCols; i++) {
×
UNCOV
831
      SColCmpr *pCmpr = &p->pColCmpr[i];
×
832
      rc = taosHashPut(pColCmprObj, &pCmpr->id, sizeof(pCmpr->id), &pCmpr->alg, sizeof(pCmpr->alg));
×
833
      if (rc < 0) {
×
834
        tDecoderClear(&dc);
×
835
        tdbFree(pData);
×
UNCOV
836
        metaULock(pMeta);
×
UNCOV
837
        taosHashClear(pColCmprObj);
×
838
        return rc;
×
839
      }
840
    }
841
  } else {
UNCOV
842
    tDecoderClear(&dc);
×
UNCOV
843
    tdbFree(pData);
×
844
    metaULock(pMeta);
×
845
    taosHashClear(pColCmprObj);
×
846
    return 0;
×
847
  }
848
  tDecoderClear(&dc);
×
849
  tdbFree(pData);
×
850
  metaULock(pMeta);
×
851

852
  *ppColCmprObj = pColCmprObj;
×
UNCOV
853
  colCompressDebug(pColCmprObj);
×
854

855
  return 0;
×
856
}
857
// refactor later
UNCOV
858
void *metaGetIdx(SMeta *pMeta) { return pMeta->pTagIdx; }
×
UNCOV
859
void *metaGetIvtIdx(SMeta *pMeta) { return pMeta->pTagIvtIdx; }
×
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