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

taosdata / TDengine / #3620

21 Feb 2025 09:00AM UTC coverage: 63.573% (+0.2%) from 63.423%
#3620

push

travis-ci

web-flow
ci: taosBenchmark add coverage cases branch 3.0 (#29788)

* fix: add unit test for taos-tools

* fix: only .cpp include

* fix: remove no use function

* fix: restore toolsSys.c

* fix: add toolsSys case

* fix: rebuild error fixed

* fix: fix build error

* fix: support get vgroups with core and memory limit

* fix: build error for strcasecmp

* fix: add insertBasic.py case

* fix: add command line set vgroups=3

* fix: change with ns database

* toolscJson read with int replace float and add insertPrecison.py

* fix: add insertBindVGroup.json case

* fix: remove public fun removeQuotation

* fix: vgroups change method

* fix: memory leak for runInsertLimitThread slot

* insertPrecision.py word write wrong

* fix: check isFloat number

* fix: vgroups change logic error

* fix: insertBasic.py real and expect error

* fix: adjust default vgroups

* fix: adjust default vgroups modify comment

148962 of 300203 branches covered (49.62%)

Branch coverage included in aggregate %.

15 of 16 new or added lines in 1 file covered. (93.75%)

2018 existing lines in 133 files now uncovered.

233201 of 300933 relevant lines covered (77.49%)

18174406.98 hits per line

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

45.83
/source/dnode/vnode/src/meta/metaCache.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
#include "meta.h"
16

17
#ifdef TD_ENTERPRISE
18
extern const char* tkLogStb[];
19
extern const char* tkAuditStb[];
20
extern const int   tkLogStbNum;
21
extern const int   tkAuditStbNum;
22
#endif
23

24
#define TAG_FILTER_RES_KEY_LEN  32
25
#define META_CACHE_BASE_BUCKET  1024
26
#define META_CACHE_STATS_BUCKET 16
27

28
// (uid , suid) : child table
29
// (uid,     0) : normal table
30
// (suid, suid) : super table
31
typedef struct SMetaCacheEntry SMetaCacheEntry;
32
struct SMetaCacheEntry {
33
  SMetaCacheEntry* next;
34
  SMetaInfo        info;
35
};
36

37
typedef struct SMetaStbStatsEntry {
38
  struct SMetaStbStatsEntry* next;
39
  SMetaStbStats              info;
40
} SMetaStbStatsEntry;
41

42
typedef struct STagFilterResEntry {
43
  SHashObj *set;    // the set of md5 digest, extracted from the serialized tag query condition
44
  uint32_t hitTimes;  // queried times for current super table
45
} STagFilterResEntry;
46

47
struct SMetaCache {
48
  // child, normal, super, table entry cache
49
  struct SEntryCache {
50
    int32_t           nEntry;
51
    int32_t           nBucket;
52
    SMetaCacheEntry** aBucket;
53
  } sEntryCache;
54

55
  // stable stats cache
56
  struct SStbStatsCache {
57
    int32_t              nEntry;
58
    int32_t              nBucket;
59
    SMetaStbStatsEntry** aBucket;
60
  } sStbStatsCache;
61

62
  // query cache
63
  struct STagFilterResCache {
64
    TdThreadMutex lock;
65
    uint32_t      accTimes;
66
    SHashObj*     pTableEntry;
67
    SLRUCache*    pUidResCache;
68
  } sTagFilterResCache;
69

70
  struct STbGroupResCache {
71
    TdThreadMutex lock;
72
    uint32_t      accTimes;
73
    SHashObj*     pTableEntry;
74
    SLRUCache*    pResCache;
75
  } STbGroupResCache;
76

77
  struct STbFilterCache {
78
    SHashObj* pStb;
79
    SHashObj* pStbName;
80
  } STbFilterCache;
81
};
82

83
static void entryCacheClose(SMeta* pMeta) {
12,307✔
84
  if (pMeta->pCache) {
12,307!
85
    // close entry cache
86
    for (int32_t iBucket = 0; iBucket < pMeta->pCache->sEntryCache.nBucket; iBucket++) {
12,693,011✔
87
      SMetaCacheEntry* pEntry = pMeta->pCache->sEntryCache.aBucket[iBucket];
12,680,761✔
88
      while (pEntry) {
12,882,027✔
89
        SMetaCacheEntry* tEntry = pEntry->next;
201,323✔
90
        taosMemoryFree(pEntry);
201,323!
91
        pEntry = tEntry;
201,266✔
92
      }
93
    }
94
    taosMemoryFree(pMeta->pCache->sEntryCache.aBucket);
12,250!
95
  }
96
}
12,307✔
97

98
static void statsCacheClose(SMeta* pMeta) {
12,307✔
99
  if (pMeta->pCache) {
12,307!
100
    // close entry cache
101
    for (int32_t iBucket = 0; iBucket < pMeta->pCache->sStbStatsCache.nBucket; iBucket++) {
218,353✔
102
      SMetaStbStatsEntry* pEntry = pMeta->pCache->sStbStatsCache.aBucket[iBucket];
206,035✔
103
      while (pEntry) {
226,562✔
104
        SMetaStbStatsEntry* tEntry = pEntry->next;
20,516✔
105
        taosMemoryFree(pEntry);
20,516!
106
        pEntry = tEntry;
20,527✔
107
      }
108
    }
109
    taosMemoryFree(pMeta->pCache->sStbStatsCache.aBucket);
12,318!
110
  }
111
}
12,307✔
112

113
static void freeCacheEntryFp(void* param) {
×
114
  STagFilterResEntry** p = param;
×
115
  taosHashCleanup((*p)->set);
×
116
  taosMemoryFreeClear(*p);
×
117
}
×
118

119
int32_t metaCacheOpen(SMeta* pMeta) {
12,310✔
120
  int32_t code = 0;
12,310✔
121
  int32_t lino;
122

123
  pMeta->pCache = (SMetaCache*)taosMemoryCalloc(1, sizeof(SMetaCache));
12,310!
124
  if (pMeta->pCache == NULL) {
12,334!
125
    TSDB_CHECK_CODE(code = terrno, lino, _exit);
×
126
  }
127

128
  // open entry cache
129
  pMeta->pCache->sEntryCache.nEntry = 0;
12,334✔
130
  pMeta->pCache->sEntryCache.nBucket = META_CACHE_BASE_BUCKET;
12,334✔
131
  pMeta->pCache->sEntryCache.aBucket =
24,668✔
132
      (SMetaCacheEntry**)taosMemoryCalloc(pMeta->pCache->sEntryCache.nBucket, sizeof(SMetaCacheEntry*));
12,334!
133
  if (pMeta->pCache->sEntryCache.aBucket == NULL) {
12,334!
134
    TSDB_CHECK_CODE(code = terrno, lino, _exit);
×
135
  }
136

137
  // open stats cache
138
  pMeta->pCache->sStbStatsCache.nEntry = 0;
12,334✔
139
  pMeta->pCache->sStbStatsCache.nBucket = META_CACHE_STATS_BUCKET;
12,334✔
140
  pMeta->pCache->sStbStatsCache.aBucket =
24,667✔
141
      (SMetaStbStatsEntry**)taosMemoryCalloc(pMeta->pCache->sStbStatsCache.nBucket, sizeof(SMetaStbStatsEntry*));
12,334!
142
  if (pMeta->pCache->sStbStatsCache.aBucket == NULL) {
12,333!
143
    TSDB_CHECK_CODE(code = terrno, lino, _exit);
×
144
  }
145

146
  pMeta->pCache->sTagFilterResCache.pUidResCache = taosLRUCacheInit(5 * 1024 * 1024, -1, 0.5);
12,333✔
147
  if (pMeta->pCache->sTagFilterResCache.pUidResCache == NULL) {
12,333!
148
    TSDB_CHECK_CODE(code = terrno, lino, _exit);
×
149
  }
150

151
  pMeta->pCache->sTagFilterResCache.accTimes = 0;
12,333✔
152
  pMeta->pCache->sTagFilterResCache.pTableEntry =
24,665✔
153
      taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK);
12,333✔
154
  if (pMeta->pCache->sTagFilterResCache.pTableEntry == NULL) {
12,333!
155
    TSDB_CHECK_CODE(code = terrno, lino, _exit);
×
156
  }
157

158
  taosHashSetFreeFp(pMeta->pCache->sTagFilterResCache.pTableEntry, freeCacheEntryFp);
12,333✔
159
  (void)taosThreadMutexInit(&pMeta->pCache->sTagFilterResCache.lock, NULL);
12,334✔
160

161
  pMeta->pCache->STbGroupResCache.pResCache = taosLRUCacheInit(5 * 1024 * 1024, -1, 0.5);
12,334✔
162
  if (pMeta->pCache->STbGroupResCache.pResCache == NULL) {
12,334!
163
    TSDB_CHECK_CODE(code = terrno, lino, _exit);
×
164
  }
165

166
  pMeta->pCache->STbGroupResCache.accTimes = 0;
12,334✔
167
  pMeta->pCache->STbGroupResCache.pTableEntry =
24,668✔
168
      taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK);
12,334✔
169
  if (pMeta->pCache->STbGroupResCache.pTableEntry == NULL) {
12,334!
170
    TSDB_CHECK_CODE(code = terrno, lino, _exit);
×
171
  }
172

173
  taosHashSetFreeFp(pMeta->pCache->STbGroupResCache.pTableEntry, freeCacheEntryFp);
12,334✔
174
  (void)taosThreadMutexInit(&pMeta->pCache->STbGroupResCache.lock, NULL);
12,334✔
175

176
  pMeta->pCache->STbFilterCache.pStb =
24,668✔
177
      taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
12,334✔
178
  if (pMeta->pCache->STbFilterCache.pStb == NULL) {
12,334!
179
    TSDB_CHECK_CODE(code = terrno, lino, _exit);
×
180
  }
181

182
  pMeta->pCache->STbFilterCache.pStbName =
24,667✔
183
      taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), false, HASH_NO_LOCK);
12,334✔
184
  if (pMeta->pCache->STbFilterCache.pStbName == NULL) {
12,333!
185
    TSDB_CHECK_CODE(code = terrno, lino, _exit);
×
186
  }
187

188
_exit:
12,333✔
189
  if (code) {
12,333!
190
    metaError("vgId:%d, %s failed at %s:%d since %s", TD_VID(pMeta->pVnode), __func__, __FILE__, lino, tstrerror(code));
×
191
    metaCacheClose(pMeta);
×
192
  } else {
193
    metaDebug("vgId:%d, %s success", TD_VID(pMeta->pVnode), __func__);
12,333✔
194
  }
195
  return code;
12,333✔
196
}
197

198
void metaCacheClose(SMeta* pMeta) {
12,307✔
199
  if (pMeta->pCache) {
12,307!
200
    entryCacheClose(pMeta);
12,307✔
201
    statsCacheClose(pMeta);
12,307✔
202

203
    taosHashClear(pMeta->pCache->sTagFilterResCache.pTableEntry);
12,307✔
204
    taosLRUCacheCleanup(pMeta->pCache->sTagFilterResCache.pUidResCache);
12,306✔
205
    (void)taosThreadMutexDestroy(&pMeta->pCache->sTagFilterResCache.lock);
12,307✔
206
    taosHashCleanup(pMeta->pCache->sTagFilterResCache.pTableEntry);
12,307✔
207

208
    taosHashClear(pMeta->pCache->STbGroupResCache.pTableEntry);
12,307✔
209
    taosLRUCacheCleanup(pMeta->pCache->STbGroupResCache.pResCache);
12,307✔
210
    (void)taosThreadMutexDestroy(&pMeta->pCache->STbGroupResCache.lock);
12,307✔
211
    taosHashCleanup(pMeta->pCache->STbGroupResCache.pTableEntry);
12,307✔
212

213
    taosHashCleanup(pMeta->pCache->STbFilterCache.pStb);
12,307✔
214
    taosHashCleanup(pMeta->pCache->STbFilterCache.pStbName);
12,307✔
215

216
    taosMemoryFree(pMeta->pCache);
12,307!
217
    pMeta->pCache = NULL;
12,307✔
218
  }
219
}
12,307✔
220

221
static void metaRehashCache(SMetaCache* pCache, int8_t expand) {
33✔
222
  int32_t code = 0;
33✔
223
  int32_t nBucket;
224

225
  if (expand) {
33!
226
    nBucket = pCache->sEntryCache.nBucket * 2;
33✔
227
  } else {
228
    nBucket = pCache->sEntryCache.nBucket / 2;
×
229
  }
230

231
  SMetaCacheEntry** aBucket = (SMetaCacheEntry**)taosMemoryCalloc(nBucket, sizeof(SMetaCacheEntry*));
33!
232
  if (aBucket == NULL) {
33!
233
    return;
×
234
  }
235

236
  // rehash
237
  for (int32_t iBucket = 0; iBucket < pCache->sEntryCache.nBucket; iBucket++) {
82,977✔
238
    SMetaCacheEntry* pEntry = pCache->sEntryCache.aBucket[iBucket];
82,944✔
239

240
    while (pEntry) {
165,888✔
241
      SMetaCacheEntry* pTEntry = pEntry->next;
82,944✔
242

243
      pEntry->next = aBucket[TABS(pEntry->info.uid) % nBucket];
82,944✔
244
      aBucket[TABS(pEntry->info.uid) % nBucket] = pEntry;
82,944✔
245

246
      pEntry = pTEntry;
82,944✔
247
    }
248
  }
249

250
  // final set
251
  taosMemoryFree(pCache->sEntryCache.aBucket);
33!
252
  pCache->sEntryCache.nBucket = nBucket;
33✔
253
  pCache->sEntryCache.aBucket = aBucket;
33✔
254
  return;
33✔
255
}
256

257
int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) {
222,127✔
258
  int32_t code = 0;
222,127✔
259

260
  // meta is wlocked for calling this func.
261

262
  // search
263
  SMetaCache*       pCache = pMeta->pCache;
222,127✔
264
  int32_t           iBucket = TABS(pInfo->uid) % pCache->sEntryCache.nBucket;
222,127✔
265
  SMetaCacheEntry** ppEntry = &pCache->sEntryCache.aBucket[iBucket];
222,127✔
266
  while (*ppEntry && (*ppEntry)->info.uid != pInfo->uid) {
245,178✔
267
    ppEntry = &(*ppEntry)->next;
23,051✔
268
  }
269

270
  if (*ppEntry) {  // update
222,127✔
271
    if (pInfo->suid != (*ppEntry)->info.suid) {
11,507!
272
      metaError("meta/cache: suid should be same as the one in cache.");
×
273
      return TSDB_CODE_INVALID_PARA;
×
274
    }
275
    if (pInfo->version > (*ppEntry)->info.version) {
11,507!
276
      (*ppEntry)->info.version = pInfo->version;
11,508✔
277
      (*ppEntry)->info.skmVer = pInfo->skmVer;
11,508✔
278
    }
279
  } else {  // insert
280
    if (pCache->sEntryCache.nEntry >= pCache->sEntryCache.nBucket) {
210,620✔
281
      metaRehashCache(pCache, 1);
33✔
282

283
      iBucket = TABS(pInfo->uid) % pCache->sEntryCache.nBucket;
33✔
284
    }
285

286
    SMetaCacheEntry* pEntryNew = (SMetaCacheEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
210,620!
287
    if (pEntryNew == NULL) {
210,620!
288
      code = terrno;
×
289
      goto _exit;
×
290
    }
291

292
    pEntryNew->info = *pInfo;
210,620✔
293
    pEntryNew->next = pCache->sEntryCache.aBucket[iBucket];
210,620✔
294
    pCache->sEntryCache.aBucket[iBucket] = pEntryNew;
210,620✔
295
    pCache->sEntryCache.nEntry++;
210,620✔
296
  }
297

298
_exit:
222,127✔
299
  return code;
222,127✔
300
}
301

302
int32_t metaCacheDrop(SMeta* pMeta, int64_t uid) {
9,832✔
303
  int32_t code = 0;
9,832✔
304

305
  SMetaCache*       pCache = pMeta->pCache;
9,832✔
306
  int32_t           iBucket = TABS(uid) % pCache->sEntryCache.nBucket;
9,832✔
307
  SMetaCacheEntry** ppEntry = &pCache->sEntryCache.aBucket[iBucket];
9,832✔
308
  while (*ppEntry && (*ppEntry)->info.uid != uid) {
9,843✔
309
    ppEntry = &(*ppEntry)->next;
11✔
310
  }
311

312
  SMetaCacheEntry* pEntry = *ppEntry;
9,832✔
313
  if (pEntry) {
9,832✔
314
    *ppEntry = pEntry->next;
8,349✔
315
    taosMemoryFree(pEntry);
8,349!
316
    pCache->sEntryCache.nEntry--;
8,350✔
317
    if (pCache->sEntryCache.nEntry < pCache->sEntryCache.nBucket / 4 &&
8,350✔
318
        pCache->sEntryCache.nBucket > META_CACHE_BASE_BUCKET) {
7,853!
319
      metaRehashCache(pCache, 0);
×
320
    }
321
  } else {
322
    code = TSDB_CODE_NOT_FOUND;
1,483✔
323
  }
324

325
_exit:
9,835✔
326
  return code;
9,835✔
327
}
328

329
int32_t metaCacheGet(SMeta* pMeta, int64_t uid, SMetaInfo* pInfo) {
32,125,307✔
330
  int32_t code = 0;
32,125,307✔
331

332
  SMetaCache*      pCache = pMeta->pCache;
32,125,307✔
333
  int32_t          iBucket = TABS(uid) % pCache->sEntryCache.nBucket;
32,125,307✔
334
  SMetaCacheEntry* pEntry = pCache->sEntryCache.aBucket[iBucket];
32,125,307✔
335

336
  while (pEntry && pEntry->info.uid != uid) {
40,252,938✔
337
    pEntry = pEntry->next;
8,127,631✔
338
  }
339

340
  if (pEntry) {
32,125,307✔
341
    if (pInfo) {
31,889,512✔
342
      *pInfo = pEntry->info;
31,888,874✔
343
    }
344
  } else {
345
    code = TSDB_CODE_NOT_FOUND;
235,795✔
346
  }
347

348
  return code;
32,125,307✔
349
}
350

351
static int32_t metaRehashStatsCache(SMetaCache* pCache, int8_t expand) {
225✔
352
  int32_t code = 0;
225✔
353
  int32_t nBucket;
354

355
  if (expand) {
225✔
356
    nBucket = pCache->sStbStatsCache.nBucket * 2;
209✔
357
  } else {
358
    nBucket = pCache->sStbStatsCache.nBucket / 2;
16✔
359
  }
360

361
  SMetaStbStatsEntry** aBucket = (SMetaStbStatsEntry**)taosMemoryCalloc(nBucket, sizeof(SMetaStbStatsEntry*));
225!
362
  if (aBucket == NULL) {
225!
363
    code = terrno;
×
364
    goto _exit;
×
365
  }
366

367
  // rehash
368
  for (int32_t iBucket = 0; iBucket < pCache->sStbStatsCache.nBucket; iBucket++) {
10,417✔
369
    SMetaStbStatsEntry* pEntry = pCache->sStbStatsCache.aBucket[iBucket];
10,192✔
370

371
    while (pEntry) {
19,840✔
372
      SMetaStbStatsEntry* pTEntry = pEntry->next;
9,648✔
373

374
      pEntry->next = aBucket[TABS(pEntry->info.uid) % nBucket];
9,648✔
375
      aBucket[TABS(pEntry->info.uid) % nBucket] = pEntry;
9,648✔
376

377
      pEntry = pTEntry;
9,648✔
378
    }
379
  }
380

381
  // final set
382
  taosMemoryFree(pCache->sStbStatsCache.aBucket);
225!
383
  pCache->sStbStatsCache.nBucket = nBucket;
225✔
384
  pCache->sStbStatsCache.aBucket = aBucket;
225✔
385

386
_exit:
225✔
387
  return code;
225✔
388
}
389

390
int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo) {
167,378✔
391
  int32_t code = 0;
167,378✔
392

393
  // meta is wlocked for calling this func.
394

395
  // search
396
  SMetaCache*          pCache = pMeta->pCache;
167,378✔
397
  int32_t              iBucket = TABS(pInfo->uid) % pCache->sStbStatsCache.nBucket;
167,378✔
398
  SMetaStbStatsEntry** ppEntry = &pCache->sStbStatsCache.aBucket[iBucket];
167,378✔
399
  while (*ppEntry && (*ppEntry)->info.uid != pInfo->uid) {
173,599✔
400
    ppEntry = &(*ppEntry)->next;
6,221✔
401
  }
402

403
  if (*ppEntry) {  // update
167,378✔
404
    (*ppEntry)->info.ctbNum = pInfo->ctbNum;
144,768✔
405
    (*ppEntry)->info.colNum = pInfo->colNum;
144,768✔
406
  } else {  // insert
407
    if (pCache->sStbStatsCache.nEntry >= pCache->sStbStatsCache.nBucket) {
22,610✔
408
      TAOS_UNUSED(metaRehashStatsCache(pCache, 1));
209✔
409
      iBucket = TABS(pInfo->uid) % pCache->sStbStatsCache.nBucket;
209✔
410
    }
411

412
    SMetaStbStatsEntry* pEntryNew = (SMetaStbStatsEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
22,610!
413
    if (pEntryNew == NULL) {
22,627!
414
      code = terrno;
×
UNCOV
415
      goto _exit;
×
416
    }
417

418
    pEntryNew->info = *pInfo;
22,627✔
419
    pEntryNew->next = pCache->sStbStatsCache.aBucket[iBucket];
22,627✔
420
    pCache->sStbStatsCache.aBucket[iBucket] = pEntryNew;
22,627✔
421
    pCache->sStbStatsCache.nEntry++;
22,627✔
422
  }
423

424
_exit:
167,395✔
425
  return code;
167,395✔
426
}
427

428
int32_t metaStatsCacheDrop(SMeta* pMeta, int64_t uid) {
2,344✔
429
  int32_t code = 0;
2,344✔
430

431
  SMetaCache*          pCache = pMeta->pCache;
2,344✔
432
  int32_t              iBucket = TABS(uid) % pCache->sStbStatsCache.nBucket;
2,344✔
433
  SMetaStbStatsEntry** ppEntry = &pCache->sStbStatsCache.aBucket[iBucket];
2,344✔
434
  while (*ppEntry && (*ppEntry)->info.uid != uid) {
2,470✔
435
    ppEntry = &(*ppEntry)->next;
126✔
436
  }
437

438
  SMetaStbStatsEntry* pEntry = *ppEntry;
2,344✔
439
  if (pEntry) {
2,344✔
440
    *ppEntry = pEntry->next;
2,070✔
441
    taosMemoryFree(pEntry);
2,070!
442
    pCache->sStbStatsCache.nEntry--;
2,070✔
443
    if (pCache->sStbStatsCache.nEntry < pCache->sStbStatsCache.nBucket / 4 &&
2,070✔
444
        pCache->sStbStatsCache.nBucket > META_CACHE_STATS_BUCKET) {
1,659✔
445
      TAOS_UNUSED(metaRehashStatsCache(pCache, 0));
16✔
446
    }
447
  } else {
448
    code = TSDB_CODE_NOT_FOUND;
274✔
449
  }
450

451
_exit:
2,346✔
452
  return code;
2,346✔
453
}
454

455
int32_t metaStatsCacheGet(SMeta* pMeta, int64_t uid, SMetaStbStats* pInfo) {
455,634✔
456
  int32_t code = TSDB_CODE_SUCCESS;
455,634✔
457

458
  SMetaCache*         pCache = pMeta->pCache;
455,634✔
459
  int32_t             iBucket = TABS(uid) % pCache->sStbStatsCache.nBucket;
455,634✔
460
  SMetaStbStatsEntry* pEntry = pCache->sStbStatsCache.aBucket[iBucket];
455,634✔
461

462
  while (pEntry && pEntry->info.uid != uid) {
492,569✔
463
    pEntry = pEntry->next;
36,935✔
464
  }
465

466
  if (pEntry) {
455,634✔
467
    if (pInfo) {
418,484✔
468
      *pInfo = pEntry->info;
418,477✔
469
    }
470
  } else {
471
    code = TSDB_CODE_NOT_FOUND;
37,150✔
472
  }
473

474
  return code;
455,634✔
475
}
476

477
static FORCE_INLINE void setMD5DigestInKey(uint64_t* pBuf, const char* key, int32_t keyLen) {
478
  memcpy(&pBuf[2], key, keyLen);
298,912✔
UNCOV
479
}
×
480

481
// the format of key:
482
// hash table address(8bytes) + suid(8bytes) + MD5 digest(16bytes)
483
static void initCacheKey(uint64_t* buf, const SHashObj* pHashMap, uint64_t suid, const char* key, int32_t keyLen) {
298,912✔
484
  buf[0] = (uint64_t)pHashMap;
298,912✔
485
  buf[1] = suid;
298,912✔
486
  setMD5DigestInKey(buf, key, keyLen);
487
}
298,912✔
488

UNCOV
489
int32_t metaGetCachedTableUidList(void* pVnode, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray* pList1,
×
490
                                  bool* acquireRes) {
491
  SMeta*  pMeta = ((SVnode*)pVnode)->pMeta;
×
UNCOV
492
  int32_t vgId = TD_VID(pMeta->pVnode);
×
493

494
  // generate the composed key for LRU cache
495
  SLRUCache*     pCache = pMeta->pCache->sTagFilterResCache.pUidResCache;
×
496
  SHashObj*      pTableMap = pMeta->pCache->sTagFilterResCache.pTableEntry;
×
UNCOV
497
  TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock;
×
498

UNCOV
499
  *acquireRes = 0;
×
500
  uint64_t key[4];
UNCOV
501
  initCacheKey(key, pTableMap, suid, (const char*)pKey, keyLen);
×
502

503
  (void)taosThreadMutexLock(pLock);
×
UNCOV
504
  pMeta->pCache->sTagFilterResCache.accTimes += 1;
×
505

506
  LRUHandle* pHandle = taosLRUCacheLookup(pCache, key, TAG_FILTER_RES_KEY_LEN);
×
507
  if (pHandle == NULL) {
×
508
    (void)taosThreadMutexUnlock(pLock);
×
UNCOV
509
    return TSDB_CODE_SUCCESS;
×
510
  }
511

512
  // do some book mark work after acquiring the filter result from cache
513
  STagFilterResEntry** pEntry = taosHashGet(pTableMap, &suid, sizeof(uint64_t));
×
514
  if (NULL == pEntry) {
×
515
    metaError("meta/cache: pEntry should not be NULL.");
×
UNCOV
516
    return TSDB_CODE_NOT_FOUND;
×
517
  }
518

UNCOV
519
  *acquireRes = 1;
×
520

521
  const char* p = taosLRUCacheValue(pCache, pHandle);
×
UNCOV
522
  int32_t     size = *(int32_t*)p;
×
523

524
  // set the result into the buffer
525
  if (taosArrayAddBatch(pList1, p + sizeof(int32_t), size) == NULL) {
×
UNCOV
526
    return terrno;
×
527
  }
528

UNCOV
529
  (*pEntry)->hitTimes += 1;
×
530

531
  uint32_t acc = pMeta->pCache->sTagFilterResCache.accTimes;
×
532
  if ((*pEntry)->hitTimes % 5000 == 0 && (*pEntry)->hitTimes > 0) {
×
UNCOV
533
    metaInfo("vgId:%d cache hit:%d, total acc:%d, rate:%.2f", vgId, (*pEntry)->hitTimes, acc,
×
534
             ((double)(*pEntry)->hitTimes) / acc);
535
  }
536

UNCOV
537
  bool ret = taosLRUCacheRelease(pCache, pHandle, false);
×
538

539
  // unlock meta
540
  (void)taosThreadMutexUnlock(pLock);
×
UNCOV
541
  return TSDB_CODE_SUCCESS;
×
542
}
543

UNCOV
544
static void freeUidCachePayload(const void* key, size_t keyLen, void* value, void* ud) {
×
545
  (void)ud;
546
  if (value == NULL) {
×
UNCOV
547
    return;
×
548
  }
549

550
  const uint64_t* p = key;
×
551
  if (keyLen != sizeof(int64_t) * 4) {
×
552
    metaError("key length is invalid, length:%d, expect:%d", (int32_t)keyLen, (int32_t)sizeof(uint64_t) * 2);
×
UNCOV
553
    return;
×
554
  }
555

UNCOV
556
  SHashObj* pHashObj = (SHashObj*)p[0];
×
557

UNCOV
558
  STagFilterResEntry** pEntry = taosHashGet(pHashObj, &p[1], sizeof(uint64_t));
×
559

560
  if (pEntry != NULL && (*pEntry) != NULL) {
×
561
    int64_t st = taosGetTimestampUs();
×
562
    int32_t code = taosHashRemove((*pEntry)->set, &p[2], sizeof(uint64_t) * 2);
×
563
    if (code == TSDB_CODE_SUCCESS) {
×
564
      double el = (taosGetTimestampUs() - st) / 1000.0;
×
UNCOV
565
      metaInfo("clear items in meta-cache, remain cached item:%d, elapsed time:%.2fms", taosHashGetSize((*pEntry)->set),
×
566
               el);
567
    }
568
  }
569

UNCOV
570
  taosMemoryFree(value);
×
571
}
572

573
static int32_t addNewEntry(SHashObj* pTableEntry, const void* pKey, int32_t keyLen, uint64_t suid) {
×
574
  int32_t             code = TSDB_CODE_SUCCESS;
×
575
  int32_t             lino = 0;
×
576
  STagFilterResEntry* p = taosMemoryMalloc(sizeof(STagFilterResEntry));
×
UNCOV
577
  TSDB_CHECK_NULL(p, code, lino, _end, terrno);
×
578

579
  p->hitTimes = 0;
×
580
  p->set = taosHashInit(1024, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
×
581
  TSDB_CHECK_NULL(p->set, code, lino, _end, terrno);
×
582
  code = taosHashPut(p->set, pKey, keyLen, NULL, 0);
×
583
  TSDB_CHECK_CODE(code, lino, _end);
×
584
  code = taosHashPut(pTableEntry, &suid, sizeof(uint64_t), &p, POINTER_BYTES);
×
UNCOV
585
  TSDB_CHECK_CODE(code, lino, _end);
×
586

587
_end:
×
588
  if (code != TSDB_CODE_SUCCESS) {
×
589
    metaError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
×
590
    if (p != NULL) {
×
591
      if (p->set != NULL) {
×
UNCOV
592
        taosHashCleanup(p->set);
×
593
      }
UNCOV
594
      taosMemoryFree(p);
×
595
    }
596
  }
UNCOV
597
  return code;
×
598
}
599

600
// check both the payload size and selectivity ratio
UNCOV
601
int32_t metaUidFilterCachePut(void* pVnode, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload,
×
602
                              int32_t payloadLen, double selectivityRatio) {
603
  int32_t code = 0;
×
604
  SMeta*  pMeta = ((SVnode*)pVnode)->pMeta;
×
UNCOV
605
  int32_t vgId = TD_VID(pMeta->pVnode);
×
606

607
  if (selectivityRatio > tsSelectivityRatio) {
×
UNCOV
608
    metaDebug("vgId:%d, suid:%" PRIu64
×
609
              " failed to add to uid list cache, due to selectivity ratio %.2f less than threshold %.2f",
610
              vgId, suid, selectivityRatio, tsSelectivityRatio);
611
    taosMemoryFree(pPayload);
×
UNCOV
612
    return TSDB_CODE_SUCCESS;
×
613
  }
614

615
  if (payloadLen > tsTagFilterResCacheSize) {
×
UNCOV
616
    metaDebug("vgId:%d, suid:%" PRIu64
×
617
              " failed to add to uid list cache, due to payload length %d greater than threshold %d",
618
              vgId, suid, payloadLen, tsTagFilterResCacheSize);
619
    taosMemoryFree(pPayload);
×
UNCOV
620
    return TSDB_CODE_SUCCESS;
×
621
  }
622

623
  SLRUCache*     pCache = pMeta->pCache->sTagFilterResCache.pUidResCache;
×
624
  SHashObj*      pTableEntry = pMeta->pCache->sTagFilterResCache.pTableEntry;
×
UNCOV
625
  TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock;
×
626

627
  uint64_t key[4] = {0};
×
UNCOV
628
  initCacheKey(key, pTableEntry, suid, pKey, keyLen);
×
629

630
  (void)taosThreadMutexLock(pLock);
×
631
  STagFilterResEntry** pEntry = taosHashGet(pTableEntry, &suid, sizeof(uint64_t));
×
632
  if (pEntry == NULL) {
×
633
    code = addNewEntry(pTableEntry, pKey, keyLen, suid);
×
634
    if (code != TSDB_CODE_SUCCESS) {
×
UNCOV
635
      goto _end;
×
636
    }
637
  } else {  // check if it exists or not
638
    code = taosHashPut((*pEntry)->set, pKey, keyLen, NULL, 0);
×
UNCOV
639
    if (code == TSDB_CODE_DUP_KEY) {
×
640
      // we have already found the existed items, no need to added to cache anymore.
641
      (void)taosThreadMutexUnlock(pLock);
×
UNCOV
642
      return TSDB_CODE_SUCCESS;
×
643
    }
644
    if (code != TSDB_CODE_SUCCESS) {
×
UNCOV
645
      goto _end;
×
646
    }
647
  }
648

649
  // add to cache.
UNCOV
650
  (void)taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeUidCachePayload, NULL, NULL,
×
651
                           TAOS_LRU_PRIORITY_LOW, NULL);
652
_end:
×
653
  (void)taosThreadMutexUnlock(pLock);
×
UNCOV
654
  metaDebug("vgId:%d, suid:%" PRIu64 " list cache added into cache, total:%d, tables:%d", vgId, suid,
×
655
            (int32_t)taosLRUCacheGetUsage(pCache), taosHashGetSize(pTableEntry));
656

UNCOV
657
  return code;
×
658
}
659

660
// remove the lru cache that are expired due to the tags value update, or creating, or dropping, of child tables
661
int32_t metaUidCacheClear(SMeta* pMeta, uint64_t suid) {
149,452✔
662
  uint64_t  p[4] = {0};
149,452✔
663
  int32_t   vgId = TD_VID(pMeta->pVnode);
149,452✔
664
  SHashObj* pEntryHashMap = pMeta->pCache->sTagFilterResCache.pTableEntry;
149,452✔
665

666
  uint64_t dummy[2] = {0};
149,452✔
667
  initCacheKey(p, pEntryHashMap, suid, (char*)&dummy[0], 16);
149,452✔
668

669
  TdThreadMutex* pLock = &pMeta->pCache->sTagFilterResCache.lock;
149,483✔
670
  (void)taosThreadMutexLock(pLock);
149,483✔
671

672
  STagFilterResEntry** pEntry = taosHashGet(pEntryHashMap, &suid, sizeof(uint64_t));
149,519✔
673
  if (pEntry == NULL || taosHashGetSize((*pEntry)->set) == 0) {
149,502!
674
    (void)taosThreadMutexUnlock(pLock);
149,502✔
675
    return TSDB_CODE_SUCCESS;
149,522✔
676
  }
677

UNCOV
678
  (*pEntry)->hitTimes = 0;
×
679

680
  char *iter = taosHashIterate((*pEntry)->set, NULL);
×
UNCOV
681
  while (iter != NULL) {
×
682
    setMD5DigestInKey(p, iter, 2 * sizeof(uint64_t));
683
    taosLRUCacheErase(pMeta->pCache->sTagFilterResCache.pUidResCache, p, TAG_FILTER_RES_KEY_LEN);
×
UNCOV
684
    iter = taosHashIterate((*pEntry)->set, iter);
×
685
  }
686
  taosHashClear((*pEntry)->set);
×
UNCOV
687
  (void)taosThreadMutexUnlock(pLock);
×
688

689
  metaDebug("vgId:%d suid:%" PRId64 " cached related tag filter uid list cleared", vgId, suid);
×
UNCOV
690
  return TSDB_CODE_SUCCESS;
×
691
}
692

693
int32_t metaGetCachedTbGroup(void* pVnode, tb_uid_t suid, const uint8_t* pKey, int32_t keyLen, SArray** pList) {
×
694
  SMeta*  pMeta = ((SVnode*)pVnode)->pMeta;
×
UNCOV
695
  int32_t vgId = TD_VID(pMeta->pVnode);
×
696

697
  // generate the composed key for LRU cache
698
  SLRUCache*     pCache = pMeta->pCache->STbGroupResCache.pResCache;
×
699
  SHashObj*      pTableMap = pMeta->pCache->STbGroupResCache.pTableEntry;
×
UNCOV
700
  TdThreadMutex* pLock = &pMeta->pCache->STbGroupResCache.lock;
×
701

UNCOV
702
  *pList = NULL;
×
703
  uint64_t key[4];
UNCOV
704
  initCacheKey(key, pTableMap, suid, (const char*)pKey, keyLen);
×
705

706
  (void)taosThreadMutexLock(pLock);
×
UNCOV
707
  pMeta->pCache->STbGroupResCache.accTimes += 1;
×
708

709
  LRUHandle* pHandle = taosLRUCacheLookup(pCache, key, TAG_FILTER_RES_KEY_LEN);
×
710
  if (pHandle == NULL) {
×
711
    (void)taosThreadMutexUnlock(pLock);
×
UNCOV
712
    return TSDB_CODE_SUCCESS;
×
713
  }
714

715
  STagFilterResEntry** pEntry = taosHashGet(pTableMap, &suid, sizeof(uint64_t));
×
716
  if (NULL == pEntry) {
×
717
    metaDebug("suid %" PRIu64 " not in tb group cache", suid);
×
UNCOV
718
    return TSDB_CODE_NOT_FOUND;
×
719
  }
720

UNCOV
721
  *pList = taosArrayDup(taosLRUCacheValue(pCache, pHandle), NULL);
×
722

UNCOV
723
  (*pEntry)->hitTimes += 1;
×
724

725
  uint32_t acc = pMeta->pCache->STbGroupResCache.accTimes;
×
726
  if ((*pEntry)->hitTimes % 5000 == 0 && (*pEntry)->hitTimes > 0) {
×
UNCOV
727
    metaInfo("vgId:%d tb group cache hit:%d, total acc:%d, rate:%.2f", vgId, (*pEntry)->hitTimes, acc,
×
728
             ((double)(*pEntry)->hitTimes) / acc);
729
  }
730

UNCOV
731
  bool ret = taosLRUCacheRelease(pCache, pHandle, false);
×
732

733
  // unlock meta
734
  (void)taosThreadMutexUnlock(pLock);
×
UNCOV
735
  return TSDB_CODE_SUCCESS;
×
736
}
737

UNCOV
738
static void freeTbGroupCachePayload(const void* key, size_t keyLen, void* value, void* ud) {
×
739
  (void)ud;
740
  if (value == NULL) {
×
UNCOV
741
    return;
×
742
  }
743

744
  const uint64_t* p = key;
×
745
  if (keyLen != sizeof(int64_t) * 4) {
×
746
    metaError("tb group key length is invalid, length:%d, expect:%d", (int32_t)keyLen, (int32_t)sizeof(uint64_t) * 2);
×
UNCOV
747
    return;
×
748
  }
749

UNCOV
750
  SHashObj* pHashObj = (SHashObj*)p[0];
×
751

UNCOV
752
  STagFilterResEntry** pEntry = taosHashGet(pHashObj, &p[1], sizeof(uint64_t));
×
753

754
  if (pEntry != NULL && (*pEntry) != NULL) {
×
755
    int64_t st = taosGetTimestampUs();
×
756
    int32_t code = taosHashRemove((*pEntry)->set, &p[2], sizeof(uint64_t) * 2);
×
757
    if (code == TSDB_CODE_SUCCESS) {
×
758
      double el = (taosGetTimestampUs() - st) / 1000.0;
×
UNCOV
759
      metaDebug("clear one item in tb group cache, remain cached item:%d, elapsed time:%.2fms",
×
760
                taosHashGetSize((*pEntry)->set), el);
761
    }
762
  }
763

UNCOV
764
  taosArrayDestroy((SArray*)value);
×
765
}
766

UNCOV
767
int32_t metaPutTbGroupToCache(void* pVnode, uint64_t suid, const void* pKey, int32_t keyLen, void* pPayload,
×
768
                              int32_t payloadLen) {
769
  int32_t code = 0;
×
770
  SMeta*  pMeta = ((SVnode*)pVnode)->pMeta;
×
UNCOV
771
  int32_t vgId = TD_VID(pMeta->pVnode);
×
772

773
  if (payloadLen > tsTagFilterResCacheSize) {
×
UNCOV
774
    metaDebug("vgId:%d, suid:%" PRIu64
×
775
              " ignore to add to tb group cache, due to payload length %d greater than threshold %d",
776
              vgId, suid, payloadLen, tsTagFilterResCacheSize);
777
    taosArrayDestroy((SArray*)pPayload);
×
UNCOV
778
    return TSDB_CODE_SUCCESS;
×
779
  }
780

781
  SLRUCache*     pCache = pMeta->pCache->STbGroupResCache.pResCache;
×
782
  SHashObj*      pTableEntry = pMeta->pCache->STbGroupResCache.pTableEntry;
×
UNCOV
783
  TdThreadMutex* pLock = &pMeta->pCache->STbGroupResCache.lock;
×
784

785
  uint64_t key[4] = {0};
×
UNCOV
786
  initCacheKey(key, pTableEntry, suid, pKey, keyLen);
×
787

788
  (void)taosThreadMutexLock(pLock);
×
789
  STagFilterResEntry** pEntry = taosHashGet(pTableEntry, &suid, sizeof(uint64_t));
×
790
  if (pEntry == NULL) {
×
791
    code = addNewEntry(pTableEntry, pKey, keyLen, suid);
×
792
    if (code != TSDB_CODE_SUCCESS) {
×
UNCOV
793
      goto _end;
×
794
    }
795
  } else {  // check if it exists or not
796
    code = taosHashPut((*pEntry)->set, pKey, keyLen, NULL, 0);
×
UNCOV
797
    if (code == TSDB_CODE_DUP_KEY) {
×
798
      // we have already found the existed items, no need to added to cache anymore.
799
      (void)taosThreadMutexUnlock(pLock);
×
UNCOV
800
      return TSDB_CODE_SUCCESS;
×
801
    }
802
    if (code != TSDB_CODE_SUCCESS) {
×
UNCOV
803
      goto _end;
×
804
    }
805
  }
806

807
  // add to cache.
UNCOV
808
  (void)taosLRUCacheInsert(pCache, key, TAG_FILTER_RES_KEY_LEN, pPayload, payloadLen, freeTbGroupCachePayload, NULL, NULL,
×
809
                           TAOS_LRU_PRIORITY_LOW, NULL);
810
_end:
×
811
  (void)taosThreadMutexUnlock(pLock);
×
UNCOV
812
  metaDebug("vgId:%d, suid:%" PRIu64 " tb group added into cache, total:%d, tables:%d", vgId, suid,
×
813
            (int32_t)taosLRUCacheGetUsage(pCache), taosHashGetSize(pTableEntry));
814

UNCOV
815
  return code;
×
816
}
817

818
// remove the lru cache that are expired due to the tags value update, or creating, or dropping, of child tables
819
int32_t metaTbGroupCacheClear(SMeta* pMeta, uint64_t suid) {
149,500✔
820
  uint64_t  p[4] = {0};
149,500✔
821
  int32_t   vgId = TD_VID(pMeta->pVnode);
149,500✔
822
  SHashObj* pEntryHashMap = pMeta->pCache->STbGroupResCache.pTableEntry;
149,500✔
823

824
  uint64_t dummy[2] = {0};
149,500✔
825
  initCacheKey(p, pEntryHashMap, suid, (char*)&dummy[0], 16);
149,500✔
826

827
  TdThreadMutex* pLock = &pMeta->pCache->STbGroupResCache.lock;
149,487✔
828
  (void)taosThreadMutexLock(pLock);
149,487✔
829

830
  STagFilterResEntry** pEntry = taosHashGet(pEntryHashMap, &suid, sizeof(uint64_t));
149,526✔
831
  if (pEntry == NULL || taosHashGetSize((*pEntry)->set) == 0) {
149,516!
832
    (void)taosThreadMutexUnlock(pLock);
149,516✔
833
    return TSDB_CODE_SUCCESS;
149,523✔
834
  }
835

UNCOV
836
  (*pEntry)->hitTimes = 0;
×
837

838
  char *iter = taosHashIterate((*pEntry)->set, NULL);
×
UNCOV
839
  while (iter != NULL) {
×
840
    setMD5DigestInKey(p, iter, 2 * sizeof(uint64_t));
841
    taosLRUCacheErase(pMeta->pCache->STbGroupResCache.pResCache, p, TAG_FILTER_RES_KEY_LEN);
×
UNCOV
842
    iter = taosHashIterate((*pEntry)->set, iter);
×
843
  }
844
  taosHashClear((*pEntry)->set);
×
UNCOV
845
  (void)taosThreadMutexUnlock(pLock);
×
846

847
  metaDebug("vgId:%d suid:%" PRId64 " cached related tb group cleared", vgId, suid);
×
UNCOV
848
  return TSDB_CODE_SUCCESS;
×
849
}
850

851
bool metaTbInFilterCache(SMeta* pMeta, const void* key, int8_t type) {
290,702✔
852
  if (type == 0 && taosHashGet(pMeta->pCache->STbFilterCache.pStb, key, sizeof(tb_uid_t))) {
290,702!
UNCOV
853
    return true;
×
854
  }
855

856
  if (type == 1 && taosHashGet(pMeta->pCache->STbFilterCache.pStbName, key, strlen(key))) {
290,702!
UNCOV
857
    return true;
×
858
  }
859

860
  return false;
290,720✔
861
}
862

863
int32_t metaPutTbToFilterCache(SMeta* pMeta, const void* key, int8_t type) {
×
864
  if (type == 0) {
×
UNCOV
865
    return taosHashPut(pMeta->pCache->STbFilterCache.pStb, key, sizeof(tb_uid_t), NULL, 0);
×
866
  }
867

868
  if (type == 1) {
×
UNCOV
869
    return taosHashPut(pMeta->pCache->STbFilterCache.pStbName, key, strlen(key), NULL, 0);
×
870
  }
871

UNCOV
872
  return 0;
×
873
}
874

875
int32_t metaSizeOfTbFilterCache(SMeta* pMeta, int8_t type) {
×
876
  if (type == 0) {
×
UNCOV
877
    return taosHashGetSize(pMeta->pCache->STbFilterCache.pStb);
×
878
  }
UNCOV
879
  return 0;
×
880
}
881

882
int32_t metaInitTbFilterCache(SMeta* pMeta) {
12,321✔
883
#ifdef TD_ENTERPRISE
884
  int32_t      tbNum = 0;
12,321✔
885
  const char** pTbArr = NULL;
12,321✔
886
  const char*  dbName = NULL;
12,321✔
887

888
  if (!(dbName = strchr(pMeta->pVnode->config.dbname, '.'))) return 0;
12,321!
889
  if (0 == strncmp(++dbName, "log", TSDB_DB_NAME_LEN)) {
12,321!
890
    tbNum = tkLogStbNum;
×
UNCOV
891
    pTbArr = (const char**)&tkLogStb;
×
892
  } else if (0 == strncmp(dbName, "audit", TSDB_DB_NAME_LEN)) {
12,321!
893
    tbNum = tkAuditStbNum;
×
UNCOV
894
    pTbArr = (const char**)&tkAuditStb;
×
895
  }
896
  if (tbNum && pTbArr) {
12,321!
897
    for (int32_t i = 0; i < tbNum; ++i) {
×
UNCOV
898
      TAOS_CHECK_RETURN(metaPutTbToFilterCache(pMeta, pTbArr[i], 1));
×
899
    }
900
  }
901
#else
902
#endif
903
  return 0;
12,321✔
904
}
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