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

taosdata / TDengine / #3798

31 Mar 2025 10:39AM UTC coverage: 9.424% (-20.9%) from 30.372%
#3798

push

travis-ci

happyguoxy
test:add test cases

21549 of 307601 branches covered (7.01%)

Branch coverage included in aggregate %.

36084 of 303967 relevant lines covered (11.87%)

58620.7 hits per line

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

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

19
int32_t mndInitView(SMnode *pMnode) {
×
20
  mndSetMsgHandle(pMnode, TDMT_MND_CREATE_VIEW, mndProcessCreateViewReq);
×
21
  mndSetMsgHandle(pMnode, TDMT_MND_DROP_VIEW, mndProcessDropViewReq);
×
22
  mndSetMsgHandle(pMnode, TDMT_MND_VIEW_META, mndProcessGetViewMetaReq);
×
23

24
  mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_VIEWS, mndRetrieveView);
×
25
  mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_VIEWS, mndCancelGetNextView);
×
26

27
#ifdef TD_ENTERPRISE
28
  initDynViewVersion();
×
29

30
  SSdbTable table = {
×
31
      .sdbType = SDB_VIEW,
32
      .keyType = SDB_KEY_BINARY,
33
      .encodeFp = (SdbEncodeFp)mndViewActionEncode,
34
      .decodeFp = (SdbDecodeFp)mndViewActionDecode,
35
      .insertFp = (SdbInsertFp)mndViewActionInsert,
36
      .updateFp = (SdbUpdateFp)mndViewActionUpdate,
37
      .deleteFp = (SdbDeleteFp)mndViewActionDelete,
38
  };
39

40
  return sdbSetTable(pMnode->pSdb, table);
×
41
#else
42
  return TSDB_CODE_SUCCESS;
43
#endif
44
}
45

46
void mndCleanupView(SMnode *pMnode) { mDebug("mnd view cleanup"); }
×
47

48
int32_t mndProcessCreateViewReq(SRpcMsg *pReq) {
×
49
#ifndef TD_ENTERPRISE
50
  return TSDB_CODE_OPS_NOT_SUPPORT;
51
#else
52
  SCMCreateViewReq createViewReq = {0};
×
53
  if (tDeserializeSCMCreateViewReq(pReq->pCont, pReq->contLen, &createViewReq) != 0) {
×
54
    TAOS_RETURN(TSDB_CODE_INVALID_MSG);
×
55
  }
56

57
  mInfo("start to create view:%s, sql:%s", createViewReq.fullname, createViewReq.sql);
×
58

59
  return mndProcessCreateViewReqImpl(&createViewReq, pReq);
×
60
#endif
61
}
62

63
int32_t mndProcessDropViewReq(SRpcMsg *pReq) {
×
64
#ifndef TD_ENTERPRISE
65
  return TSDB_CODE_OPS_NOT_SUPPORT;
66
#else
67
  SCMDropViewReq dropViewReq = {0};
×
68
  if (tDeserializeSCMDropViewReq(pReq->pCont, pReq->contLen, &dropViewReq) != 0) {
×
69
    TAOS_RETURN(TSDB_CODE_INVALID_MSG);
×
70
  }
71

72
  mInfo("start to drop view:%s, sql:%s", dropViewReq.name, dropViewReq.sql);
×
73

74
  return mndProcessDropViewReqImpl(&dropViewReq, pReq);
×
75
#endif
76
}
77

78
int32_t mndProcessGetViewMetaReq(SRpcMsg *pReq) {
×
79
#ifndef TD_ENTERPRISE
80
  return TSDB_CODE_OPS_NOT_SUPPORT;
81
#else
82
  SViewMetaReq req = {0};
×
83

84
  if (tDeserializeSViewMetaReq(pReq->pCont, pReq->contLen, &req) != 0) {
×
85
    TAOS_RETURN(TSDB_CODE_INVALID_MSG);
×
86
  }
87

88
  return mndProcessViewMetaReqImpl(&req, pReq);
×
89
#endif
90
}
91

92
int32_t mndRetrieveView(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
×
93
#ifndef TD_ENTERPRISE
94
  return 0;
95
#else
96
  return mndRetrieveViewImpl(pReq, pShow, pBlock, rows);
×
97
#endif
98
}
99

100
void mndCancelGetNextView(SMnode *pMnode, void *pIter) {
×
101
  SSdb *pSdb = pMnode->pSdb;
×
102
  sdbCancelFetchByType(pSdb, pIter, SDB_VIEW);
×
103
}
×
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