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

taosdata / TDengine / #4951

06 Feb 2026 07:29AM UTC coverage: 66.887% (+0.04%) from 66.849%
#4951

push

travis-ci

web-flow
merge: from main to 3.0 #34521

765 of 1081 new or added lines in 28 files covered. (70.77%)

6419 existing lines in 131 files now uncovered.

205810 of 307696 relevant lines covered (66.89%)

127232277.37 hits per line

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

97.22
/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; }
605✔
21

22
int32_t xndOpen(const SXnodeOpt *pOption, SXnode **pXnode) {
577,430✔
23
  *pXnode = &xnodeInstance;
577,430✔
24
  (*pXnode)->protocol = (int8_t)pOption->proto;
577,430✔
25
  (*pXnode)->dnodeId = pOption->dnodeId;
577,430✔
26
  (*pXnode)->clusterId = pOption->clusterId;
577,430✔
27
  (*pXnode)->ep = pOption->ep;
577,430✔
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");
577,430✔
45

46
  return TSDB_CODE_SUCCESS;
577,430✔
47
}
48

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

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

66
  if ((code = xnodeMgmtStartXnoded(pXnode)) != 0) {
605✔
67
    xndError("failed to start xnoded since %s", tstrerror(code));
185✔
68

69
    TAOS_RETURN(code);
185✔
70
  }
71
  return code;
420✔
72
}
73

74
void mndCloseXnd() { xnodeMgmtStopXnoded(); }
58,360✔
75

76
void getXnodedPipeName(char *pipeName, int32_t size) {
18,325✔
77
#ifdef _WIN32
78
  snprintf(pipeName, size, "%s.%x", XNODED_MGMT_LISTEN_PIPE_NAME_PREFIX, MurmurHash3_32(tsDataDir, strlen(tsDataDir)));
79
#else
80
  int32_t len = strlen(tsDataDir);
18,325✔
81
  if (len > 0 && tsDataDir[len - 1] != '/') {
18,325✔
82
    snprintf(pipeName, size, "%s/%s", tsDataDir, XNODED_MGMT_LISTEN_PIPE_NAME_PREFIX);
18,325✔
83
  } else {
NEW
84
    snprintf(pipeName, size, "%s%s", tsDataDir, XNODED_MGMT_LISTEN_PIPE_NAME_PREFIX);
×
85
  }
86
#endif
87
  xndDebug("xnode get unix socket pipe path:%s", pipeName);
18,325✔
88
}
18,325✔
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