• 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

15.65
/source/dnode/qnode/src/qnode.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 "tqueue.h"
17

18
#include "executor.h"
19
#include "qndInt.h"
20
#include "query.h"
21
#include "qworker.h"
22

23
int32_t qndOpen(const SQnodeOpt *pOption, SQnode **pQnode) {
2✔
24
  *pQnode = taosMemoryCalloc(1, sizeof(SQnode));
2!
25
  if (NULL == *pQnode) {
2!
26
    qError("calloc SQnode failed");
×
27
    return terrno;
×
28
  }
29
  (*pQnode)->qndId = QNODE_HANDLE;
2✔
30

31
  int32_t code = qWorkerInit(NODE_TYPE_QNODE, (*pQnode)->qndId, (void **)&(*pQnode)->pQuery, &pOption->msgCb);
2✔
32
  if (TSDB_CODE_SUCCESS != code) {
2!
33
    taosMemoryFreeClear(pQnode);
×
34
    return code;
×
35
  }
36

37
  (*pQnode)->msgCb = pOption->msgCb;
2✔
38
  return TSDB_CODE_SUCCESS;
2✔
39
}
40

41
void qndClose(SQnode *pQnode) {
2✔
42
  qWorkerDestroy((void **)&pQnode->pQuery);
2✔
43
  taosMemoryFree(pQnode);
2!
44
}
2✔
45

UNCOV
46
int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) {
×
UNCOV
47
  SReadHandle  handle = {.pMsgCb = &pQnode->msgCb};
×
UNCOV
48
  SQWorkerStat stat = {0};
×
49

UNCOV
50
  int32_t code = qWorkerGetStat(&handle, pQnode->pQuery, &stat);
×
UNCOV
51
  if (code) {
×
52
    return code;
×
53
  }
54

UNCOV
55
  pLoad->numOfQueryInQueue = stat.numOfQueryInQueue;
×
UNCOV
56
  pLoad->numOfFetchInQueue = stat.numOfFetchInQueue;
×
UNCOV
57
  pLoad->timeInQueryQueue = stat.timeInQueryQueue;
×
UNCOV
58
  pLoad->timeInFetchQueue = stat.timeInFetchQueue;
×
UNCOV
59
  pLoad->cacheDataSize = stat.cacheDataSize;
×
UNCOV
60
  pLoad->numOfProcessedQuery = stat.queryProcessed;
×
UNCOV
61
  pLoad->numOfProcessedCQuery = stat.cqueryProcessed;
×
UNCOV
62
  pLoad->numOfProcessedFetch = stat.fetchProcessed;
×
UNCOV
63
  pLoad->numOfProcessedDrop = stat.dropProcessed;
×
UNCOV
64
  pLoad->numOfProcessedNotify = stat.notifyProcessed;
×
UNCOV
65
  pLoad->numOfProcessedHb = stat.hbProcessed;
×
UNCOV
66
  pLoad->numOfProcessedDelete = stat.deleteProcessed;
×
67

UNCOV
68
  return 0;
×
69
}
70

UNCOV
71
int32_t qndPreprocessQueryMsg(SQnode *pQnode, SRpcMsg *pMsg) {
×
UNCOV
72
  if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) {
×
73
    return 0;
×
74
  }
75

UNCOV
76
  return qWorkerPreprocessQueryMsg(pQnode->pQuery, pMsg, false);
×
77
}
78

UNCOV
79
int32_t qndProcessQueryMsg(SQnode *pQnode, SQueueInfo *pInfo, SRpcMsg *pMsg) {
×
UNCOV
80
  int32_t     code = -1;
×
UNCOV
81
  int64_t     ts = pInfo->timestamp;
×
UNCOV
82
  SReadHandle handle = {.pMsgCb = &pQnode->msgCb, .pWorkerCb = pInfo->workerCb};
×
UNCOV
83
  qTrace("message in qnode queue is processing");
×
84

UNCOV
85
  switch (pMsg->msgType) {
×
UNCOV
86
    case TDMT_SCH_QUERY:
×
87
    case TDMT_SCH_MERGE_QUERY:
UNCOV
88
      code = qWorkerProcessQueryMsg(&handle, pQnode->pQuery, pMsg, ts);
×
UNCOV
89
      break;
×
UNCOV
90
    case TDMT_SCH_QUERY_CONTINUE:
×
UNCOV
91
      code = qWorkerProcessCQueryMsg(&handle, pQnode->pQuery, pMsg, ts);
×
UNCOV
92
      break;
×
UNCOV
93
    case TDMT_SCH_FETCH:
×
94
    case TDMT_SCH_MERGE_FETCH:
UNCOV
95
      code = qWorkerProcessFetchMsg(pQnode, pQnode->pQuery, pMsg, ts);
×
UNCOV
96
      break;
×
97
    case TDMT_SCH_CANCEL_TASK:
×
98
      // code = qWorkerProcessCancelMsg(pQnode, pQnode->pQuery, pMsg, ts);
99
      break;
×
UNCOV
100
    case TDMT_SCH_DROP_TASK:
×
UNCOV
101
      code = qWorkerProcessDropMsg(pQnode, pQnode->pQuery, pMsg, ts);
×
UNCOV
102
      break;
×
UNCOV
103
    case TDMT_VND_TMQ_CONSUME:
×
104
      // code =  tqProcessConsumeReq(pQnode->pTq, pMsg);
105
      // break;
106
    case TDMT_SCH_QUERY_HEARTBEAT:
UNCOV
107
      code = qWorkerProcessHbMsg(pQnode, pQnode->pQuery, pMsg, ts);
×
UNCOV
108
      break;
×
109
    case TDMT_SCH_TASK_NOTIFY:
×
110
      code = qWorkerProcessNotifyMsg(pQnode, pQnode->pQuery, pMsg, ts);
×
111
      break;
×
112
    default:
×
113
      qError("unknown msg type:%d in qnode queue", pMsg->msgType);
×
114
      terrno = TSDB_CODE_APP_ERROR;
×
115
  }
116

UNCOV
117
  if (code == 0) {
×
UNCOV
118
    return TSDB_CODE_ACTION_IN_PROGRESS;
×
119
  } else {
UNCOV
120
    return code;
×
121
  }
122
}
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