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

taosdata / TDengine / #4680

21 Aug 2025 12:03PM UTC coverage: 59.87% (-0.2%) from 60.031%
#4680

push

travis-ci

web-flow
jdbc release 3.7.3 (#32682)

* chore(jdbc): update jdbc version

* docs(jdbc): release 3.7.3

137338 of 292193 branches covered (47.0%)

Branch coverage included in aggregate %.

207909 of 284466 relevant lines covered (73.09%)

4731310.74 hits per line

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

62.26
/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,907✔
46
  int32_t code = taosRemoveFile(fname);
10,907✔
47
  if (code) {
10,907!
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,907!
51
  }
52
}
10,907✔
53

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

191
  return 0;
38,278✔
192
}
193

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

201
  const cJSON *item;
202

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

211
  return 0;
2,464✔
212
}
213

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

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

229
  if (ftype == TSDB_FTYPE_STT) {
12,326✔
230
    TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(json, f));
2,464!
231
  } else {
232
    const cJSON *item = cJSON_GetObjectItem(json, g_tfile_info[ftype].suffix);
9,862✔
233
    if (cJSON_IsObject(item)) {
9,885✔
234
      TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(item, f));
1,968!
235
    } else {
236
      return TSDB_CODE_NOT_FOUND;
7,917✔
237
    }
238
  }
239

240
  return 0;
4,432✔
241
}
242

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

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

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

263
  if (fobj->ref <= 0 || fobj->state != TSDB_FSTATE_LIVE) {
3,128,989!
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,129,153✔
270
  (void)taosThreadMutexUnlock(&fobj->mutex);
3,129,153✔
271
  tsdbTrace("ref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
3,129,526✔
272
  return 0;
3,129,595✔
273
}
274

275
int32_t tsdbTFileObjUnref(STFileObj *fobj) {
3,269,398✔
276
  (void)taosThreadMutexLock(&fobj->mutex);
3,269,398✔
277
  int32_t nRef = --fobj->ref;
3,270,595✔
278
  (void)taosThreadMutexUnlock(&fobj->mutex);
3,270,595✔
279

280
  if (nRef < 0) {
3,270,748!
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,270,748✔
286
  if (nRef == 0) {
3,270,748✔
287
    if (fobj->state == TSDB_FSTATE_DEAD) {
136,628✔
288
      tsdbRemoveFile(fobj->fname);
456✔
289
    }
290
    taosMemoryFree(fobj);
136,628!
291
  }
292

293
  return 0;
3,270,757✔
294
}
295

296
static void tsdbTFileObjRemoveLC(STFileObj *fobj) {
10,451✔
297
  if (fobj->f->type != TSDB_FTYPE_DATA || fobj->f->lcn < 1) {
10,451!
298
    tsdbRemoveFile(fobj->fname);
10,451✔
299
    return;
10,451✔
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,777✔
319
  (void)taosThreadMutexLock(&fobj->mutex);
10,777✔
320
  if (fobj->state != TSDB_FSTATE_LIVE || fobj->ref <= 0) {
10,778!
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,778✔
326
  int32_t nRef = --fobj->ref;
10,778✔
327
  (void)taosThreadMutexUnlock(&fobj->mutex);
10,778✔
328
  tsdbTrace("remove unref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
10,778✔
329
  if (nRef == 0) {
10,778✔
330
    tsdbTFileObjRemoveLC(fobj);
10,322✔
331
    taosMemoryFree(fobj);
10,322!
332
  }
333
  return 0;
10,778✔
334
}
335

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

339
  if (fobj->state != TSDB_FSTATE_LIVE || fobj->ref <= 0) {
129!
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;
129✔
346
  int32_t nRef = --fobj->ref;
129✔
347
  (void)taosThreadMutexUnlock(&fobj->mutex);
129✔
348
  tsdbTrace("remove unref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
129!
349
  if (nRef == 0) {
129!
350
    tsdbTFileObjRemoveLC(fobj);
129✔
351
    taosMemoryFree(fobj);
129!
352
  }
353
  return 0;
129✔
354
}
355

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

360
  if (pTfs) {
181,603!
361
    if (pVnode->mounted) {
181,608✔
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) {
181,568!
380
        snprintf(fname,                              //
181,563✔
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,                             //
181,568✔
389
                f->cid,                             //
181,568✔
390
                g_tfile_info[f->type].suffix);
181,568✔
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,                             //
×
401
                f->cid,                             //
×
402
                f->mid,                             //
×
403
                g_tfile_info[f->type].suffix);
×
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
}
181,598✔
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) {
35,567✔
497
  if (f1->type != f2->type) return false;
35,567!
498
  if (f1->did.level != f2->did.level) return false;
35,567✔
499
  if (f1->did.id != f2->did.id) return false;
35,392✔
500
  if (f1->fid != f2->fid) return false;
35,368!
501
  if (f1->cid != f2->cid) return false;
35,368✔
502
  if (f1->lcn != f2->lcn) return false;
33,676!
503
  if (f1->mid != f2->mid) return false;
33,676!
504
  return true;
33,676✔
505
}
506

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

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

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