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

taosdata / TDengine / #5071

17 May 2026 01:15AM UTC coverage: 63.054% (-10.3%) from 73.326%
#5071

push

travis-ci

web-flow
feat (TDgpt): Dynamic Model Synchronization Enhancements (#35344)

* refactor: do some internal refactor.

* fix: fix multiprocess sync issue.

* feat: add dynamic anomaly detection and forecasting services

* fix: log error message for undeploying model in exception handling

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: handle undeploy when model exists only on disk

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/286aafa0-c3ce-4c27-b803-2707571e9dc1

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* fix: guard dynamic registry concurrent access

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/5e4db858-6458-40f4-ac28-d1b1b7f97c18

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* fix: tighten service list locking scope

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/5e4db858-6458-40f4-ac28-d1b1b7f97c18

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* fix: restore prophet support and update tests per review feedback

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/92298ae1-7da6-4d07-b20e-101c7cd0b26b

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* fix: improve test name and move copy inside lock scope

Agent-Logs-Url: https://github.com/taosdata/TDengine/sessions/92298ae1-7da6-4d07-b20e-101c7cd0b26b

Co-authored-by: hjxilinx <8252296+hjxilinx@users.noreply.github.com>

* Potential fix for pull request finding

Co-au... (continued)

238317 of 377957 relevant lines covered (63.05%)

130539817.12 hits per line

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

33.33
/tools/shell/src/shellUtil.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 _BSD_SOURCE
17
#define _GNU_SOURCE
18
#define _XOPEN_SOURCE
19
#define _DEFAULT_SOURCE
20

21
#include "shellInt.h"
22

23
bool shellRegexMatch(const char *s, const char *reg, int32_t cflags) {
780,460,419✔
24
  regex_t regex = {0};
780,460,419✔
25
  char    msgbuf[100] = {0};
780,460,419✔
26

27
  /* Compile regular expression */
28
  if (regcomp(&regex, reg, cflags) != 0) {
780,460,419✔
29
    fprintf(stderr, "Fail to compile regex");
×
30
    shellExit();
×
31
  }
32

33
  /* Execute regular expression */
34
  int32_t reti = regexec(&regex, s, 0, NULL, 0);
780,460,419✔
35
  if (!reti) {
780,460,419✔
36
    regfree(&regex);
120,226✔
37
    return true;
120,226✔
38
  } else if (reti == REG_NOMATCH) {
780,340,193✔
39
    regfree(&regex);
780,340,193✔
40
    return false;
780,340,193✔
41
  } else {
42
    regerror(reti, &regex, msgbuf, sizeof(msgbuf));
×
43
    fprintf(stderr, "Regex match failed: %s\r\n", msgbuf);
×
44
    regfree(&regex);
×
45
    shellExit();
×
46
  }
47

48
  return false;
×
49
}
50

51
int32_t shellCheckIntSize() {
1,058,968✔
52
  if (sizeof(int8_t) != 1) {
53
    printf("int8 size is %d(!= 1)\r\n", (int)sizeof(int8_t));
54
    return -1;
55
  }
56
  if (sizeof(int16_t) != 2) {
57
    printf("int16 size is %d(!= 2)\r\n", (int)sizeof(int16_t));
58
    return -1;
59
  }
60
  if (sizeof(int32_t) != 4) {
61
    printf("int32 size is %d(!= 4)\r\n", (int)sizeof(int32_t));
62
    return -1;
63
  }
64
  if (sizeof(int64_t) != 8) {
65
    printf("int64 size is %d(!= 8)\r\n", (int)sizeof(int64_t));
66
    return -1;
67
  }
68
  return 0;
1,058,968✔
69
}
70

71
void shellPrintVersion() { printf("%s\r\n", shell.info.programVersion); }
×
72

73
void shellGenerateAuth() {
×
74
  char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0};
×
75
  taosEncryptPass_c((uint8_t *)shell.args.password, strlen(shell.args.password), secretEncrypt);
×
76
  printf("%s\r\n", secretEncrypt);
×
77
  fflush(stdout);
×
78
}
×
79

80
void shellDumpConfig() {
×
81
  (void)osDefaultInit();
×
82

83
  if (taosInitCfg(configDirShell, NULL, NULL, NULL, NULL, 1) != 0) {
×
84
    fprintf(stderr, "failed to load cfg since %s [0x%08X]\n", terrstr(), terrno);
×
85
    return;
×
86
  }
87

88
  cfgDumpCfg(taosGetCfg(), 1, true);
×
89

90
  fflush(stdout);
×
91
}
92

93
void shellCheckServerStatus() {
×
94
  TSDB_SERVER_STATUS code;
95

96
  do {
×
97
    char details[1024] = {0};
×
98
    code = taos_check_server_status(shell.args.host, shell.args.port, details, 1024);
×
99
    switch (code) {
×
100
      case TSDB_SRV_STATUS_UNAVAILABLE:
×
101
        printf("0: unavailable\r\n");
×
102
        break;
×
103
      case TSDB_SRV_STATUS_NETWORK_OK:
×
104
        printf("1: network ok\r\n");
×
105
        break;
×
106
      case TSDB_SRV_STATUS_SERVICE_OK:
×
107
        printf("2: service ok\r\n");
×
108
        break;
×
109
      case TSDB_SRV_STATUS_SERVICE_DEGRADED:
×
110
        printf("3: service degraded\r\n");
×
111
        break;
×
112
      case TSDB_SRV_STATUS_EXTING:
×
113
        printf("4: exiting\r\n");
×
114
        break;
×
115
    }
116
    if (strlen(details) != 0) {
×
117
      printf("%s\r\n\r\n", details);
×
118
    }
119
    fflush(stdout);
×
120
    if (code == TSDB_SRV_STATUS_NETWORK_OK && shell.args.is_startup) {
×
121
      taosMsleep(1000);
×
122
    } else {
123
      break;
124
    }
125
  } while (1);
126
}
×
127

128
void shellExit() {
×
129
  if (shell.conn != NULL) {
×
130
    taos_close(shell.conn);
×
131
    shell.conn = NULL;
×
132
  }
133
  shell.exit = true;
×
134
  taos_cleanup();
×
135
}
×
136

137
void trimStr(char *srcInfo, char *removeStr) {
808✔
138
    if (srcInfo == NULL || removeStr == NULL) return;
808✔
139

140
    int len = strlen(srcInfo);
808✔
141
    int new_len = len;
808✔
142
    
143
    int remove_len = strlen(removeStr);
808✔
144

145
    while (new_len > 0) {
2,222✔
146
        if (isspace(srcInfo[new_len - 1])) {
1,919✔
147
            srcInfo[--new_len] = '\0';
808✔
148
            continue;
808✔
149
        }
150
        
151
        if (new_len >= remove_len && strncmp(srcInfo + new_len - remove_len, removeStr, remove_len) == 0) {
1,111✔
152
            new_len -= remove_len;
606✔
153
            srcInfo[new_len] = '\0';
606✔
154
            continue;
606✔
155
        }
156
        
157
        break;
505✔
158
    }
159
}
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