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

taosdata / TDengine / #3653

14 Mar 2025 08:10AM UTC coverage: 22.565% (-41.0%) from 63.596%
#3653

push

travis-ci

web-flow
feat(keep): support keep on super table level. (#30097)

* Feat: support use keep while create super table.

* Test(keep): add test for create super table with keep option.

* Feat(keep): Add tmsg for create keep.

* Feat(keep): support alter table option keep.

* Fix(keep): Add baisc test for alter table option.

* Fix(keep): memory leek.

* Feat(keep): add keep to metaEntry&metaCache and fix earliestTs with stn keep.

* Test(keep): add some cases for select with stb keep.

* Fix: fix ci core while alter stb.

* Feat(keep): delete expired data in super table level.

* Feat: remove get stb keep while query.

* Fix : build error.

* Revert "Fix : build error."

This reverts commit 0ed66e4e8.

* Revert "Feat(keep): delete expired data in super table level."

This reverts commit 36330f6b4.

* Fix : build errors.

* Feat : support restart taosd.

* Fix : alter table comment problems.

* Test : add tests for super table keep.

* Fix: change sdb stb reserve size.

* Test: add more tests.

* Feat: Disable normal tables and sub tables from setting the keep parameter

* Fix: add more checks to avoid unknown address.

* Docs: Add docs for stable keep.

* Fix: some review changes.

* Fix: review errors.

49248 of 302527 branches covered (16.28%)

Branch coverage included in aggregate %.

53 of 99 new or added lines in 12 files covered. (53.54%)

155872 existing lines in 443 files now uncovered.

87359 of 302857 relevant lines covered (28.84%)

570004.22 hits per line

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

0.0
/tools/shell/src/shellNettest.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 _GNU_SOURCE
17
#include "shellInt.h"
18
#include "tversion.h"
19

UNCOV
20
static void shellWorkAsClient() {
×
UNCOV
21
  SShellArgs *pArgs = &shell.args;
×
UNCOV
22
  SRpcInit    rpcInit = {0};
×
UNCOV
23
  SEpSet      epSet = {.inUse = 0, .numOfEps = 1};
×
UNCOV
24
  SRpcMsg     rpcRsp = {0};
×
UNCOV
25
  void       *clientRpc = NULL;
×
UNCOV
26
  char        pass[TSDB_PASSWORD_LEN + 1] = {0};
×
27

28
  taosEncryptPass_c((uint8_t *)("_pwd"), strlen("_pwd"), pass);
UNCOV
29
  rpcInit.label = "CHK";
×
UNCOV
30
  rpcInit.numOfThreads = 1;
×
UNCOV
31
  rpcInit.sessions = 16;
×
UNCOV
32
  rpcInit.connType = TAOS_CONN_CLIENT;
×
UNCOV
33
  rpcInit.idleTime = tsShellActivityTimer * 1000;
×
UNCOV
34
  rpcInit.user = "_dnd";
×
UNCOV
35
  rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
×
36

UNCOV
37
  taosVersionStrToInt(td_version, &rpcInit.compatibilityVer);
×
UNCOV
38
  clientRpc = rpcOpen(&rpcInit);
×
UNCOV
39
  if (clientRpc == NULL) {
×
40
    printf("failed to init net test client since %s\r\n", terrstr());
×
41
    goto _OVER;
×
42
  }
43

UNCOV
44
  if (pArgs->host == NULL) {
×
UNCOV
45
    pArgs->host = tsFirst;
×
46
  }
UNCOV
47
  char fqdn[TSDB_FQDN_LEN] = {0};
×
UNCOV
48
  tstrncpy(fqdn, pArgs->host, TSDB_FQDN_LEN);
×
UNCOV
49
  strtok(fqdn, ":");
×
50

UNCOV
51
  if (pArgs->port == 0) {
×
UNCOV
52
    pArgs->port = tsServerPort;
×
53
  }
54

UNCOV
55
  printf("network test client is initialized, the server is %s:%u\r\n", fqdn, pArgs->port);
×
56

UNCOV
57
  tstrncpy(epSet.eps[0].fqdn, fqdn, TSDB_FQDN_LEN);
×
UNCOV
58
  epSet.eps[0].port = (uint16_t)pArgs->port;
×
59

UNCOV
60
  int32_t  totalSucc = 0;
×
UNCOV
61
  uint64_t startTime = taosGetTimestampUs();
×
62

UNCOV
63
  for (int32_t i = 0; i < pArgs->pktNum; ++i) {
×
UNCOV
64
    SRpcMsg rpcMsg = {.info.ahandle = (void *)0x9525, .info.notFreeAhandle = 1, .msgType = TDMT_DND_NET_TEST};
×
UNCOV
65
    rpcMsg.pCont = rpcMallocCont(pArgs->pktLen);
×
UNCOV
66
    rpcMsg.contLen = pArgs->pktLen;
×
67

UNCOV
68
    printf("request is sent, size:%d\r\n", rpcMsg.contLen);
×
UNCOV
69
    rpcSendRecv(clientRpc, &epSet, &rpcMsg, &rpcRsp);
×
UNCOV
70
    if (rpcRsp.code == 0 && rpcRsp.contLen == rpcMsg.contLen) {
×
UNCOV
71
      printf("response is received, size:%d\r\n", rpcMsg.contLen);
×
UNCOV
72
      if (rpcRsp.code == 0) totalSucc++;
×
73
    } else {
74
      printf("response not received since %s\r\n", tstrerror(rpcRsp.code));
×
75
    }
76

UNCOV
77
    rpcFreeCont(rpcRsp.pCont);
×
UNCOV
78
    rpcRsp.pCont = NULL;
×
79
  }
80

UNCOV
81
  uint64_t endTime = taosGetTimestampUs();
×
UNCOV
82
  uint64_t elT = endTime - startTime;
×
83

UNCOV
84
  printf("\r\ntotal succ:%5d/%d\tcost:%8.2lf ms\tspeed:%8.2lf MB/s\r\n", totalSucc, pArgs->pktNum, elT / 1000.0,
×
UNCOV
85
         pArgs->pktLen / (elT / 1000000.0) / 1024.0 / 1024.0 * totalSucc);
×
86

UNCOV
87
_OVER:
×
UNCOV
88
  if (clientRpc != NULL) {
×
UNCOV
89
    rpcClose(clientRpc);
×
90
  }
UNCOV
91
  if (rpcRsp.pCont != NULL) {
×
92
    rpcFreeCont(rpcRsp.pCont);
×
93
  }
UNCOV
94
}
×
95

96
static void shellProcessMsg(void *p, SRpcMsg *pRpc, SEpSet *pEpSet) {
×
97
  printf("request is received, size:%d\r\n", pRpc->contLen);
×
98
  fflush(stdout);
×
99
  SRpcMsg rsp = {.info = pRpc->info, .code = 0};
×
100
  rsp.pCont = rpcMallocCont(pRpc->contLen);
×
101
  if (rsp.pCont == NULL) {
×
102
    rsp.code = TSDB_CODE_OUT_OF_MEMORY;
×
103
  } else {
104
    rsp.contLen = pRpc->contLen;
×
105
  }
106
  rpcSendResponse(&rsp);
×
107
}
×
108

109
void shellNettestHandler(int32_t signum, void *sigInfo, void *context) { shellExit(); }
×
110

111
static void shellWorkAsServer() {
×
112
  SShellArgs *pArgs = &shell.args;
×
113

114
  if (pArgs->port == 0) {
×
115
    pArgs->port = tsServerPort;
×
116
  }
117

118
  SRpcInit rpcInit = {0};
×
119
  memcpy(rpcInit.localFqdn, tsLocalFqdn, strlen(tsLocalFqdn));
×
120
  rpcInit.localPort = pArgs->port;
×
121
  rpcInit.label = "CHK";
×
122
  rpcInit.numOfThreads = 2;
×
123
  rpcInit.cfp = (RpcCfp)shellProcessMsg;
×
124
  rpcInit.sessions = 10;
×
125
  rpcInit.connType = TAOS_CONN_SERVER;
×
126
  rpcInit.idleTime = tsShellActivityTimer * 1000;
×
127

128
  taosVersionStrToInt(td_version, &rpcInit.compatibilityVer);
×
129

130
  void *serverRpc = rpcOpen(&rpcInit);
×
131
  if (serverRpc == NULL) {
×
132
    printf("failed to init net test server since %s\r\n", terrstr());
×
133
  } else {
134
    printf("network test server is initialized, port:%u\r\n", pArgs->port);
×
135
    taosSetSignal(SIGTERM, shellNettestHandler);
×
136
    while (1) taosMsleep(10);
×
137
  }
138
}
×
139

UNCOV
140
void shellTestNetWork() {
×
UNCOV
141
  if (strcmp(shell.args.netrole, "client") == 0) {
×
UNCOV
142
    shellWorkAsClient();
×
143
  }
144

UNCOV
145
  if (strcmp(shell.args.netrole, "server") == 0) {
×
146
    shellWorkAsServer();
×
147
  }
UNCOV
148
}
×
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