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

taosdata / TDengine / #4874

04 Dec 2025 01:55AM UTC coverage: 64.623% (+0.07%) from 64.558%
#4874

push

travis-ci

guanshengliang
Merge branch '3.0' into cover/3.0

865 of 2219 new or added lines in 36 files covered. (38.98%)

6317 existing lines in 143 files now uncovered.

159543 of 246882 relevant lines covered (64.62%)

106415537.4 hits per line

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

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

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

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

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

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

95
  if ((code = dmStartWorker(pMgmt)) != 0) {
695,902✔
96
    return code;
×
97
  }
98

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

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

107
  pOutput->pMgmt = pMgmt;
695,902✔
108
  return 0;
695,902✔
109
}
110

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

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

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

130
  return mgmtFunc;
705,423✔
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