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

taosdata / TDengine / #4706

01 Sep 2025 11:36AM UTC coverage: 59.087% (+0.2%) from 58.937%
#4706

push

travis-ci

web-flow
Merge pull request #32834 from taosdata/docs/wangxu/simplify-get-started

refactor: simplify get started

135606 of 291897 branches covered (46.46%)

Branch coverage included in aggregate %.

204421 of 283568 relevant lines covered (72.09%)

17573328.71 hits per line

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

179
static int32_t head_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
14,072✔
180
static int32_t data_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
14,072✔
181
static int32_t sma_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
14,072✔
182
static int32_t tomb_to_json(const STFile *file, cJSON *json) { return tfile_to_json(file, json); }
9,434✔
183
static int32_t stt_to_json(const STFile *file, cJSON *json) {
65,707✔
184
  TAOS_CHECK_RETURN(tfile_to_json(file, json));
65,707!
185

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

191
  return 0;
65,708✔
192
}
193

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

201
  const cJSON *item;
202

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

211
  return 0;
2,294✔
212
}
213

214
int32_t tsdbTFileToJson(const STFile *file, cJSON *json) {
117,357✔
215
  if (file->type == TSDB_FTYPE_STT) {
117,357✔
216
    return g_tfile_info[file->type].to_json(file, json);
65,708✔
217
  } else {
218
    cJSON *item = cJSON_AddObjectToObject(json, g_tfile_info[file->type].suffix);
51,649✔
219
    if (item == NULL) {
51,650!
220
      return TSDB_CODE_OUT_OF_MEMORY;
×
221
    }
222
    return g_tfile_info[file->type].to_json(file, item);
51,650✔
223
  }
224
}
225

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

229
  if (ftype == TSDB_FTYPE_STT) {
12,255✔
230
    TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(json, f));
2,294!
231
  } else {
232
    const cJSON *item = cJSON_GetObjectItem(json, g_tfile_info[ftype].suffix);
9,961✔
233
    if (cJSON_IsObject(item)) {
9,983✔
234
      TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(item, f));
2,186!
235
    } else {
236
      return TSDB_CODE_NOT_FOUND;
7,797✔
237
    }
238
  }
239

240
  return 0;
4,480✔
241
}
242

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

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

259
int32_t tsdbTFileObjRef(STFileObj *fobj) {
9,290,638✔
260
  int32_t nRef;
261
  (void)taosThreadMutexLock(&fobj->mutex);
9,290,638✔
262

263
  if (fobj->ref <= 0 || fobj->state != TSDB_FSTATE_LIVE) {
9,296,136!
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;
9,296,198✔
270
  (void)taosThreadMutexUnlock(&fobj->mutex);
9,296,198✔
271
  tsdbTrace("ref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
9,299,394✔
272
  return 0;
9,299,399✔
273
}
274

275
int32_t tsdbTFileObjUnref(STFileObj *fobj) {
9,512,838✔
276
  (void)taosThreadMutexLock(&fobj->mutex);
9,512,838✔
277
  int32_t nRef = --fobj->ref;
9,514,583✔
278
  (void)taosThreadMutexUnlock(&fobj->mutex);
9,514,583✔
279

280
  if (nRef < 0) {
9,515,111!
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);
9,515,111✔
286
  if (nRef == 0) {
9,515,111✔
287
    if (fobj->state == TSDB_FSTATE_DEAD) {
213,740✔
288
      tsdbRemoveFile(fobj->fname);
1,019✔
289
    }
290
    taosMemoryFree(fobj);
213,740!
291
  }
292

293
  return 0;
9,514,791✔
294
}
295

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

360
  if (pTfs) {
272,833!
361
    if (pVnode->mounted) {
272,833✔
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) {
272,793!
380
        snprintf(fname,                              //
272,789✔
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,                             //
272,795✔
389
                f->cid,                             //
272,795✔
390
                g_tfile_info[f->type].suffix);
272,795✔
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
}
272,829✔
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) {
82,439✔
497
  if (f1->type != f2->type) return false;
82,439!
498
  if (f1->did.level != f2->did.level) return false;
82,439✔
499
  if (f1->did.id != f2->did.id) return false;
82,282✔
500
  if (f1->fid != f2->fid) return false;
82,252!
501
  if (f1->cid != f2->cid) return false;
82,252✔
502
  if (f1->lcn != f2->lcn) return false;
80,175!
503
  if (f1->mid != f2->mid) return false;
80,175!
504
  return true;
80,175✔
505
}
506

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

513
int32_t tsdbTFileObjCmpr(const STFileObj **fobj1, const STFileObj **fobj2) {
20,105✔
514
  if (fobj1[0]->f->cid < fobj2[0]->f->cid) {
20,105✔
515
    return -1;
946✔
516
  } else if (fobj1[0]->f->cid > fobj2[0]->f->cid) {
19,159✔
517
    return 1;
6,574✔
518
  } else {
519
    return 0;
12,585✔
520
  }
521
}
522

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