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

taosdata / TDengine / #4678

18 Aug 2025 07:58AM UTC coverage: 60.031% (+0.3%) from 59.715%
#4678

push

travis-ci

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

137751 of 292075 branches covered (47.16%)

Branch coverage included in aggregate %.

208308 of 284395 relevant lines covered (73.25%)

20959061.42 hits per line

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

63.44
/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) {
18,209✔
46
  int32_t code = taosRemoveFile(fname);
18,209✔
47
  if (code) {
18,208!
48
    tsdbError("failed to remove file:%s, code:%d, error:%s", fname, code, tstrerror(code));
×
49
  } else {
50
    tsdbInfo("file:%s is removed", fname);
18,208!
51
  }
52
}
18,209✔
53

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

163
  /* minVer */
164
  file->minVer = VERSION_MAX;
6,067✔
165
  item = cJSON_GetObjectItem(json, "minVer");
6,067✔
166
  if (cJSON_IsNumber(item)) {
6,064!
167
    file->minVer = item->valuedouble;
6,066✔
168
  }
169

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

179
static int32_t head_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
21,481✔
180
static int32_t data_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
21,480✔
181
static int32_t sma_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
21,481✔
182
static int32_t tomb_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
12,585✔
183
static int32_t stt_to_json(const STFile *file, cJSON *json) {
88,662✔
184
  TAOS_CHECK_RETURN(tfile_to_json(file, json));
88,662!
185

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

191
  return 0;
88,668✔
192
}
193

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

201
  const cJSON *item;
202

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

211
  return 0;
2,751✔
212
}
213

214
int32_t tsdbTFileToJson(const STFile *file, cJSON *json) {
165,686✔
215
  if (file->type == TSDB_FTYPE_STT) {
165,686✔
216
    return g_tfile_info[file->type].to_json(file, json);
88,662✔
217
  } else {
218
    cJSON *item = cJSON_AddObjectToObject(json, g_tfile_info[file->type].suffix);
77,024✔
219
    if (item == NULL) {
77,025!
220
      return TSDB_CODE_OUT_OF_MEMORY;
×
221
    }
222
    return g_tfile_info[file->type].to_json(file, item);
77,025✔
223
  }
224
}
225

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

229
  if (ftype == TSDB_FTYPE_STT) {
14,856✔
230
    TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(json, f));
2,753!
231
  } else {
232
    const cJSON *item = cJSON_GetObjectItem(json, g_tfile_info[ftype].suffix);
12,103✔
233
    if (cJSON_IsObject(item)) {
12,141✔
234
      TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(item, f));
3,316!
235
    } else {
236
      return TSDB_CODE_NOT_FOUND;
8,826✔
237
    }
238
  }
239

240
  return 0;
6,066✔
241
}
242

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

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

259
int32_t tsdbTFileObjRef(STFileObj *fobj) {
18,391,855✔
260
  int32_t nRef;
261
  (void)taosThreadMutexLock(&fobj->mutex);
18,391,855✔
262

263
  if (fobj->ref <= 0 || fobj->state != TSDB_FSTATE_LIVE) {
18,406,067!
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;
18,406,299✔
270
  (void)taosThreadMutexUnlock(&fobj->mutex);
18,406,299✔
271
  tsdbTrace("ref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
18,411,412✔
272
  return 0;
18,411,377✔
273
}
274

275
int32_t tsdbTFileObjUnref(STFileObj *fobj) {
18,694,653✔
276
  (void)taosThreadMutexLock(&fobj->mutex);
18,694,653✔
277
  int32_t nRef = --fobj->ref;
18,698,478✔
278
  (void)taosThreadMutexUnlock(&fobj->mutex);
18,698,478✔
279

280
  if (nRef < 0) {
18,698,799!
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);
18,698,799✔
286
  if (nRef == 0) {
18,698,799✔
287
    if (fobj->state == TSDB_FSTATE_DEAD) {
282,739✔
288
      tsdbRemoveFile(fobj->fname);
1,715✔
289
    }
290
    taosMemoryFree(fobj);
282,739!
291
  }
292

293
  return 0;
18,697,421✔
294
}
295

296
static void tsdbTFileObjRemoveLC(STFileObj *fobj) {
16,494✔
297
  if (fobj->f->type != TSDB_FTYPE_DATA || fobj->f->lcn < 1) {
16,494!
298
    tsdbRemoveFile(fobj->fname);
16,494✔
299
    return;
16,494✔
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) {
18,089✔
319
  (void)taosThreadMutexLock(&fobj->mutex);
18,089✔
320
  if (fobj->state != TSDB_FSTATE_LIVE || fobj->ref <= 0) {
18,089!
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;
18,089✔
326
  int32_t nRef = --fobj->ref;
18,089✔
327
  (void)taosThreadMutexUnlock(&fobj->mutex);
18,089✔
328
  tsdbTrace("remove unref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
18,089✔
329
  if (nRef == 0) {
18,089✔
330
    tsdbTFileObjRemoveLC(fobj);
16,374✔
331
    taosMemoryFree(fobj);
16,374!
332
  }
333
  return 0;
18,089✔
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[]) {
352,997✔
357
  SVnode *pVnode = pTsdb->pVnode;
352,997✔
358
  STfs   *pTfs = TSDB_TFS(pTsdb->pVnode);
352,997✔
359

360
  if (pTfs) {
352,997!
361
    if (pVnode->mounted) {
353,008✔
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) {
352,968✔
380
        snprintf(fname,                              //
352,967✔
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,                             //
352,967✔
389
                f->cid,                             //
352,967✔
390
                g_tfile_info[f->type].suffix);
352,967✔
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,                             //
1✔
401
                f->cid,                             //
1✔
402
                f->mid,                             //
1✔
403
                g_tfile_info[f->type].suffix);
1✔
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
}
352,996✔
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) {
123,060✔
497
  if (f1->type != f2->type) return false;
123,060!
498
  if (f1->did.level != f2->did.level) return false;
123,060✔
499
  if (f1->did.id != f2->did.id) return false;
122,881✔
500
  if (f1->fid != f2->fid) return false;
122,836!
501
  if (f1->cid != f2->cid) return false;
122,836✔
502
  if (f1->lcn != f2->lcn) return false;
120,685!
503
  if (f1->mid != f2->mid) return false;
120,685!
504
  return true;
120,685✔
505
}
506

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

513
int32_t tsdbTFileObjCmpr(const STFileObj **fobj1, const STFileObj **fobj2) {
25,611✔
514
  if (fobj1[0]->f->cid < fobj2[0]->f->cid) {
25,611✔
515
    return -1;
1,279✔
516
  } else if (fobj1[0]->f->cid > fobj2[0]->f->cid) {
24,332✔
517
    return 1;
8,511✔
518
  } else {
519
    return 0;
15,821✔
520
  }
521
}
522

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