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

taosdata / TDengine / #3780

31 Mar 2025 08:30AM UTC coverage: 11.99% (-22.0%) from 34.001%
#3780

push

travis-ci

happyguoxy
test:add case 2

40223 of 491333 branches covered (8.19%)

Branch coverage included in aggregate %.

70904 of 435487 relevant lines covered (16.28%)

1596.49 hits per line

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

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

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

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

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

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

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

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

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

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

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

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

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

121
  return mgmtFunc;
9✔
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