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

taosdata / TDengine / #4674

18 Aug 2025 07:58AM UTC coverage: 59.821% (+0.1%) from 59.715%
#4674

push

travis-ci

web-flow
test: update case desc (#32551)

136937 of 292075 branches covered (46.88%)

Branch coverage included in aggregate %.

207916 of 284395 relevant lines covered (73.11%)

4553289.94 hits per line

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

63.68
/source/dnode/vnode/src/tsdb/tsdbFile2.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 "tsdbFile2.h"
17
#include "vnd.h"
18

19
// to_json
20
static int32_t head_to_json(const STFile *file, cJSON *json);
21
static int32_t data_to_json(const STFile *file, cJSON *json);
22
static int32_t sma_to_json(const STFile *file, cJSON *json);
23
static int32_t tomb_to_json(const STFile *file, cJSON *json);
24
static int32_t stt_to_json(const STFile *file, cJSON *json);
25

26
// from_json
27
static int32_t head_from_json(const cJSON *json, STFile *file);
28
static int32_t data_from_json(const cJSON *json, STFile *file);
29
static int32_t sma_from_json(const cJSON *json, STFile *file);
30
static int32_t tomb_from_json(const cJSON *json, STFile *file);
31
static int32_t stt_from_json(const cJSON *json, STFile *file);
32

33
static const struct {
34
  const char *suffix;
35
  int32_t (*to_json)(const STFile *file, cJSON *json);
36
  int32_t (*from_json)(const cJSON *json, STFile *file);
37
} g_tfile_info[] = {
38
    [TSDB_FTYPE_HEAD] = {"head", head_to_json, head_from_json},
39
    [TSDB_FTYPE_DATA] = {"data", data_to_json, data_from_json},
40
    [TSDB_FTYPE_SMA] = {"sma", sma_to_json, sma_from_json},
41
    [TSDB_FTYPE_TOMB] = {"tomb", tomb_to_json, tomb_from_json},
42
    [TSDB_FTYPE_STT] = {"stt", stt_to_json, stt_from_json},
43
};
44

45
void tsdbRemoveFile(const char *fname) {
10,882✔
46
  int32_t code = taosRemoveFile(fname);
10,882✔
47
  if (code) {
10,882!
48
    tsdbError("failed to remove file:%s, code:%d, error:%s", fname, code, tstrerror(code));
×
49
  } else {
50
    tsdbInfo("file:%s is removed", fname);
10,882!
51
  }
52
}
10,882✔
53

54
static int32_t tfile_to_json(const STFile *file, cJSON *json) {
62,671✔
55
  /* did.level */
56
  if (cJSON_AddNumberToObject(json, "did.level", file->did.level) == NULL) {
62,671!
57
    return TSDB_CODE_OUT_OF_MEMORY;
×
58
  }
59

60
  /* did.id */
61
  if (cJSON_AddNumberToObject(json, "did.id", file->did.id) == NULL) {
62,674!
62
    return TSDB_CODE_OUT_OF_MEMORY;
×
63
  }
64

65
  /* lcn - last chunk number */
66
  if (cJSON_AddNumberToObject(json, "lcn", file->lcn) == NULL) {
62,677!
67
    return TSDB_CODE_OUT_OF_MEMORY;
×
68
  }
69

70
  /* fid */
71
  if (cJSON_AddNumberToObject(json, "fid", file->fid) == NULL) {
62,674!
72
    return TSDB_CODE_OUT_OF_MEMORY;
×
73
  }
74

75
  /* mid - migration id */
76
  if (cJSON_AddNumberToObject(json, "mid", file->mid) == NULL) {
62,670!
77
    return TSDB_CODE_OUT_OF_MEMORY;
×
78
  }
79

80
  /* cid */
81
  if (cJSON_AddNumberToObject(json, "cid", file->cid) == NULL) {
62,669!
82
    return TSDB_CODE_OUT_OF_MEMORY;
×
83
  }
84

85
  /* size */
86
  if (cJSON_AddNumberToObject(json, "size", file->size) == NULL) {
62,673!
87
    return TSDB_CODE_OUT_OF_MEMORY;
×
88
  }
89

90
  if (file->minVer <= file->maxVer) {
62,675✔
91
    /* minVer */
92
    if (cJSON_AddNumberToObject(json, "minVer", file->minVer) == NULL) {
62,674!
93
      return TSDB_CODE_OUT_OF_MEMORY;
×
94
    }
95

96
    /* maxVer */
97
    if (cJSON_AddNumberToObject(json, "maxVer", file->maxVer) == NULL) {
62,674!
98
      return TSDB_CODE_OUT_OF_MEMORY;
×
99
    }
100
  }
101
  return 0;
62,671✔
102
}
103

104
static int32_t tfile_from_json(const cJSON *json, STFile *file) {
4,590✔
105
  const cJSON *item;
106

107
  /* did.level */
108
  item = cJSON_GetObjectItem(json, "did.level");
4,590✔
109
  if (cJSON_IsNumber(item)) {
4,585!
110
    file->did.level = item->valuedouble;
4,589✔
111
  } else {
112
    return TSDB_CODE_FILE_CORRUPTED;
×
113
  }
114

115
  /* did.id */
116
  item = cJSON_GetObjectItem(json, "did.id");
4,589✔
117
  if (cJSON_IsNumber(item)) {
4,589!
118
    file->did.id = item->valuedouble;
4,590✔
119
  } else {
120
    return TSDB_CODE_FILE_CORRUPTED;
×
121
  }
122

123
  /* lcn */
124
  item = cJSON_GetObjectItem(json, "lcn");
4,590✔
125
  if (cJSON_IsNumber(item)) {
4,588!
126
    file->lcn = item->valuedouble;
4,587✔
127
  } else {
128
    // return TSDB_CODE_FILE_CORRUPTED;
129
  }
130

131
  /* fid */
132
  item = cJSON_GetObjectItem(json, "fid");
4,587✔
133
  if (cJSON_IsNumber(item)) {
4,589!
134
    file->fid = item->valuedouble;
4,589✔
135
  } else {
136
    return TSDB_CODE_FILE_CORRUPTED;
×
137
  }
138

139
  /* mid - migration id */
140
  item = cJSON_GetObjectItem(json, "mid");
4,589✔
141
  if (cJSON_IsNumber(item)) {
4,587!
142
    file->mid = item->valuedouble;
4,591✔
143
  } else {
144
    file->mid = 0;
×
145
  }
146

147
  /* cid */
148
  item = cJSON_GetObjectItem(json, "cid");
4,591✔
149
  if (cJSON_IsNumber(item)) {
4,590!
150
    file->cid = item->valuedouble;
4,589✔
151
  } else {
152
    return TSDB_CODE_FILE_CORRUPTED;
×
153
  }
154

155
  /* size */
156
  item = cJSON_GetObjectItem(json, "size");
4,589✔
157
  if (cJSON_IsNumber(item)) {
4,587!
158
    file->size = item->valuedouble;
4,589✔
159
  } else {
160
    return TSDB_CODE_FILE_CORRUPTED;
×
161
  }
162

163
  /* minVer */
164
  file->minVer = VERSION_MAX;
4,589✔
165
  item = cJSON_GetObjectItem(json, "minVer");
4,589✔
166
  if (cJSON_IsNumber(item)) {
4,586!
167
    file->minVer = item->valuedouble;
4,588✔
168
  }
169

170
  /* maxVer */
171
  file->maxVer = VERSION_MIN;
4,588✔
172
  item = cJSON_GetObjectItem(json, "maxVer");
4,588✔
173
  if (cJSON_IsNumber(item)) {
4,587!
174
    file->maxVer = item->valuedouble;
4,588✔
175
  }
176
  return 0;
4,588✔
177
}
178

179
static int32_t head_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
5,905✔
180
static int32_t data_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
5,904✔
181
static int32_t sma_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
5,905✔
182
static int32_t tomb_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
6,360✔
183
static int32_t stt_to_json(const STFile *file, cJSON *json) {
38,599✔
184
  TAOS_CHECK_RETURN(tfile_to_json(file, json));
38,599!
185

186
  /* lvl */
187
  if (cJSON_AddNumberToObject(json, "level", file->stt->level) == NULL) {
38,602!
188
    return TSDB_CODE_OUT_OF_MEMORY;
×
189
  }
190

191
  return 0;
38,603✔
192
}
193

194
static int32_t head_from_json(const cJSON *json, STFile *file) { return tfile_from_json(json, file); }
668✔
195
static int32_t data_from_json(const cJSON *json, STFile *file) { return tfile_from_json(json, file); }
668✔
196
static int32_t sma_from_json(const cJSON *json, STFile *file) { return tfile_from_json(json, file); }
668✔
197
static int32_t tomb_from_json(const cJSON *json, STFile *file) { return tfile_from_json(json, file); }
48✔
198
static int32_t stt_from_json(const cJSON *json, STFile *file) {
2,539✔
199
  TAOS_CHECK_RETURN(tfile_from_json(json, file));
2,539!
200

201
  const cJSON *item;
202

203
  /* lvl */
204
  item = cJSON_GetObjectItem(json, "level");
2,537✔
205
  if (cJSON_IsNumber(item)) {
2,538!
206
    file->stt->level = item->valuedouble;
2,537✔
207
  } else {
208
    return TSDB_CODE_FILE_CORRUPTED;
×
209
  }
210

211
  return 0;
2,537✔
212
}
213

214
int32_t tsdbTFileToJson(const STFile *file, cJSON *json) {
62,670✔
215
  if (file->type == TSDB_FTYPE_STT) {
62,670✔
216
    return g_tfile_info[file->type].to_json(file, json);
38,599✔
217
  } else {
218
    cJSON *item = cJSON_AddObjectToObject(json, g_tfile_info[file->type].suffix);
24,071✔
219
    if (item == NULL) {
24,072!
220
      return TSDB_CODE_OUT_OF_MEMORY;
×
221
    }
222
    return g_tfile_info[file->type].to_json(file, item);
24,072✔
223
  }
224
}
225

226
int32_t tsdbJsonToTFile(const cJSON *json, tsdb_ftype_t ftype, STFile *f) {
12,989✔
227
  f[0] = (STFile){.type = ftype};
12,989✔
228

229
  if (ftype == TSDB_FTYPE_STT) {
12,989✔
230
    TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(json, f));
2,539!
231
  } else {
232
    const cJSON *item = cJSON_GetObjectItem(json, g_tfile_info[ftype].suffix);
10,450✔
233
    if (cJSON_IsObject(item)) {
10,485✔
234
      TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(item, f));
2,052!
235
    } else {
236
      return TSDB_CODE_NOT_FOUND;
8,434✔
237
    }
238
  }
239

240
  return 0;
4,588✔
241
}
242

243
int32_t tsdbTFileObjInit(STsdb *pTsdb, const STFile *f, STFileObj **fobj) {
147,982✔
244
  fobj[0] = taosMemoryMalloc(sizeof(*fobj[0]));
147,982!
245
  if (!fobj[0]) {
147,997!
246
    return terrno;
×
247
  }
248

249
  (void)taosThreadMutexInit(&fobj[0]->mutex, NULL);
147,997✔
250
  fobj[0]->f[0] = f[0];
147,995✔
251
  fobj[0]->state = TSDB_FSTATE_LIVE;
147,995✔
252
  fobj[0]->ref = 1;
147,995✔
253
  tsdbTFileName(pTsdb, f, fobj[0]->fname);
147,995✔
254
  // fobj[0]->nlevel = tfsGetLevel(pTsdb->pVnode->pTfs);
255
  fobj[0]->nlevel = vnodeNodeId(pTsdb->pVnode);
147,991✔
256
  return 0;
147,994✔
257
}
258

259
int32_t tsdbTFileObjRef(STFileObj *fobj) {
3,359,557✔
260
  int32_t nRef;
261
  (void)taosThreadMutexLock(&fobj->mutex);
3,359,557✔
262

263
  if (fobj->ref <= 0 || fobj->state != TSDB_FSTATE_LIVE) {
3,364,326!
264
    tsdbError("file %s, fobj:%p ref:%d", fobj->fname, fobj, fobj->ref);
×
265
    (void)taosThreadMutexUnlock(&fobj->mutex);
×
266
    return TSDB_CODE_FAILED;
×
267
  }
268

269
  nRef = ++fobj->ref;
3,364,559✔
270
  (void)taosThreadMutexUnlock(&fobj->mutex);
3,364,559✔
271
  tsdbTrace("ref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
3,366,435✔
272
  return 0;
3,366,562✔
273
}
274

275
int32_t tsdbTFileObjUnref(STFileObj *fobj) {
3,504,931✔
276
  (void)taosThreadMutexLock(&fobj->mutex);
3,504,931✔
277
  int32_t nRef = --fobj->ref;
3,506,164✔
278
  (void)taosThreadMutexUnlock(&fobj->mutex);
3,506,164✔
279

280
  if (nRef < 0) {
3,506,274!
281
    tsdbError("file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
×
282
    return TSDB_CODE_FAILED;
×
283
  }
284

285
  tsdbTrace("unref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
3,506,274✔
286
  if (nRef == 0) {
3,506,274✔
287
    if (fobj->state == TSDB_FSTATE_DEAD) {
137,431✔
288
      tsdbRemoveFile(fobj->fname);
342✔
289
    }
290
    taosMemoryFree(fobj);
137,431!
291
  }
292

293
  return 0;
3,506,320✔
294
}
295

296
static void tsdbTFileObjRemoveLC(STFileObj *fobj) {
10,540✔
297
  if (fobj->f->type != TSDB_FTYPE_DATA || fobj->f->lcn < 1) {
10,540!
298
    tsdbRemoveFile(fobj->fname);
10,540✔
299
    return;
10,540✔
300
  }
301

302
#ifdef USE_SHARED_STORAGE
303
  // remove local last chunk file
304
  char lc_path[TSDB_FILENAME_LEN];
305
  tstrncpy(lc_path, fobj->fname, TSDB_FQDN_LEN);
×
306

307
  char *dot = strrchr(lc_path, '.');
×
308
  if (!dot) {
×
309
    tsdbError("unexpected path: %s", lc_path);
×
310
    return;
×
311
  }
312
  snprintf(dot + 1, TSDB_FQDN_LEN - (dot + 1 - lc_path), "%d.data", fobj->f->lcn);
×
313

314
  tsdbRemoveFile(lc_path);
×
315
#endif
316
}
317

318
int32_t tsdbTFileObjRemove(STFileObj *fobj) {
10,762✔
319
  (void)taosThreadMutexLock(&fobj->mutex);
10,762✔
320
  if (fobj->state != TSDB_FSTATE_LIVE || fobj->ref <= 0) {
10,762!
321
    tsdbError("file %s, fobj:%p ref:%d", fobj->fname, fobj, fobj->ref);
×
322
    (void)taosThreadMutexUnlock(&fobj->mutex);
×
323
    return TSDB_CODE_FAILED;
×
324
  }
325
  fobj->state = TSDB_FSTATE_DEAD;
10,762✔
326
  int32_t nRef = --fobj->ref;
10,762✔
327
  (void)taosThreadMutexUnlock(&fobj->mutex);
10,762✔
328
  tsdbTrace("remove unref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
10,762✔
329
  if (nRef == 0) {
10,762✔
330
    tsdbTFileObjRemoveLC(fobj);
10,420✔
331
    taosMemoryFree(fobj);
10,420!
332
  }
333
  return 0;
10,762✔
334
}
335

336
int32_t tsdbTFileObjRemoveUpdateLC(STFileObj *fobj) {
120✔
337
  (void)taosThreadMutexLock(&fobj->mutex);
120✔
338

339
  if (fobj->state != TSDB_FSTATE_LIVE || fobj->ref <= 0) {
120!
340
    (void)taosThreadMutexUnlock(&fobj->mutex);
×
341
    tsdbError("file %s, fobj:%p ref:%d", fobj->fname, fobj, fobj->ref);
×
342
    return TSDB_CODE_FAILED;
×
343
  }
344

345
  fobj->state = TSDB_FSTATE_DEAD;
120✔
346
  int32_t nRef = --fobj->ref;
120✔
347
  (void)taosThreadMutexUnlock(&fobj->mutex);
120✔
348
  tsdbTrace("remove unref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
120!
349
  if (nRef == 0) {
120!
350
    tsdbTFileObjRemoveLC(fobj);
120✔
351
    taosMemoryFree(fobj);
120!
352
  }
353
  return 0;
120✔
354
}
355

356
void tsdbTFileName(STsdb *pTsdb, const STFile *f, char fname[]) {
182,672✔
357
  SVnode *pVnode = pTsdb->pVnode;
182,672✔
358
  STfs   *pTfs = TSDB_TFS(pTsdb->pVnode);
182,672✔
359

360
  if (pTfs) {
182,672!
361
    if (pVnode->mounted) {
182,679✔
362
      // NOTE: the case 'if (f->mid != 0)' is not handled at present, this may be
363
      //       needed in the future.
364
      snprintf(fname,                                              //
80✔
365
               TSDB_FILENAME_LEN,                                  //
366
               "%s%svnode%svnode%d%s%s%sv%df%dver%" PRId64 ".%s",  //
367
               tfsGetDiskPath(pTfs, f->did),                       //
368
               TD_DIRSEP,                                          //
369
               TD_DIRSEP,                                          //
370
               TSDB_VID(pVnode),                                   //
40✔
371
               TD_DIRSEP,                                          //
372
               pTsdb->name,                                        //
40!
373
               TD_DIRSEP,                                          //
374
               TSDB_VID(pVnode),                                   //
40✔
375
               f->fid,                                             //
40✔
376
               f->cid,                                             //
40✔
377
               g_tfile_info[f->type].suffix);
40!
378
    } else {
379
      if (f->mid == 0) {
182,639✔
380
        snprintf(fname,                              //
182,635✔
381
                TSDB_FILENAME_LEN,                  //
382
                "%s%s%s%sv%df%dver%" PRId64 ".%s",  //
383
                tfsGetDiskPath(pTfs, f->did),       //
384
                TD_DIRSEP,                          //
385
                pTsdb->path,                        //
386
                TD_DIRSEP,                          //
387
                TD_VID(pVnode),                     //
388
                f->fid,                             //
182,637✔
389
                f->cid,                             //
182,637✔
390
                g_tfile_info[f->type].suffix);
182,637✔
391
      } else {
392
        snprintf(fname,                          //
×
393
                TSDB_FILENAME_LEN,                  //
394
                "%s%s%s%sv%df%dver%" PRId64 ".m%d.%s",  //
395
                tfsGetDiskPath(pTfs, f->did),       //
396
                TD_DIRSEP,                          //
397
                pTsdb->path,                        //
398
                TD_DIRSEP,                          //
399
                TD_VID(pVnode),                     //
400
                f->fid,                             //
2✔
401
                f->cid,                             //
2✔
402
                f->mid,                             //
2✔
403
                g_tfile_info[f->type].suffix);
2✔
404
      }
405
    }
406
  } else {
407
     if (f->mid == 0) {
×
408
      snprintf(fname,                          //
×
409
              TSDB_FILENAME_LEN,              //
410
              "%s%sv%df%dver%" PRId64 ".%s",  //
411
              pTsdb->path,                    //
412
              TD_DIRSEP,                      //
413
              TD_VID(pVnode),                 //
414
              f->fid,                         //
×
415
              f->cid,                         //
×
416
              g_tfile_info[f->type].suffix);
×
417
    } else {
418
      snprintf(fname,                          //
×
419
              TSDB_FILENAME_LEN,              //
420
              "%s%sv%df%dver%" PRId64 ".m%d.%s",  //
421
              pTsdb->path,                    //
422
              TD_DIRSEP,                      //
423
              TD_VID(pVnode),                 //
424
              f->fid,                         //
×
425
              f->cid,                         //
×
426
              f->mid,                         //
×
427
              g_tfile_info[f->type].suffix);
×
428
    }
429
  }
430
}
182,668✔
431

432
void tsdbTFileLastChunkName(STsdb *pTsdb, const STFile *f, char fname[]) {
×
433
  SVnode *pVnode = pTsdb->pVnode;
×
434
  STfs   *pTfs = TSDB_TFS(pTsdb->pVnode);
×
435

436
  // NOTE: the case 'if (pVnode->mounted)' is not handled at present, this may be needed
437
  //       in the future.
438

439
  if (f->mid == 0) {
×
440
    if (pTfs) {
×
441
      snprintf(fname,                                 //
×
442
              TSDB_FILENAME_LEN,                     //
443
              "%s%s%s%sv%df%dver%" PRId64 ".%d.%s",  //
444
              tfsGetDiskPath(pTfs, f->did),          //
445
              TD_DIRSEP,                             //
446
              pTsdb->path,                           //
447
              TD_DIRSEP,                             //
448
              TD_VID(pVnode),                        //
449
              f->fid,                                //
×
450
              f->cid,                                //
×
451
              f->lcn,                                //
×
452
              g_tfile_info[f->type].suffix);
×
453
    } else {
454
      snprintf(fname,                             //
×
455
              TSDB_FILENAME_LEN,                 //
456
              "%s%sv%df%dver%" PRId64 ".%d.%s",  //
457
              pTsdb->path,                       //
458
              TD_DIRSEP,                         //
459
              TD_VID(pVnode),                    //
460
              f->fid,                            //
×
461
              f->cid,                            //
×
462
              f->lcn,                            //
×
463
              g_tfile_info[f->type].suffix);
×
464
    }
465
  } else {
466
    if (pTfs) {
×
467
      snprintf(fname,                                 //
×
468
              TSDB_FILENAME_LEN,                     //
469
              "%s%s%s%sv%df%dver%" PRId64 ".m%d.%d.%s",  //
470
              tfsGetDiskPath(pTfs, f->did),          //
471
              TD_DIRSEP,                             //
472
              pTsdb->path,                           //
473
              TD_DIRSEP,                             //
474
              TD_VID(pVnode),                        //
475
              f->fid,                                //
×
476
              f->cid,                                //
×
477
              f->mid,                                //
×
478
              f->lcn,                                //
×
479
              g_tfile_info[f->type].suffix);
×
480
    } else {
481
      snprintf(fname,                             //
×
482
              TSDB_FILENAME_LEN,                 //
483
              "%s%sv%df%dver%" PRId64 ".m%d.%d.%s",  //
484
              pTsdb->path,                       //
485
              TD_DIRSEP,                         //
486
              TD_VID(pVnode),                    //
487
              f->fid,                            //
×
488
              f->cid,                            //
×
489
              f->mid,                            //
×
490
              f->lcn,                            //
×
491
              g_tfile_info[f->type].suffix);
×
492
    }
493
  }
494
}
×
495

496
bool tsdbIsSameTFile(const STFile *f1, const STFile *f2) {
36,023✔
497
  if (f1->type != f2->type) return false;
36,023!
498
  if (f1->did.level != f2->did.level) return false;
36,023✔
499
  if (f1->did.id != f2->did.id) return false;
35,844✔
500
  if (f1->fid != f2->fid) return false;
35,799!
501
  if (f1->cid != f2->cid) return false;
35,799✔
502
  if (f1->lcn != f2->lcn) return false;
34,142!
503
  if (f1->mid != f2->mid) return false;
34,142!
504
  return true;
34,142✔
505
}
506

507
bool tsdbIsTFileChanged(const STFile *f1, const STFile *f2) {
34,142✔
508
  if (f1->size != f2->size) return true;
34,142✔
509
  // if (f1->type == TSDB_FTYPE_STT && f1->stt->nseg != f2->stt->nseg) return true;
510
  return false;
32,692✔
511
}
512

513
int32_t tsdbTFileObjCmpr(const STFileObj **fobj1, const STFileObj **fobj2) {
14,615✔
514
  if (fobj1[0]->f->cid < fobj2[0]->f->cid) {
14,615✔
515
    return -1;
942✔
516
  } else if (fobj1[0]->f->cid > fobj2[0]->f->cid) {
13,673✔
517
    return 1;
4,685✔
518
  } else {
519
    return 0;
8,988✔
520
  }
521
}
522

523
const char *tsdbFTypeLabel(tsdb_ftype_t ftype) { return g_tfile_info[ftype].suffix; }
32,462✔
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