Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
82ad9a91
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
82ad9a91
编写于
11月 09, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
transaction object
上级
622cdc39
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
84 addition
and
13 deletion
+84
-13
include/dnode/mnode/transaction/trn.h
include/dnode/mnode/transaction/trn.h
+6
-7
source/dnode/mnode/transaction/inc/trnInt.h
source/dnode/mnode/transaction/inc/trnInt.h
+9
-0
source/dnode/mnode/transaction/src/trn.c
source/dnode/mnode/transaction/src/trn.c
+69
-6
未找到文件。
include/dnode/mnode/transaction/trn.h
浏览文件 @
82ad9a91
...
@@ -23,8 +23,7 @@
...
@@ -23,8 +23,7 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
typedef
struct
{
typedef
struct
STrans
STrans
;
}
STrans
;
int32_t
trnInit
();
int32_t
trnInit
();
void
trnCleanup
();
void
trnCleanup
();
...
@@ -33,11 +32,11 @@ STrans *trnCreate();
...
@@ -33,11 +32,11 @@ STrans *trnCreate();
int32_t
trnCommit
(
STrans
*
);
int32_t
trnCommit
(
STrans
*
);
void
trnDrop
(
STrans
*
);
void
trnDrop
(
STrans
*
);
void
trnAppendRedoLog
(
STrans
*
,
SSdbRawData
*
);
int32_t
trnAppendRedoLog
(
STrans
*
,
SSdbRawData
*
);
void
trnAppendUndoLog
(
STrans
*
,
SSdbRawData
*
);
int32_t
trnAppendUndoLog
(
STrans
*
,
SSdbRawData
*
);
void
trnAppendCommitLog
(
STrans
*
,
SSdbRawData
*
);
int32_t
trnAppendCommitLog
(
STrans
*
,
SSdbRawData
*
);
void
trnAppendRedoAction
(
STrans
*
,
SEpSet
*
,
void
*
pMsg
);
int32_t
trnAppendRedoAction
(
STrans
*
,
SEpSet
*
,
void
*
pMsg
);
void
trnAppendUndoAction
(
STrans
*
,
SEpSet
*
,
void
*
pMsg
);
int32_t
trnAppendUndoAction
(
STrans
*
,
SEpSet
*
,
void
*
pMsg
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mnode/transaction/inc/trnInt.h
浏览文件 @
82ad9a91
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "os.h"
#include "os.h"
#include "trn.h"
#include "trn.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tarray.h"
#include "tlog.h"
#include "tlog.h"
#ifdef __cplusplus
#ifdef __cplusplus
...
@@ -32,6 +33,14 @@ extern "C" {
...
@@ -32,6 +33,14 @@ extern "C" {
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
typedef
struct
STrans
{
SArray
*
redoLogs
;
SArray
*
undoLogs
;
SArray
*
commitLogs
;
SArray
*
redoActions
;
SArray
*
undoActions
;
}
STrans
;
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/transaction/src/trn.c
浏览文件 @
82ad9a91
...
@@ -16,15 +16,78 @@
...
@@ -16,15 +16,78 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "trnInt.h"
#include "trnInt.h"
#define TRN_DEFAULT_ARRAY_SIZE 8
int32_t
trnInit
()
{
return
0
;
}
int32_t
trnInit
()
{
return
0
;
}
void
trnCleanup
();
void
trnCleanup
();
STrans
*
trnCreate
()
{
return
NULL
;
}
STrans
*
trnCreate
()
{
STrans
*
pTrans
=
calloc
(
1
,
sizeof
(
STrans
));
if
(
pTrans
==
NULL
)
{
terrno
=
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
NULL
;
}
pTrans
->
redoLogs
=
taosArrayInit
(
TRN_DEFAULT_ARRAY_SIZE
,
sizeof
(
void
*
));
pTrans
->
undoLogs
=
taosArrayInit
(
TRN_DEFAULT_ARRAY_SIZE
,
sizeof
(
void
*
));
pTrans
->
commitLogs
=
taosArrayInit
(
TRN_DEFAULT_ARRAY_SIZE
,
sizeof
(
void
*
));
pTrans
->
redoActions
=
taosArrayInit
(
TRN_DEFAULT_ARRAY_SIZE
,
sizeof
(
void
*
));
pTrans
->
undoActions
=
taosArrayInit
(
TRN_DEFAULT_ARRAY_SIZE
,
sizeof
(
void
*
));
if
(
pTrans
->
redoLogs
==
NULL
||
pTrans
->
undoLogs
==
NULL
||
pTrans
->
commitLogs
==
NULL
||
pTrans
->
redoActions
==
NULL
||
pTrans
->
undoActions
==
NULL
)
{
taosArrayDestroy
(
pTrans
->
redoLogs
);
taosArrayDestroy
(
pTrans
->
undoLogs
);
taosArrayDestroy
(
pTrans
->
commitLogs
);
taosArrayDestroy
(
pTrans
->
redoActions
);
taosArrayDestroy
(
pTrans
->
undoActions
);
free
(
pTrans
);
terrno
=
TSDB_CODE_MND_OUT_OF_MEMORY
;
return
NULL
;
}
return
pTrans
;
}
int32_t
trnCommit
(
STrans
*
pTrans
)
{
return
0
;
}
int32_t
trnCommit
(
STrans
*
pTrans
)
{
return
0
;
}
void
trnDrop
(
STrans
*
pTrans
)
{}
void
trnDrop
(
STrans
*
pTrans
)
{}
void
trnAppendRedoLog
(
STrans
*
pTrans
,
SSdbRawData
*
pRaw
)
{}
int32_t
trnAppendRedoLog
(
STrans
*
pTrans
,
SSdbRawData
*
pRaw
)
{
void
trnAppendUndoLog
(
STrans
*
pTrans
,
SSdbRawData
*
pRaw
)
{}
void
*
ptr
=
taosArrayPush
(
pTrans
->
redoLogs
,
&
pRaw
);
void
trnAppendCommitLog
(
STrans
*
pTrans
,
SSdbRawData
*
pRaw
)
{}
if
(
ptr
==
NULL
)
{
void
trnAppendRedoAction
(
STrans
*
pTrans
,
SEpSet
*
pEpSet
,
void
*
pMsg
)
{}
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
void
trnAppendUndoAction
(
STrans
*
pTrans
,
SEpSet
*
pEpSet
,
void
*
pMsg
)
{}
}
return
0
;
}
int32_t
trnAppendUndoLog
(
STrans
*
pTrans
,
SSdbRawData
*
pRaw
)
{
void
*
ptr
=
taosArrayPush
(
pTrans
->
undoLogs
,
&
pRaw
);
if
(
ptr
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
return
0
;
}
int32_t
trnAppendCommitLog
(
STrans
*
pTrans
,
SSdbRawData
*
pRaw
)
{
void
*
ptr
=
taosArrayPush
(
pTrans
->
commitLogs
,
&
pRaw
);
if
(
ptr
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
return
0
;
}
int32_t
trnAppendRedoAction
(
STrans
*
pTrans
,
SEpSet
*
pEpSet
,
void
*
pMsg
)
{
void
*
ptr
=
taosArrayPush
(
pTrans
->
redoActions
,
&
pMsg
);
if
(
ptr
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
return
0
;
}
int32_t
trnAppendUndoAction
(
STrans
*
pTrans
,
SEpSet
*
pEpSet
,
void
*
pMsg
)
{
void
*
ptr
=
taosArrayPush
(
pTrans
->
undoActions
,
&
pMsg
);
if
(
ptr
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
}
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录