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

taosdata / TDengine / #4986

15 Mar 2026 08:32AM UTC coverage: 37.305% (-31.3%) from 68.601%
#4986

push

travis-ci

tomchon
test: keep docs and unit test

125478 of 336361 relevant lines covered (37.3%)

1134847.06 hits per line

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

0.0
/source/dnode/vnode/src/inc/tsdbInt.h
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
#ifndef _TD_VNODE_TSDB_INT_H_
17
#define _TD_VNODE_TSDB_INT_H_
18

19
#include "../tsdb/tsdbDataFileRW.h"
20
#include "../tsdb/tsdbFS2.h"
21
#include "../tsdb/tsdbFSetRW.h"
22
#include "../tsdb/tsdbIter.h"
23
#include "../tsdb/tsdbSttFileRW.h"
24

25
typedef struct {
26
  STsdb      *tsdb;
27
  int32_t     szPage;
28
  int32_t     nodeId;  // node id of leader vnode in ss migration
29
  STimeWindow tw;
30

31
  // lastCommit time when the task is scheduled, we will compare it with the
32
  // fileset last commit time at the start of the task execution, if mismatch,
33
  // we know there are new commits after the task is scheduled.
34
  TSKEY   lastCommit;
35
  int64_t cid;
36

37
  STFileSet   *fset;
38
  TFileOpArray fopArr;
39
} SRTNer;
40

41
typedef struct {
42
  STsdb      *tsdb;
43
  STimeWindow tw;  // unit is second
44
  TSKEY       lastCommit;
45
  int32_t     nodeId;  // node id of leader vnode in ss migration
46
  int32_t     fid;
47
  int8_t      optrType;     // ETsdbOpType
48
  int8_t      triggerType;  // ETriggerType
49
  SVATaskID   taskid;
50
} SRtnArg;
51

52
typedef struct {
53
  STsdb  *tsdb;
54
  int32_t szPage;
55
  int32_t minRow;
56
  int32_t maxRow;
57
  int8_t  cmprAlg;
58
  int8_t  optrType;
59
  int64_t cid;
60
  int64_t compactVersion;
61

62
  STFileSet   *fset;
63
  TFileOpArray fopArr[1];
64

65
  struct {
66
    int32_t expLevel;
67
    // reader
68
    SDataFileReader    *dataReader;
69
    TSttFileReaderArray sttReaderArr[1];
70

71
    // iter & merger
72
    TTsdbIterArray dataIterArr[1];
73
    SIterMerger   *dataIterMerger;
74
    TTsdbIterArray tombIterArr[1];
75
    SIterMerger   *tombIterMerger;
76

77
    // writer
78
    SFSetWriter *writer;
79

80
    TABLEID tbid[1];
81
    SHashObj *pKeepHashObj;  // SHashObj<suid, keep>
82

83
    // skyline
84
    SArray  *aSkyLine;
85
    int32_t  iSkyLine;
86
    TSDBKEY *pDKey;
87
    TSDBKEY  dKey;
88
  } ctx[1];
89
} SCompactor2;
90

91
typedef struct {
92
  STsdb    *tsdb;
93
  int32_t   fid;
94
  ETsdbOpType type;
95
  bool        force;
96
  SVATaskID taskid;
97
} SCompactArg;
98

99
typedef struct {
100
  int32_t   fid;
101
  SVATaskID taskId;
102
  int64_t   fileSize;
103
} SRetentionState;
104

105
struct SRetentionMonitor {
106
  int64_t startTimeSec;  // start time of seconds
107
  TARRAY2(SRetentionState) stateArr;
108
  int64_t totalSize;
109
  int64_t finishedSize;
110
  int64_t lastUpdateFinishedSizeTime;
111
  int32_t totalTasks;
112
  int8_t  killed;
113
};
114

115
int32_t tsdbDoRollup(SRTNer *rtner);
116
int32_t tsdbDoSsMigrate(SRTNer *rtner);
117
void    tsdbRetentionCancel(void *arg);
118
int32_t tsdbRetention(void *arg);
119

120
FORCE_INLINE bool tsdbRetentionTaskKilled(STsdb *tsdb) { return atomic_load_8(&tsdb->pRetentionMonitor->killed) != 0; }
×
121

122
#ifdef __cplusplus
123
}
124
#endif
125

126
#endif /*_TSDB_VNODE_TSDB_INT_H_*/
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