• 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
/source/dnode/mnode/impl/inc/mndTrans.h
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
#ifndef _TD_MND_TRANS_H_
17
#define _TD_MND_TRANS_H_
18

19
#include "mndInt.h"
20

21
#ifdef __cplusplus
22
extern "C" {
23
#endif
24

25
typedef enum {
26
  TRANS_START_FUNC_TEST = 1,
27
  TRANS_STOP_FUNC_TEST = 2,
28
  TRANS_START_FUNC_MQ_REB = 3,
29
  TRANS_STOP_FUNC_MQ_REB = 4,
30
  TRANS_FUNC_RECOVER_STREAM_STEP_NEXT = 5,
31
} ETrnFunc;
32

33
typedef enum {
34
  TRANS_ACTION_NULL = 0,
35
  TRANS_ACTION_MSG = 1,
36
  TRANS_ACTION_RAW = 2,
37
} ETrnAct;
38

39
typedef struct {
40
  int32_t   id;
41
  int32_t   errCode;
42
  int32_t   acceptableCode;
43
  int32_t   retryCode;
44
  ETrnAct   actionType;
45
  ETrnStage stage;
46
  int8_t    reserved;
47
  int8_t    rawWritten;
48
  int8_t    msgSent;
49
  int8_t    msgReceived;
50
  tmsg_t    msgType;
51
  SEpSet    epSet;
52
  int32_t   contLen;
53
  void     *pCont;
54
  SSdbRaw  *pRaw;
55

56
  int64_t mTraceId;
57
  int64_t startTime;
58
  int64_t endTime;
59
} STransAction;
60

61
typedef void (*TransCbFp)(SMnode *pMnode, void *param, int32_t paramLen);
62

63
int32_t mndInitTrans(SMnode *pMnode);
64
void    mndCleanupTrans(SMnode *pMnode);
65
STrans *mndAcquireTrans(SMnode *pMnode, int32_t transId);
66
void    mndReleaseTrans(SMnode *pMnode, STrans *pTrans);
67

68
STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnConflct conflict, const SRpcMsg *pReq,
69
                       const char *opername);
70
void    mndTransDrop(STrans *pTrans);
71

72
int32_t mndTransAppendPrepareLog(STrans *pTrans, SSdbRaw *pRaw);
73
int32_t mndTransAppendRedolog(STrans *pTrans, SSdbRaw *pRaw);
74
int32_t mndTransAppendUndolog(STrans *pTrans, SSdbRaw *pRaw);
75
int32_t mndTransAppendCommitlog(STrans *pTrans, SSdbRaw *pRaw);
76
int32_t mndTransAppendNullLog(STrans *pTrans);
77

78
int32_t mndTransAppendRedoAction(STrans *pTrans, STransAction *pAction);
79
int32_t mndTransAppendUndoAction(STrans *pTrans, STransAction *pAction);
80
void    mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen);
81
void    mndTransSetCb(STrans *pTrans, ETrnFunc startFunc, ETrnFunc stopFunc, void *param, int32_t paramLen);
82
void    mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbname);
83
void    mndTransAddArbGroupId(STrans *pTrans, int32_t groupId);
84
void    mndTransSetSerial(STrans *pTrans);
85
void    mndTransSetBeKilled(STrans *pTrans, bool ableToBeKilled);
86
void    mndTransSetKillMode(STrans *pTrans, ETrnKillMode killMode);
87
void    mndTransSetParallel(STrans *pTrans);
88
void    mndTransSetChangeless(STrans *pTrans);
89
void    mndTransSetOper(STrans *pTrans, EOperType oper);
90
int32_t mndTransCheckConflict(SMnode *pMnode, STrans *pTrans);
91
int32_t mndTransCheckConflictWithCompact(SMnode *pMnode, STrans *pTrans);
92
#ifndef BUILD_NO_CALL
UNCOV
93
static int32_t mndTrancCheckConflict(SMnode *pMnode, STrans *pTrans) {
×
UNCOV
94
    return mndTransCheckConflict(pMnode, pTrans);
×
95
}
96
#endif
97
int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans);
98
int32_t mndTransProcessRsp(SRpcMsg *pRsp);
99
void    mndTransPullup(SMnode *pMnode);
100
int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans);
101
void    mndTransExecute(SMnode *pMnode, STrans *pTrans);
102
void    mndTransRefresh(SMnode *pMnode, STrans *pTrans);
103
int32_t mndSetRpcInfoForDbTrans(SMnode *pMnode, SRpcMsg *pMsg, EOperType oper, const char *dbname);
104

105
SSdbRaw *mndTransEncode(STrans *pTrans);
106
SSdbRow *mndTransDecode(SSdbRaw *pRaw);
107
void     mndTransDropData(STrans *pTrans);
108

109
bool mndTransPerformPrepareStage(SMnode *pMnode, STrans *pTrans, bool topHalf);
110
#ifdef __cplusplus
111
}
112
#endif
113

114
#endif /*_TD_MND_TRANS_H_*/
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