Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2a203472
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2a203472
编写于
12月 04, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more code
上级
df6eb27b
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
29 addition
and
27 deletion
+29
-27
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+8
-2
source/dnode/vnode/src/sma/smaCommit.c
source/dnode/vnode/src/sma/smaCommit.c
+9
-9
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+9
-9
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+3
-7
未找到文件。
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
2a203472
...
@@ -75,6 +75,7 @@ typedef struct SStreamStateWriter SStreamStateWriter;
...
@@ -75,6 +75,7 @@ typedef struct SStreamStateWriter SStreamStateWriter;
typedef
struct
SRSmaSnapReader
SRSmaSnapReader
;
typedef
struct
SRSmaSnapReader
SRSmaSnapReader
;
typedef
struct
SRSmaSnapWriter
SRSmaSnapWriter
;
typedef
struct
SRSmaSnapWriter
SRSmaSnapWriter
;
typedef
struct
SSnapDataHdr
SSnapDataHdr
;
typedef
struct
SSnapDataHdr
SSnapDataHdr
;
typedef
struct
SCommitInfo
SCommitInfo
;
#define VNODE_META_DIR "meta"
#define VNODE_META_DIR "meta"
#define VNODE_TSDB_DIR "tsdb"
#define VNODE_TSDB_DIR "tsdb"
...
@@ -147,7 +148,7 @@ int tsdbOpen(SVnode* pVnode, STsdb** ppTsdb, const char* dir, STsdbKeepCfg*
...
@@ -147,7 +148,7 @@ int tsdbOpen(SVnode* pVnode, STsdb** ppTsdb, const char* dir, STsdbKeepCfg*
int
tsdbClose
(
STsdb
**
pTsdb
);
int
tsdbClose
(
STsdb
**
pTsdb
);
int32_t
tsdbBegin
(
STsdb
*
pTsdb
);
int32_t
tsdbBegin
(
STsdb
*
pTsdb
);
int32_t
tsdbPrepareCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbPrepareCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbCommit
(
STsdb
*
pTsdb
,
SCommitInfo
*
pInfo
);
int32_t
tsdbFinishCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbFinishCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbRollbackCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbRollbackCommit
(
STsdb
*
pTsdb
);
int32_t
tsdbDoRetention
(
STsdb
*
pTsdb
,
int64_t
now
);
int32_t
tsdbDoRetention
(
STsdb
*
pTsdb
,
int64_t
now
);
...
@@ -205,7 +206,7 @@ int32_t smaSyncPreCommit(SSma* pSma);
...
@@ -205,7 +206,7 @@ int32_t smaSyncPreCommit(SSma* pSma);
int32_t
smaSyncCommit
(
SSma
*
pSma
);
int32_t
smaSyncCommit
(
SSma
*
pSma
);
int32_t
smaSyncPostCommit
(
SSma
*
pSma
);
int32_t
smaSyncPostCommit
(
SSma
*
pSma
);
int32_t
smaPreCommit
(
SSma
*
pSma
);
int32_t
smaPreCommit
(
SSma
*
pSma
);
int32_t
smaCommit
(
SSma
*
pSma
);
int32_t
smaCommit
(
SSma
*
pSma
,
SCommitInfo
*
pInfo
);
int32_t
smaFinishCommit
(
SSma
*
pSma
);
int32_t
smaFinishCommit
(
SSma
*
pSma
);
int32_t
smaPostCommit
(
SSma
*
pSma
);
int32_t
smaPostCommit
(
SSma
*
pSma
);
int32_t
smaDoRetention
(
SSma
*
pSma
,
int64_t
now
);
int32_t
smaDoRetention
(
SSma
*
pSma
,
int64_t
now
);
...
@@ -407,6 +408,11 @@ struct SSnapDataHdr {
...
@@ -407,6 +408,11 @@ struct SSnapDataHdr {
uint8_t
data
[];
uint8_t
data
[];
};
};
struct
SCommitInfo
{
SVnodeInfo
info
;
SVnode
*
pVnode
;
};
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/vnode/src/sma/smaCommit.c
浏览文件 @
2a203472
...
@@ -23,7 +23,7 @@ static int32_t tdProcessRSmaSyncCommitImpl(SSma *pSma);
...
@@ -23,7 +23,7 @@ static int32_t tdProcessRSmaSyncCommitImpl(SSma *pSma);
static int32_t tdProcessRSmaSyncPostCommitImpl(SSma *pSma);
static int32_t tdProcessRSmaSyncPostCommitImpl(SSma *pSma);
#endif
#endif
static
int32_t
tdProcessRSmaAsyncPreCommitImpl
(
SSma
*
pSma
);
static
int32_t
tdProcessRSmaAsyncPreCommitImpl
(
SSma
*
pSma
);
static
int32_t
tdProcessRSmaAsyncCommitImpl
(
SSma
*
pSma
);
static
int32_t
tdProcessRSmaAsyncCommitImpl
(
SSma
*
pSma
,
SCommitInfo
*
pInfo
);
static
int32_t
tdProcessRSmaAsyncPostCommitImpl
(
SSma
*
pSma
);
static
int32_t
tdProcessRSmaAsyncPostCommitImpl
(
SSma
*
pSma
);
static
int32_t
tdUpdateQTaskInfoFiles
(
SSma
*
pSma
,
SRSmaStat
*
pRSmaStat
);
static
int32_t
tdUpdateQTaskInfoFiles
(
SSma
*
pSma
,
SRSmaStat
*
pRSmaStat
);
...
@@ -67,7 +67,7 @@ int32_t smaPreCommit(SSma *pSma) { return tdProcessRSmaAsyncPreCommitImpl(pSma);
...
@@ -67,7 +67,7 @@ int32_t smaPreCommit(SSma *pSma) { return tdProcessRSmaAsyncPreCommitImpl(pSma);
* @param pSma
* @param pSma
* @return int32_t
* @return int32_t
*/
*/
int32_t
smaCommit
(
SSma
*
pSma
)
{
return
tdProcessRSmaAsyncCommitImpl
(
pSma
);
}
int32_t
smaCommit
(
SSma
*
pSma
,
SCommitInfo
*
pInfo
)
{
return
tdProcessRSmaAsyncCommitImpl
(
pSma
,
pInfo
);
}
/**
/**
* @brief async commit, only applicable to Rollup SMA
* @brief async commit, only applicable to Rollup SMA
...
@@ -387,7 +387,7 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) {
...
@@ -387,7 +387,7 @@ static int32_t tdProcessRSmaAsyncPreCommitImpl(SSma *pSma) {
* @param pSma
* @param pSma
* @return int32_t
* @return int32_t
*/
*/
static
int32_t
tdProcessRSmaAsyncCommitImpl
(
SSma
*
pSma
)
{
static
int32_t
tdProcessRSmaAsyncCommitImpl
(
SSma
*
pSma
,
SCommitInfo
*
pInfo
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
SVnode
*
pVnode
=
pSma
->
pVnode
;
SVnode
*
pVnode
=
pSma
->
pVnode
;
#if 0
#if 0
...
@@ -399,11 +399,11 @@ static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma) {
...
@@ -399,11 +399,11 @@ static int32_t tdProcessRSmaAsyncCommitImpl(SSma *pSma) {
}
}
#endif
#endif
if
((
code
=
tsdbCommit
(
VND_RSMA1
(
pVnode
)))
<
0
)
{
if
((
code
=
tsdbCommit
(
VND_RSMA1
(
pVnode
)
,
pInfo
))
<
0
)
{
smaError
(
"vgId:%d, failed to commit tsdb rsma1 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
code
));
smaError
(
"vgId:%d, failed to commit tsdb rsma1 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
code
));
goto
_exit
;
goto
_exit
;
}
}
if
((
code
=
tsdbCommit
(
VND_RSMA2
(
pVnode
)))
<
0
)
{
if
((
code
=
tsdbCommit
(
VND_RSMA2
(
pVnode
)
,
pInfo
))
<
0
)
{
smaError
(
"vgId:%d, failed to commit tsdb rsma2 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
code
));
smaError
(
"vgId:%d, failed to commit tsdb rsma2 since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
code
));
goto
_exit
;
goto
_exit
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
2a203472
...
@@ -93,7 +93,7 @@ typedef struct {
...
@@ -93,7 +93,7 @@ typedef struct {
SArray
*
aDelData
;
// SArray<SDelData>
SArray
*
aDelData
;
// SArray<SDelData>
}
SCommitter
;
}
SCommitter
;
static
int32_t
tsdbStartCommit
(
STsdb
*
pTsdb
,
SCommitter
*
pCommitter
);
static
int32_t
tsdbStartCommit
(
STsdb
*
pTsdb
,
SCommitter
*
pCommitter
,
SCommitInfo
*
pInfo
);
static
int32_t
tsdbCommitData
(
SCommitter
*
pCommitter
);
static
int32_t
tsdbCommitData
(
SCommitter
*
pCommitter
);
static
int32_t
tsdbCommitDel
(
SCommitter
*
pCommitter
);
static
int32_t
tsdbCommitDel
(
SCommitter
*
pCommitter
);
static
int32_t
tsdbCommitCache
(
SCommitter
*
pCommitter
);
static
int32_t
tsdbCommitCache
(
SCommitter
*
pCommitter
);
...
@@ -160,7 +160,7 @@ int32_t tsdbPrepareCommit(STsdb *pTsdb) {
...
@@ -160,7 +160,7 @@ int32_t tsdbPrepareCommit(STsdb *pTsdb) {
return
0
;
return
0
;
}
}
int32_t
tsdbCommit
(
STsdb
*
pTsdb
)
{
int32_t
tsdbCommit
(
STsdb
*
pTsdb
,
SCommitInfo
*
pInfo
)
{
if
(
!
pTsdb
)
return
0
;
if
(
!
pTsdb
)
return
0
;
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -179,7 +179,7 @@ int32_t tsdbCommit(STsdb *pTsdb) {
...
@@ -179,7 +179,7 @@ int32_t tsdbCommit(STsdb *pTsdb) {
}
}
// start commit
// start commit
code
=
tsdbStartCommit
(
pTsdb
,
&
commith
);
code
=
tsdbStartCommit
(
pTsdb
,
&
commith
,
pInfo
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// commit impl
// commit impl
...
@@ -816,7 +816,7 @@ _exit:
...
@@ -816,7 +816,7 @@ _exit:
}
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
static
int32_t
tsdbStartCommit
(
STsdb
*
pTsdb
,
SCommitter
*
pCommitter
)
{
static
int32_t
tsdbStartCommit
(
STsdb
*
pTsdb
,
SCommitter
*
pCommitter
,
SCommitInfo
*
pInfo
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
int32_t
lino
=
0
;
int32_t
lino
=
0
;
...
@@ -824,13 +824,13 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) {
...
@@ -824,13 +824,13 @@ static int32_t tsdbStartCommit(STsdb *pTsdb, SCommitter *pCommitter) {
ASSERT
(
pTsdb
->
imem
&&
"last tsdb commit incomplete"
);
ASSERT
(
pTsdb
->
imem
&&
"last tsdb commit incomplete"
);
pCommitter
->
pTsdb
=
pTsdb
;
pCommitter
->
pTsdb
=
pTsdb
;
pCommitter
->
commitID
=
p
Tsdb
->
pVnode
->
state
.
commitID
;
pCommitter
->
commitID
=
p
Info
->
info
.
state
.
commitID
;
pCommitter
->
minutes
=
pTsdb
->
keepCfg
.
days
;
pCommitter
->
minutes
=
pTsdb
->
keepCfg
.
days
;
pCommitter
->
precision
=
pTsdb
->
keepCfg
.
precision
;
pCommitter
->
precision
=
pTsdb
->
keepCfg
.
precision
;
pCommitter
->
minRow
=
p
Tsdb
->
pVnode
->
config
.
tsdbCfg
.
minRows
;
pCommitter
->
minRow
=
p
Info
->
info
.
config
.
tsdbCfg
.
minRows
;
pCommitter
->
maxRow
=
p
Tsdb
->
pVnode
->
config
.
tsdbCfg
.
maxRows
;
pCommitter
->
maxRow
=
p
Info
->
info
.
config
.
tsdbCfg
.
maxRows
;
pCommitter
->
cmprAlg
=
p
Tsdb
->
pVnode
->
config
.
tsdbCfg
.
compression
;
pCommitter
->
cmprAlg
=
p
Info
->
info
.
config
.
tsdbCfg
.
compression
;
pCommitter
->
sttTrigger
=
p
Tsdb
->
pVnode
->
config
.
sttTrigger
;
pCommitter
->
sttTrigger
=
p
Info
->
info
.
config
.
sttTrigger
;
pCommitter
->
aTbDataP
=
tsdbMemTableGetTbDataArray
(
pTsdb
->
imem
);
pCommitter
->
aTbDataP
=
tsdbMemTableGetTbDataArray
(
pTsdb
->
imem
);
if
(
pCommitter
->
aTbDataP
==
NULL
)
{
if
(
pCommitter
->
aTbDataP
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
2a203472
...
@@ -14,11 +14,7 @@
...
@@ -14,11 +14,7 @@
*/
*/
#include "vnd.h"
#include "vnd.h"
#include "vnodeInt.h"
typedef
struct
{
SVnodeInfo
info
;
SVnode
*
pVnode
;
}
SCommitInfo
;
#define VND_INFO_FNAME "vnode.json"
#define VND_INFO_FNAME "vnode.json"
#define VND_INFO_FNAME_TMP "vnode_tmp.json"
#define VND_INFO_FNAME_TMP "vnode_tmp.json"
...
@@ -291,11 +287,11 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
...
@@ -291,11 +287,11 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
code
=
tsdbCommit
(
pVnode
->
pTsdb
);
code
=
tsdbCommit
(
pVnode
->
pTsdb
,
pInfo
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
VND_IS_RSMA
(
pVnode
))
{
if
(
VND_IS_RSMA
(
pVnode
))
{
code
=
smaCommit
(
pVnode
->
pSma
);
code
=
smaCommit
(
pVnode
->
pSma
,
pInfo
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录