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

taosdata / TDengine / #3638

11 Mar 2025 12:59PM UTC coverage: 3.066% (-18.3%) from 21.409%
#3638

push

travis-ci

web-flow
Merge pull request #30118 from taosdata/wl30

udpate ci workflow

5914 of 287117 branches covered (2.06%)

Branch coverage included in aggregate %.

11588 of 283747 relevant lines covered (4.08%)

142.17 hits per line

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

0.0
/source/dnode/mgmt/mgmt_snode/src/smInt.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 "smInt.h"
18
#include "libs/function/function.h"
19
#include "libs/function/tudf.h"
20

21
static int32_t smRequire(const SMgmtInputOpt *pInput, bool *required) {
×
22
  return dmReadFile(pInput->path, pInput->name, required);
×
23
}
24

25
static void smInitOption(SSnodeMgmt *pMgmt, SSnodeOpt *pOption) { pOption->msgCb = pMgmt->msgCb; }
×
26

27
static void smClose(SSnodeMgmt *pMgmt) {
×
28
  if (pMgmt->pSnode != NULL) {
×
29
    smStopWorker(pMgmt);
×
30
    sndClose(pMgmt->pSnode);
×
31
    pMgmt->pSnode = NULL;
×
32
  }
33

34
  taosMemoryFree(pMgmt);
×
35
}
×
36
int32_t sndOpenWrapper(const char *path, SSnodeOpt *pOption, SSnode **pNode) {
×
37
  *pNode = sndOpen(path, pOption);
×
38
  if (*pNode == NULL) {
×
39
    return terrno;
×
40
  }
41
  return 0;
×
42
}
43
int32_t smOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
×
44
  int32_t     code = 0;
×
45
  SSnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SSnodeMgmt));
×
46
  if (pMgmt == NULL) {
×
47
    code = terrno;
×
48
    return code;
×
49
  }
50

51
  pMgmt->pData = pInput->pData;
×
52
  pMgmt->path = pInput->path;
×
53
  pMgmt->name = pInput->name;
×
54
  pMgmt->msgCb = pInput->msgCb;
×
55
  pMgmt->msgCb.mgmt = pMgmt;
×
56
  pMgmt->msgCb.putToQueueFp = (PutToQueueFp)smPutMsgToQueue;
×
57

58
  SSnodeOpt option = {0};
×
59
  smInitOption(pMgmt, &option);
×
60

61
  code = sndOpenWrapper(pMgmt->path, &option, &pMgmt->pSnode);
×
62
  if (code != 0) {
×
63
    dError("failed to open snode since %s", tstrerror(code));
×
64
    smClose(pMgmt);
×
65
    return code;
×
66
  }
67

68
  tmsgReportStartup("snode-impl", "initialized");
×
69

70
  if ((code = smStartWorker(pMgmt)) != 0) {
×
71
    dError("failed to start snode worker since %s", tstrerror(code));
×
72
    smClose(pMgmt);
×
73
    return code;
×
74
  }
75
  tmsgReportStartup("snode-worker", "initialized");
×
76

77
  if ((code = udfcOpen()) != 0) {
×
78
    dError("failed to open udfc in snode since:%s", tstrerror(code));
×
79
    smClose(pMgmt);
×
80
    return code;
×
81
  }
82

83
  pOutput->pMgmt = pMgmt;
×
84
  return 0;
×
85
}
86

87
static int32_t smStartSnodes(SSnodeMgmt *pMgmt) { return sndInit(pMgmt->pSnode); }
×
88

89
SMgmtFunc smGetMgmtFunc() {
×
90
  SMgmtFunc mgmtFunc = {0};
×
91
  mgmtFunc.openFp = smOpen;
×
92
  mgmtFunc.startFp = (NodeStartFp)smStartSnodes;
×
93
  mgmtFunc.closeFp = (NodeCloseFp)smClose;
×
94
  mgmtFunc.createFp = (NodeCreateFp)smProcessCreateReq;
×
95
  mgmtFunc.dropFp = (NodeDropFp)smProcessDropReq;
×
96
  mgmtFunc.requiredFp = smRequire;
×
97
  mgmtFunc.getHandlesFp = smGetMsgHandles;
×
98

99
  return mgmtFunc;
×
100
}
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