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

taosdata / TDengine / #4658

09 Aug 2025 02:19PM UTC coverage: 59.866% (-1.3%) from 61.2%
#4658

push

travis-ci

GitHub
fix(stream)[TD-37079]: force close the last window in fill_history (#32436)

137251 of 291849 branches covered (47.03%)

Branch coverage included in aggregate %.

207628 of 284239 relevant lines covered (73.05%)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

191
  return 0;
41,195✔
192
}
193

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

201
  const cJSON *item;
202

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

211
  return 0;
2,767✔
212
}
213

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

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

229
  if (ftype == TSDB_FTYPE_STT) {
13,687✔
230
    TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(json, f));
2,762!
231
  } else {
232
    const cJSON *item = cJSON_GetObjectItem(json, g_tfile_info[ftype].suffix);
10,925✔
233
    if (cJSON_IsObject(item)) {
10,944✔
234
      TAOS_CHECK_RETURN(g_tfile_info[ftype].from_json(item, f));
1,784!
235
    } else {
236
      return TSDB_CODE_NOT_FOUND;
9,157✔
237
    }
238
  }
239

240
  return 0;
4,550✔
241
}
242

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

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

259
int32_t tsdbTFileObjRef(STFileObj *fobj) {
2,857,376✔
260
  int32_t nRef;
261
  (void)taosThreadMutexLock(&fobj->mutex);
2,857,376✔
262

263
  if (fobj->ref <= 0 || fobj->state != TSDB_FSTATE_LIVE) {
2,861,505!
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;
2,861,761✔
270
  (void)taosThreadMutexUnlock(&fobj->mutex);
2,861,761✔
271
  tsdbTrace("ref file %s, fobj:%p ref:%d", fobj->fname, fobj, nRef);
2,862,998✔
272
  return 0;
2,863,140✔
273
}
274

275
int32_t tsdbTFileObjUnref(STFileObj *fobj) {
3,005,742✔
276
  (void)taosThreadMutexLock(&fobj->mutex);
3,005,742✔
277
  int32_t nRef = --fobj->ref;
3,006,579✔
278
  (void)taosThreadMutexUnlock(&fobj->mutex);
3,006,579✔
279

280
  if (nRef < 0) {
3,006,700!
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,006,700✔
286
  if (nRef == 0) {
3,006,700✔
287
    if (fobj->state == TSDB_FSTATE_DEAD) {
141,328✔
288
      tsdbRemoveFile(fobj->fname);
328✔
289
    }
290
    taosMemoryFree(fobj);
141,328!
291
  }
292

293
  return 0;
3,006,626✔
294
}
295

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

360
  if (pTfs) {
187,769!
361
    if (pVnode->mounted) {
187,778✔
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) {
187,738!
380
        snprintf(fname,                              //
187,739✔
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,                             //
187,738✔
389
                f->cid,                             //
187,738✔
390
                g_tfile_info[f->type].suffix);
187,738✔
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
}
187,770✔
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) {
37,426✔
497
  if (f1->type != f2->type) return false;
37,426!
498
  if (f1->did.level != f2->did.level) return false;
37,426✔
499
  if (f1->did.id != f2->did.id) return false;
37,273✔
500
  if (f1->fid != f2->fid) return false;
37,240!
501
  if (f1->cid != f2->cid) return false;
37,240✔
502
  if (f1->lcn != f2->lcn) return false;
35,523!
503
  if (f1->mid != f2->mid) return false;
35,523!
504
  return true;
35,523✔
505
}
506

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

513
int32_t tsdbTFileObjCmpr(const STFileObj **fobj1, const STFileObj **fobj2) {
14,917✔
514
  if (fobj1[0]->f->cid < fobj2[0]->f->cid) {
14,917✔
515
    return -1;
872✔
516
  } else if (fobj1[0]->f->cid > fobj2[0]->f->cid) {
14,045✔
517
    return 1;
4,772✔
518
  } else {
519
    return 0;
9,273✔
520
  }
521
}
522

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