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

taosdata / TDengine / #4800

16 Oct 2025 09:19AM UTC coverage: 53.935% (-7.1%) from 61.083%
#4800

push

travis-ci

web-flow
Merge b32e3a393 into a190048d5

134724 of 323629 branches covered (41.63%)

Branch coverage included in aggregate %.

184803 of 268802 relevant lines covered (68.75%)

69058627.2 hits per line

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

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

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

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

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

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

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

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

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

107
  pOutput->pMgmt = pMgmt;
236,864✔
108
  return 0;
236,864✔
109
}
110

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

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

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

130
  return mgmtFunc;
237,006✔
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