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

taosdata / TDengine / #4788

14 Oct 2025 11:21AM UTC coverage: 60.992% (-2.3%) from 63.264%
#4788

push

travis-ci

web-flow
Merge 7ca9b50f9 into 19574fe21

154868 of 324306 branches covered (47.75%)

Branch coverage included in aggregate %.

207304 of 269498 relevant lines covered (76.92%)

125773493.22 hits per line

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

77.31
/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) {
746,250✔
22
  int32_t code = 0;
746,250✔
23
  if ((code = dmStartStatusThread(pMgmt)) != 0) {
746,250!
24
    return code;
×
25
  }
26

27
  if ((code = dmStartConfigThread(pMgmt)) != 0) {
746,250!
28
    return code;
×
29
  }
30
  if ((code = dmStartStatusInfoThread(pMgmt)) != 0) {
746,250!
31
    return code;
×
32
  }
33
#if defined(TD_ENTERPRISE)
34
  if ((code = dmStartNotifyThread(pMgmt)) != 0) {
746,250!
35
    return code;
×
36
  }
37
#endif
38
  if ((code = dmStartMonitorThread(pMgmt)) != 0) {
746,250!
39
    return code;
×
40
  }
41
  if ((code = dmStartAuditThread(pMgmt)) != 0) {
746,250!
42
    return code;
×
43
  }
44
  if ((code = dmStartCrashReportThread(pMgmt)) != 0) {
746,250!
45
    return code;
×
46
  }
47
  if ((code = dmStartMetricsThread(pMgmt)) != 0) {
746,250!
48
    return code;
×
49
  }
50
  return 0;
746,250✔
51
}
52

53
static void dmStopMgmt(SDnodeMgmt *pMgmt) {
746,250✔
54
  pMgmt->pData->stopped = true;
746,250✔
55
  dmStopMonitorThread(pMgmt);
746,250✔
56
  dmStopAuditThread(pMgmt);
746,250✔
57
  dmStopStatusThread(pMgmt);
746,250✔
58
  dmStopConfigThread(pMgmt);
746,250✔
59
  dmStopStatusInfoThread(pMgmt);
746,250✔
60
#if defined(TD_ENTERPRISE)
61
  dmStopNotifyThread(pMgmt);
746,250✔
62
#endif
63
  dmStopCrashReportThread(pMgmt);
746,250✔
64
  dmStopMetricsThread(pMgmt);
746,250✔
65
}
746,250✔
66

67
static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
746,250✔
68
  int32_t     code = 0;
746,250✔
69
  SDnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SDnodeMgmt));
746,250!
70
  if (pMgmt == NULL) {
746,250!
71
    return terrno;
×
72
  }
73

74
  pMgmt->pData = pInput->pData;
746,250✔
75
  pMgmt->msgCb = pInput->msgCb;
746,250✔
76
  pMgmt->pTfs = pInput->pTfs;
746,250✔
77
  pMgmt->path = pInput->path;
746,250✔
78
  pMgmt->name = pInput->name;
746,250✔
79
  pMgmt->processCreateNodeFp = pInput->processCreateNodeFp;
746,250✔
80
  pMgmt->processAlterNodeFp = pInput->processAlterNodeFp;
746,250✔
81
  pMgmt->processAlterNodeTypeFp = pInput->processAlterNodeTypeFp;
746,250✔
82
  pMgmt->processDropNodeFp = pInput->processDropNodeFp;
746,250✔
83
  pMgmt->sendMonitorReportFp = pInput->sendMonitorReportFp;
746,250✔
84
  pMgmt->sendMetricsReportFp = pInput->sendMetricsReportFp;
746,250✔
85
  pMgmt->monitorCleanExpiredSamplesFp = pInput->monitorCleanExpiredSamplesFp;
746,250✔
86
  pMgmt->metricsCleanExpiredSamplesFp = pInput->metricsCleanExpiredSamplesFp;
746,250✔
87
  pMgmt->sendAuditRecordsFp = pInput->sendAuditRecordFp;
746,250✔
88
  pMgmt->getVnodeLoadsFp = pInput->getVnodeLoadsFp;
746,250✔
89
  pMgmt->getVnodeLoadsLiteFp = pInput->getVnodeLoadsLiteFp;
746,250✔
90
  pMgmt->getMnodeLoadsFp = pInput->getMnodeLoadsFp;
746,250✔
91
  pMgmt->getQnodeLoadsFp = pInput->getQnodeLoadsFp;
746,250✔
92
  pMgmt->setMnodeSyncTimeoutFp = pInput->setMnodeSyncTimeoutFp;
746,250✔
93
  pMgmt->setVnodeSyncTimeoutFp = pInput->setVnodeSyncTimeoutFp;
746,250✔
94

95
  if ((code = dmStartWorker(pMgmt)) != 0) {
746,250!
96
    return code;
×
97
  }
98

99
  if ((code = udfStartUdfd(pMgmt->pData->dnodeId)) != 0) {
746,250✔
100
    dError("failed to start taosudf since %s", tstrerror(code));
72!
101
  }
102

103
  if ((code = taosAnalyticsInit()) != 0) {
746,250!
104
    dError("failed to init analysis env since %s", tstrerror(code));
×
105
  }
106

107
  pOutput->pMgmt = pMgmt;
746,250✔
108
  return 0;
746,250✔
109
}
110

111
static void dmCloseMgmt(SDnodeMgmt *pMgmt) {
746,250✔
112
  dmStopWorker(pMgmt);
746,250✔
113
  taosMemoryFree(pMgmt);
746,250!
114
}
746,250✔
115

116
static int32_t dmRequireMgmt(const SMgmtInputOpt *pInput, bool *required) {
747,009✔
117
  *required = true;
747,009✔
118
  return 0;
747,009✔
119
}
120

121
SMgmtFunc dmGetMgmtFunc() {
747,009✔
122
  SMgmtFunc mgmtFunc = {0};
747,009✔
123
  mgmtFunc.openFp = dmOpenMgmt;
747,009✔
124
  mgmtFunc.closeFp = (NodeCloseFp)dmCloseMgmt;
747,009✔
125
  mgmtFunc.startFp = (NodeStartFp)dmStartMgmt;
747,009✔
126
  mgmtFunc.stopFp = (NodeStopFp)dmStopMgmt;
747,009✔
127
  mgmtFunc.requiredFp = dmRequireMgmt;
747,009✔
128
  mgmtFunc.getHandlesFp = dmGetMsgHandles;
747,009✔
129

130
  return mgmtFunc;
747,009✔
131
}
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