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

taosdata / TDengine / #3563

21 Dec 2024 05:37AM UTC coverage: 61.045% (+34.4%) from 26.655%
#3563

push

travis-ci

web-flow
Merge pull request #29256 from taosdata/merge/mainto3.0

merge: from main t 3.0

135730 of 287838 branches covered (47.15%)

Branch coverage included in aggregate %.

9 of 28 new or added lines in 5 files covered. (32.14%)

784 existing lines in 21 files now uncovered.

213302 of 283921 relevant lines covered (75.13%)

9176355.9 hits per line

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

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

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

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

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

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

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

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

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

98
  pOutput->pMgmt = pMgmt;
1,715✔
99
  return 0;
1,715✔
100
}
101

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

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

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

121
  return mgmtFunc;
1,719✔
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