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

taosdata / TDengine / #4404

30 Jun 2025 02:45AM UTC coverage: 62.241% (-0.4%) from 62.635%
#4404

push

travis-ci

web-flow
Merge pull request #31480 from taosdata/docs/3.0/TD-34215

add stmt2 docs

153837 of 315978 branches covered (48.69%)

Branch coverage included in aggregate %.

238272 of 314005 relevant lines covered (75.88%)

6134648.6 hits per line

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

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

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

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

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

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

92
  if ((code = dmStartWorker(pMgmt)) != 0) {
2,666!
93
    return code;
×
94
  }
95

96
  if ((code = udfStartUdfd(pMgmt->pData->dnodeId)) != 0) {
2,666✔
97
    dError("failed to start taosudf since %s", tstrerror(code));
8!
98
  }
99

100
  if ((code = taosAnalyticsInit()) != 0) {
2,666!
101
    dError("failed to init analysis env since %s", tstrerror(code));
×
102
  }
103

104
  pOutput->pMgmt = pMgmt;
2,666✔
105
  return 0;
2,666✔
106
}
107

108
static void dmCloseMgmt(SDnodeMgmt *pMgmt) {
2,666✔
109
  dmStopWorker(pMgmt);
2,666✔
110
  taosMemoryFree(pMgmt);
2,666!
111
}
2,666✔
112

113
static int32_t dmRequireMgmt(const SMgmtInputOpt *pInput, bool *required) {
2,675✔
114
  *required = true;
2,675✔
115
  return 0;
2,675✔
116
}
117

118
SMgmtFunc dmGetMgmtFunc() {
2,675✔
119
  SMgmtFunc mgmtFunc = {0};
2,675✔
120
  mgmtFunc.openFp = dmOpenMgmt;
2,675✔
121
  mgmtFunc.closeFp = (NodeCloseFp)dmCloseMgmt;
2,675✔
122
  mgmtFunc.startFp = (NodeStartFp)dmStartMgmt;
2,675✔
123
  mgmtFunc.stopFp = (NodeStopFp)dmStopMgmt;
2,675✔
124
  mgmtFunc.requiredFp = dmRequireMgmt;
2,675✔
125
  mgmtFunc.getHandlesFp = dmGetMsgHandles;
2,675✔
126

127
  return mgmtFunc;
2,675✔
128
}
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