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

taosdata / TDengine / #4986

15 Mar 2026 08:32AM UTC coverage: 37.305% (-31.3%) from 68.601%
#4986

push

travis-ci

tomchon
test: keep docs and unit test

125478 of 336361 relevant lines covered (37.3%)

1134847.06 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
  int32_t groupId;
60
} STransAction;
61

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

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

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

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

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

110
SSdbRaw *mndTransEncode(STrans *pTrans);
111
SSdbRow *mndTransDecode(SSdbRaw *pRaw);
112
void     mndTransDropData(STrans *pTrans);
113

114
bool mndTransPerformPrepareStage(SMnode *pMnode, STrans *pTrans, bool topHalf);
115
#ifdef __cplusplus
116
}
117
#endif
118

119
#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