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

taosdata / TDengine / #3798

31 Mar 2025 10:39AM UTC coverage: 9.424% (-20.9%) from 30.372%
#3798

push

travis-ci

happyguoxy
test:add test cases

21549 of 307601 branches covered (7.01%)

Branch coverage included in aggregate %.

36084 of 303967 relevant lines covered (11.87%)

58620.7 hits per line

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

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

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

50
static void dmStopMgmt(SDnodeMgmt *pMgmt) {
×
51
  pMgmt->pData->stopped = true;
×
52
  dmStopMonitorThread(pMgmt);
×
53
  dmStopAuditThread(pMgmt);
×
54
  dmStopStatusThread(pMgmt);
×
55
  dmStopConfigThread(pMgmt);
×
56
  dmStopStatusInfoThread(pMgmt);
×
57
#if defined(TD_ENTERPRISE)
58
  dmStopNotifyThread(pMgmt);
×
59
#endif
60
  dmStopCrashReportThread(pMgmt);
×
61
}
×
62

63
static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
×
64
  int32_t     code = 0;
×
65
  SDnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SDnodeMgmt));
×
66
  if (pMgmt == NULL) {
×
67
    return terrno;
×
68
  }
69

70
  pMgmt->pData = pInput->pData;
×
71
  pMgmt->msgCb = pInput->msgCb;
×
72
  pMgmt->pTfs = pInput->pTfs;
×
73
  pMgmt->path = pInput->path;
×
74
  pMgmt->name = pInput->name;
×
75
  pMgmt->processCreateNodeFp = pInput->processCreateNodeFp;
×
76
  pMgmt->processAlterNodeTypeFp = pInput->processAlterNodeTypeFp;
×
77
  pMgmt->processDropNodeFp = pInput->processDropNodeFp;
×
78
  pMgmt->sendMonitorReportFp = pInput->sendMonitorReportFp;
×
79
  pMgmt->monitorCleanExpiredSamplesFp = pInput->monitorCleanExpiredSamplesFp;
×
80
  pMgmt->sendAuditRecordsFp = pInput->sendAuditRecordFp;
×
81
  pMgmt->getVnodeLoadsFp = pInput->getVnodeLoadsFp;
×
82
  pMgmt->getVnodeLoadsLiteFp = pInput->getVnodeLoadsLiteFp;
×
83
  pMgmt->getMnodeLoadsFp = pInput->getMnodeLoadsFp;
×
84
  pMgmt->getQnodeLoadsFp = pInput->getQnodeLoadsFp;
×
85

86
  if ((code = dmStartWorker(pMgmt)) != 0) {
×
87
    return code;
×
88
  }
89

90
  if ((code = udfStartUdfd(pMgmt->pData->dnodeId)) != 0) {
×
91
    dError("failed to start taosudf since %s", tstrerror(code));
×
92
  }
93

94
  if ((code = taosAnalyticsInit()) != 0) {
×
95
    dError("failed to init analysis env since %s", tstrerror(code));
×
96
  }
97

98
  pOutput->pMgmt = pMgmt;
×
99
  return 0;
×
100
}
101

102
static void dmCloseMgmt(SDnodeMgmt *pMgmt) {
×
103
  dmStopWorker(pMgmt);
×
104
  taosMemoryFree(pMgmt);
×
105
}
×
106

107
static int32_t dmRequireMgmt(const SMgmtInputOpt *pInput, bool *required) {
×
108
  *required = true;
×
109
  return 0;
×
110
}
111

112
SMgmtFunc dmGetMgmtFunc() {
×
113
  SMgmtFunc mgmtFunc = {0};
×
114
  mgmtFunc.openFp = dmOpenMgmt;
×
115
  mgmtFunc.closeFp = (NodeCloseFp)dmCloseMgmt;
×
116
  mgmtFunc.startFp = (NodeStartFp)dmStartMgmt;
×
117
  mgmtFunc.stopFp = (NodeStopFp)dmStopMgmt;
×
118
  mgmtFunc.requiredFp = dmRequireMgmt;
×
119
  mgmtFunc.getHandlesFp = dmGetMsgHandles;
×
120

121
  return mgmtFunc;
×
122
}
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