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

taosdata / TDengine / #3562

20 Dec 2024 09:57AM UTC coverage: 26.655% (-32.2%) from 58.812%
#3562

push

travis-ci

web-flow
Merge pull request #29229 from taosdata/enh/TS-5749-3.0

enh: seperate tsdb async tasks to different thread pools

21498 of 109421 branches covered (19.65%)

Branch coverage included in aggregate %.

66 of 96 new or added lines in 7 files covered. (68.75%)

39441 existing lines in 157 files now uncovered.

35007 of 102566 relevant lines covered (34.13%)

53922.97 hits per line

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

0.0
/source/dnode/mnode/impl/src/mndGrant.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 _DEFAULT_SOURCE
17
#include "mndGrant.h"
18
#include "mndShow.h"
19

20
#ifndef _GRANT
21

22
#define GRANT_ITEM_SHOW(display)                       \
23
  do {                                                 \
24
    cols++;                                            \
25
    pColInfo = taosArrayGet(pBlock->pDataBlock, cols); \
26
    src = (display);                                   \
27
    STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);          \
28
    COL_DATA_SET_VAL_GOTO(tmp, false, NULL, _exit);    \
29
  } while (0)
30

31
static int32_t mndRetrieveGrant(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
32
  SMnode *pMnode = pReq->info.node;
33
  SSdb   *pSdb = pMnode->pSdb;
34
  int32_t numOfRows = 0;
35
  int32_t cols = 0;
36
  int32_t code = 0;
37
  int32_t lino = 0;
38
  char    tmp[32];
39

40
  if (pShow->numOfRows < 1) {
41
    cols = 0;
42
    SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols);
43
    const char      *src = TD_PRODUCT_NAME;
44
    STR_WITH_MAXSIZE_TO_VARSTR(tmp, src, 32);
45
    COL_DATA_SET_VAL_GOTO(tmp, false, NULL, _exit);
46

47
    GRANT_ITEM_SHOW("unlimited");
48
    GRANT_ITEM_SHOW("limited");
49
    GRANT_ITEM_SHOW("false");
50
    GRANT_ITEM_SHOW("ungranted");
51
    GRANT_ITEM_SHOW("unlimited");
52
    GRANT_ITEM_SHOW("unlimited");
53
    GRANT_ITEM_SHOW("unlimited");
54

55
    ++numOfRows;
56
  }
57

58
  pShow->numOfRows += numOfRows;
59
_exit:
60
  if (code != 0) {
61
    mError("failed to retrieve grant at line %d since %s", lino, tstrerror(code));
62
    TAOS_RETURN(code);
63
  }
64
  return numOfRows;
65
}
66

67
static int32_t mndRetrieveGrantFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; }
68
static int32_t mndRetrieveGrantLogs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; }
69
static int32_t mndRetrieveMachines(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; }
70
static int32_t mndRetrieveEncryptions(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { return 0; }
71

72
static int32_t mndProcessGrantHB(SRpcMsg *pReq) { return TSDB_CODE_SUCCESS; }
73

74
int32_t mndInitGrant(SMnode *pMnode) {
75
  mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS, mndRetrieveGrant);
76
  mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS_FULL, mndRetrieveGrantFull);
77
  mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_GRANTS_LOGS, mndRetrieveGrantLogs);
78
  mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_MACHINES, mndRetrieveMachines);
79
  mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_ENCRYPTIONS, mndRetrieveEncryptions);
80
  mndSetMsgHandle(pMnode, TDMT_MND_GRANT_HB_TIMER, mndProcessGrantHB);
81
  return 0;
82
}
83

84
void    mndCleanupGrant() {}
85
void    grantParseParameter() { mError("can't parsed parameter k"); }
86
void    grantReset(SMnode *pMnode, EGrantType grant, uint64_t value) {}
87
void    grantAdd(EGrantType grant, uint64_t value) {}
88
void    grantRestore(EGrantType grant, uint64_t value) {}
89
int64_t grantRemain(EGrantType grant) { return 0; }
90
int32_t tGetMachineId(char **result) {
91
  *result = NULL;
92
  return 0;
93
}
94
int32_t dmProcessGrantReq(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
95
int32_t dmProcessGrantNotify(void *pInfo, SRpcMsg *pMsg) { return TSDB_CODE_SUCCESS; }
96
int32_t mndProcessConfigGrantReq(SMnode *pMnode, SRpcMsg *pReq, SMCfgClusterReq *pCfg) { return 0; }
97
#endif
98

UNCOV
99
void mndGenerateMachineCode() { grantParseParameter(); }
×
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