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

taosdata / TDengine / #4513

17 Jul 2025 02:02AM UTC coverage: 31.359% (-31.1%) from 62.446%
#4513

push

travis-ci

web-flow
Merge pull request #31914 from taosdata/fix/3.0/compare-ans-failed

fix:Convert line endings from LF to CRLF for ans file

68541 of 301034 branches covered (22.77%)

Branch coverage included in aggregate %.

117356 of 291771 relevant lines covered (40.22%)

602262.98 hits per line

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

0.0
/source/dnode/mnode/impl/src/mndStreamTransAct.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 "mndDb.h"
17
#include "mndStb.h"
18
#include "mndStream.h"
19
#include "mndTrans.h"
20
#include "mndVgroup.h"
21
#include "taoserror.h"
22
#include "tmisce.h"
23

24

25
static int32_t doSetStopAllTasksAction(SMnode* pMnode, STrans* pTrans, SVgObj* pVgObj) {
×
26
  void   *pBuf = NULL;
×
27
  int32_t len = 0;
×
28
  int32_t code = 0;
×
29
  SEncoder encoder;
30

31
  SStreamTaskStopReq req = {.streamId = -1};
×
32
  tEncodeSize(tEncodeStreamTaskStopReq, &req, len, code);
×
33
  if (code < 0) {
×
34
    terrno = TSDB_CODE_OUT_OF_MEMORY;
×
35
    return terrno;
×
36
  }
37

38
  int32_t tlen = sizeof(SMsgHead) + len;
×
39

40
  pBuf = taosMemoryMalloc(tlen);
×
41
  if (pBuf == NULL) {
×
42
    return terrno;
×
43
  }
44

45
  void    *abuf = POINTER_SHIFT(pBuf, sizeof(SMsgHead));
×
46
  tEncoderInit(&encoder, abuf, tlen);
×
47
  code = tEncodeStreamTaskStopReq(&encoder, &req);
×
48
  if (code == -1) {
×
49
    tEncoderClear(&encoder);
×
50
    taosMemoryFree(pBuf);
×
51
    return code;
×
52
  }
53

54
  SMsgHead *pMsgHead = (SMsgHead *)pBuf;
×
55
  pMsgHead->contLen = htonl(tlen);
×
56
  pMsgHead->vgId = htonl(pVgObj->vgId);
×
57

58
  tEncoderClear(&encoder);
×
59

60
  SEpSet epset = mndGetVgroupEpset(pMnode, pVgObj);
×
61
  // mndReleaseVgroup(pMnode, pVgObj);
62

63
  code = setTransAction(pTrans, pBuf, tlen, TDMT_VND_STREAM_ALL_STOP, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
×
64
  if (code != TSDB_CODE_SUCCESS) {
×
65
    mError("failed to create stop all streams trans, code:%s", tstrerror(code));
×
66
    taosMemoryFree(pBuf);
×
67
  }
68

69
  return 0;
×
70
}
71

72
int32_t mndStreamSetStopStreamTasksActions(SMnode* pMnode, STrans *pTrans, uint64_t dbUid) {
×
73
  int32_t code = 0;
×
74
  SSdb   *pSdb = pMnode->pSdb;
×
75
  void   *pIter = NULL;
×
76

77
  while (1) {
×
78
    SVgObj *pVgroup = NULL;
×
79
    pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
×
80
    if (pIter == NULL) break;
×
81

82
    if(pVgroup->mountVgId) {
×
83
      sdbRelease(pSdb, pVgroup);
×
84
      continue;
×
85
    }
86

87
    if (pVgroup->dbUid == dbUid) {
×
88
      if ((code = doSetStopAllTasksAction(pMnode, pTrans, pVgroup)) != 0) {
×
89
        sdbCancelFetch(pSdb, pIter);
×
90
        sdbRelease(pSdb, pVgroup);
×
91
        TAOS_RETURN(code);
×
92
      }
93
    }
94

95
    sdbRelease(pSdb, pVgroup);
×
96
  }
97

98
  TAOS_RETURN(code);
×
99
  return 0;
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