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

taosdata / TDengine / #4898

26 Dec 2025 09:58AM UTC coverage: 65.061% (-0.7%) from 65.717%
#4898

push

travis-ci

web-flow
feat: support encryption of configuration files, data files and metadata files (#33801)

350 of 1333 new or added lines in 31 files covered. (26.26%)

2796 existing lines in 159 files now uncovered.

184024 of 282850 relevant lines covered (65.06%)

113940470.33 hits per line

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

82.35
/source/dnode/mgmt/mgmt_dnode/src/dmInt.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
#define _DEFAULT_SOURCE
17
#include "dmInt.h"
18
#include "libs/function/tudf.h"
19
#include "tanalytics.h"
20

21
static int32_t dmStartMgmt(SDnodeMgmt *pMgmt) {
568,563✔
22
  int32_t code = 0;
568,563✔
23

24
#if defined(TD_ENTERPRISE) && defined(TD_HAS_TAOSK)
25
  // Verify encryption keys at startup
26
  if ((code = dmVerifyAndInitEncryptionKeys()) != 0) {
568,563✔
NEW
27
    dError("failed to verify encryption keys, since %s", tstrerror(code));
×
NEW
28
    return code;
×
29
  }
30
#endif
31

32
  if ((code = dmStartStatusThread(pMgmt)) != 0) {
568,563✔
33
    return code;
×
34
  }
35

36
  if ((code = dmStartConfigThread(pMgmt)) != 0) {
568,563✔
37
    return code;
×
38
  }
39

40
#if defined(TD_ENTERPRISE)
41
  if ((code = dmStartKeySyncThread(pMgmt)) != 0) {
568,563✔
NEW
42
    return code;
×
43
  }
44
#endif
45

46
  if ((code = dmStartStatusInfoThread(pMgmt)) != 0) {
568,563✔
47
    return code;
×
48
  }
49
#if defined(TD_ENTERPRISE)
50
  if ((code = dmStartNotifyThread(pMgmt)) != 0) {
568,563✔
51
    return code;
×
52
  }
53
#endif
54
  if ((code = dmStartMonitorThread(pMgmt)) != 0) {
568,563✔
55
    return code;
×
56
  }
57
  if ((code = dmStartAuditThread(pMgmt)) != 0) {
568,563✔
58
    return code;
×
59
  }
60
  if ((code = dmStartCrashReportThread(pMgmt)) != 0) {
568,563✔
61
    return code;
×
62
  }
63
  if ((code = dmStartMetricsThread(pMgmt)) != 0) {
568,563✔
64
    return code;
×
65
  }
66
  return 0;
568,563✔
67
}
68

69
static void dmStopMgmt(SDnodeMgmt *pMgmt) {
568,563✔
70
  pMgmt->pData->stopped = true;
568,563✔
71
  dmStopMonitorThread(pMgmt);
568,563✔
72
  dmStopAuditThread(pMgmt);
568,563✔
73
  dmStopStatusThread(pMgmt);
568,563✔
74
  dmStopConfigThread(pMgmt);
568,563✔
75
#if defined(TD_ENTERPRISE)
76
  dmStopKeySyncThread(pMgmt);
568,563✔
77
#endif
78
  dmStopStatusInfoThread(pMgmt);
568,563✔
79
#if defined(TD_ENTERPRISE)
80
  dmStopNotifyThread(pMgmt);
568,563✔
81
#endif
82
  dmStopCrashReportThread(pMgmt);
568,563✔
83
  dmStopMetricsThread(pMgmt);
568,563✔
84
}
568,563✔
85

86
static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
568,563✔
87
  int32_t     code = 0;
568,563✔
88
  SDnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SDnodeMgmt));
568,563✔
89
  if (pMgmt == NULL) {
568,563✔
90
    return terrno;
×
91
  }
92

93
  pMgmt->pData = pInput->pData;
568,563✔
94
  pMgmt->msgCb = pInput->msgCb;
568,563✔
95
  pMgmt->pTfs = pInput->pTfs;
568,563✔
96
  pMgmt->path = pInput->path;
568,563✔
97
  pMgmt->name = pInput->name;
568,563✔
98
  pMgmt->processCreateNodeFp = pInput->processCreateNodeFp;
568,563✔
99
  pMgmt->processAlterNodeFp = pInput->processAlterNodeFp;
568,563✔
100
  pMgmt->processAlterNodeTypeFp = pInput->processAlterNodeTypeFp;
568,563✔
101
  pMgmt->processDropNodeFp = pInput->processDropNodeFp;
568,563✔
102
  pMgmt->sendMonitorReportFp = pInput->sendMonitorReportFp;
568,563✔
103
  pMgmt->sendMetricsReportFp = pInput->sendMetricsReportFp;
568,563✔
104
  pMgmt->monitorCleanExpiredSamplesFp = pInput->monitorCleanExpiredSamplesFp;
568,563✔
105
  pMgmt->metricsCleanExpiredSamplesFp = pInput->metricsCleanExpiredSamplesFp;
568,563✔
106
  pMgmt->sendAuditRecordsFp = pInput->sendAuditRecordFp;
568,563✔
107
  pMgmt->getVnodeLoadsFp = pInput->getVnodeLoadsFp;
568,563✔
108
  pMgmt->getVnodeLoadsLiteFp = pInput->getVnodeLoadsLiteFp;
568,563✔
109
  pMgmt->getMnodeLoadsFp = pInput->getMnodeLoadsFp;
568,563✔
110
  pMgmt->getQnodeLoadsFp = pInput->getQnodeLoadsFp;
568,563✔
111
  pMgmt->setMnodeSyncTimeoutFp = pInput->setMnodeSyncTimeoutFp;
568,563✔
112
  pMgmt->setVnodeSyncTimeoutFp = pInput->setVnodeSyncTimeoutFp;
568,563✔
113

114
  if ((code = dmStartWorker(pMgmt)) != 0) {
568,563✔
115
    return code;
×
116
  }
117

118
  if ((code = udfStartUdfd(pMgmt->pData->dnodeId)) != 0) {
568,563✔
119
    dError("failed to start taosudf since %s", tstrerror(code));
×
120
  }
121

122
  if ((code = taosAnalyticsInit()) != 0) {
568,563✔
123
    dError("failed to init analysis env since %s", tstrerror(code));
×
124
  }
125

126
  pOutput->pMgmt = pMgmt;
568,563✔
127
  return 0;
568,563✔
128
}
129

130
static void dmCloseMgmt(SDnodeMgmt *pMgmt) {
568,563✔
131
  dmStopWorker(pMgmt);
568,563✔
132
  taosMemoryFree(pMgmt);
568,563✔
133
}
568,563✔
134

135
static int32_t dmRequireMgmt(const SMgmtInputOpt *pInput, bool *required) {
578,438✔
136
  *required = true;
578,438✔
137
  return 0;
578,438✔
138
}
139

140
SMgmtFunc dmGetMgmtFunc() {
578,438✔
141
  SMgmtFunc mgmtFunc = {0};
578,438✔
142
  mgmtFunc.openFp = dmOpenMgmt;
578,438✔
143
  mgmtFunc.closeFp = (NodeCloseFp)dmCloseMgmt;
578,438✔
144
  mgmtFunc.startFp = (NodeStartFp)dmStartMgmt;
578,438✔
145
  mgmtFunc.stopFp = (NodeStopFp)dmStopMgmt;
578,438✔
146
  mgmtFunc.requiredFp = dmRequireMgmt;
578,438✔
147
  mgmtFunc.getHandlesFp = dmGetMsgHandles;
578,438✔
148

149
  return mgmtFunc;
578,438✔
150
}
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