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

taosdata / TDengine / #4925

12 Jan 2026 09:34AM UTC coverage: 66.107% (+0.8%) from 65.354%
#4925

push

travis-ci

web-flow
merge: from main to 3.0 branch #34248

103 of 129 new or added lines in 9 files covered. (79.84%)

891 existing lines in 139 files now uncovered.

200488 of 303278 relevant lines covered (66.11%)

129810096.48 hits per line

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

93.55
/source/dnode/xnode/src/xnode.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
#include "libs/txnode/txnode.h"
17
#include "xndInt.h"
18

19
static SXnode xnodeInstance = {0};
20
SXnode       *xndInstance() { return &xnodeInstance; }
123✔
21

22
int32_t xndOpen(const SXnodeOpt *pOption, SXnode **pXnode) {
556,166✔
23
  *pXnode = &xnodeInstance;
556,166✔
24
  (*pXnode)->protocol = (int8_t)pOption->proto;
556,166✔
25
  (*pXnode)->dnodeId = pOption->dnodeId;
556,166✔
26
  (*pXnode)->clusterId = pOption->clusterId;
556,166✔
27
  (*pXnode)->ep = pOption->ep;
556,166✔
28

29
  // if (TSDB_XNODE_OPT_PROTO == (*pXnode)->protocol) {
30
  //   // if ((code = xnodeMgmtStartXnoded((*pXnode)->dnodeId)) != 0) {
31
  //   if ((code = xnodeMgmtStartXnoded(*pXnode)) != 0) {
32
  //     xndError("failed to start xnoded since %s", tstrerror(code));
33

34
  //     taosMemoryFree(*pXnode);
35
  //     TAOS_RETURN(code);
36
  //   }
37
  // } else {
38
  //   xndError("Unknown xnode proto: %hhd.", (*pXnode)->protocol);
39

40
  //   taosMemoryFree(*pXnode);
41
  //   TAOS_RETURN(code);
42
  // }
43

44
  xndInfo("xnode: opened & initialized by dnode");
556,166✔
45

46
  return TSDB_CODE_SUCCESS;
556,166✔
47
}
48

49
void xndClose(SXnode *pXnode) {
556,166✔
50
  xndInfo("xnode: dnode is closing xnoded");
556,166✔
51
  xnodeMgmtStopXnoded();
556,166✔
52
}
556,166✔
53

54
int32_t mndOpenXnd(const SXnodeOpt *pOption) {
123✔
55
  int32_t code = 0;
123✔
56
  SXnode *pXnode = xndInstance();
123✔
57
  pXnode->dnodeId = pOption->dnodeId;
123✔
58
  pXnode->clusterId = pOption->clusterId;
123✔
59
  pXnode->upLen = pOption->upLen;
123✔
60
  pXnode->ep = pOption->ep;
123✔
61
  memset(pXnode->userPass, 0, XNODE_USER_PASS_LEN);
123✔
62
  memcpy(pXnode->userPass, pOption->userPass, pOption->upLen);
123✔
63

64
  if ((code = xnodeMgmtStartXnoded(pXnode)) != 0) {
123✔
UNCOV
65
    xndError("failed to start xnoded since %s", tstrerror(code));
×
66

UNCOV
67
    TAOS_RETURN(code);
×
68
  }
69
  return code;
123✔
70
}
71

72
void mndCloseXnd() { xnodeMgmtStopXnoded(); }
54,968✔
73

74
void getXnodedPipeName(char *pipeName, int32_t size) {
738✔
75
#ifdef _WIN32
76
  snprintf(pipeName, size, "%s.%x", XNODED_MGMT_LISTEN_PIPE_NAME_PREFIX, MurmurHash3_32(tsDataDir, strlen(tsDataDir)));
77
#else
78
  snprintf(pipeName, size, "%s%s", tsDataDir, XNODED_MGMT_LISTEN_PIPE_NAME_PREFIX);
738✔
79
#endif
80
  xndDebug("xnode get unix socket pipe path:%s", pipeName);
738✔
81
}
738✔
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