Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6f48a60b
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看板
未验证
提交
6f48a60b
编写于
5月 29, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
5月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13197 from taosdata/fix/mnode
refactor: mnode snapshot
上级
03ad46c0
edb7a2c0
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
43 addition
and
35 deletion
+43
-35
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+43
-34
source/dnode/mnode/sdb/src/sdbFile.c
source/dnode/mnode/sdb/src/sdbFile.c
+0
-1
未找到文件。
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
6f48a60b
...
@@ -68,37 +68,11 @@ void mndRestoreFinish(struct SSyncFSM *pFsm) {
...
@@ -68,37 +68,11 @@ void mndRestoreFinish(struct SSyncFSM *pFsm) {
mInfo
(
"mnode sync restore finished"
);
mInfo
(
"mnode sync restore finished"
);
mndTransPullup
(
pMnode
);
mndTransPullup
(
pMnode
);
mndSetRestore
(
pMnode
,
true
);
mndSetRestore
(
pMnode
,
true
);
}
else
{
mInfo
(
"mnode sync restore finished, and will set ready after first deploy"
);
}
}
}
}
int32_t
mndSnapshotRead
(
struct
SSyncFSM
*
pFsm
,
const
SSnapshot
*
pSnapshot
,
void
**
ppIter
,
char
**
ppBuf
,
int32_t
*
len
)
{
SMnode
*
pMnode
=
pFsm
->
data
;
mInfo
(
"start to read snapshot from sdb"
);
// sdbStartRead
// sdbDoRead
// sdbStopRead
return
0
;
}
int32_t
mndSnapshotApply
(
struct
SSyncFSM
*
pFsm
,
const
SSnapshot
*
pSnapshot
,
char
*
pBuf
,
int32_t
len
)
{
SMnode
*
pMnode
=
pFsm
->
data
;
// sdbStartWrite
// sdbDoWrite
mndSetRestore
(
pMnode
,
false
);
mInfo
(
"start to apply snapshot to sdb"
);
// sdbStopWrite
mInfo
(
"successfully to apply snapshot to sdb"
);
mndSetRestore
(
pMnode
,
true
);
// taosMemoryFree(pBuf);
return
0
;
}
void
mndReConfig
(
struct
SSyncFSM
*
pFsm
,
SSyncCfg
newCfg
,
SReConfigCbMeta
cbMeta
)
{
void
mndReConfig
(
struct
SSyncFSM
*
pFsm
,
SSyncCfg
newCfg
,
SReConfigCbMeta
cbMeta
)
{
SMnode
*
pMnode
=
pFsm
->
data
;
SMnode
*
pMnode
=
pFsm
->
data
;
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
...
@@ -115,20 +89,55 @@ void mndReConfig(struct SSyncFSM *pFsm, SSyncCfg newCfg, SReConfigCbMeta cbMeta)
...
@@ -115,20 +89,55 @@ void mndReConfig(struct SSyncFSM *pFsm, SSyncCfg newCfg, SReConfigCbMeta cbMeta)
}
}
}
}
int32_t
mndSnapshotStartRead
(
struct
SSyncFSM
*
pFsm
,
void
**
ppReader
)
{
mInfo
(
"start to read snapshot from sdb"
);
SMnode
*
pMnode
=
pFsm
->
data
;
return
sdbStartRead
(
pMnode
->
pSdb
,
(
SSdbIter
**
)
ppReader
);
}
int32_t
mndSnapshotStopRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
)
{
mInfo
(
"stop to read snapshot from sdb"
);
SMnode
*
pMnode
=
pFsm
->
data
;
return
sdbStopRead
(
pMnode
->
pSdb
,
pReader
);
}
int32_t
mndSnapshotDoRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
,
void
**
ppBuf
,
int32_t
*
len
)
{
SMnode
*
pMnode
=
pFsm
->
data
;
return
sdbDoRead
(
pMnode
->
pSdb
,
pReader
,
ppBuf
,
len
);
}
int32_t
mndSnapshotStartWrite
(
struct
SSyncFSM
*
pFsm
,
void
**
ppWriter
)
{
mInfo
(
"start to apply snapshot to sdb"
);
SMnode
*
pMnode
=
pFsm
->
data
;
return
sdbStartWrite
(
pMnode
->
pSdb
,
(
SSdbIter
**
)
ppWriter
);
}
int32_t
mndSnapshotStopWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
bool
isApply
)
{
mInfo
(
"stop to apply snapshot to sdb, apply:%d"
,
isApply
);
SMnode
*
pMnode
=
pFsm
->
data
;
return
sdbStopWrite
(
pMnode
->
pSdb
,
pWriter
,
isApply
);
}
int32_t
mndSnapshotDoWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
void
*
pBuf
,
int32_t
len
)
{
SMnode
*
pMnode
=
pFsm
->
data
;
return
sdbDoWrite
(
pMnode
->
pSdb
,
pWriter
,
pBuf
,
len
);
}
SSyncFSM
*
mndSyncMakeFsm
(
SMnode
*
pMnode
)
{
SSyncFSM
*
mndSyncMakeFsm
(
SMnode
*
pMnode
)
{
SSyncFSM
*
pFsm
=
taosMemoryCalloc
(
1
,
sizeof
(
SSyncFSM
));
SSyncFSM
*
pFsm
=
taosMemoryCalloc
(
1
,
sizeof
(
SSyncFSM
));
memset
(
pFsm
,
0
,
sizeof
(
*
pFsm
));
pFsm
->
data
=
pMnode
;
pFsm
->
data
=
pMnode
;
pFsm
->
FpCommitCb
=
mndSyncCommitMsg
;
pFsm
->
FpCommitCb
=
mndSyncCommitMsg
;
pFsm
->
FpPreCommitCb
=
NULL
;
pFsm
->
FpPreCommitCb
=
NULL
;
pFsm
->
FpRollBackCb
=
NULL
;
pFsm
->
FpRollBackCb
=
NULL
;
pFsm
->
FpGetSnapshot
=
mndSyncGetSnapshot
;
pFsm
->
FpRestoreFinishCb
=
mndRestoreFinish
;
pFsm
->
FpRestoreFinishCb
=
mndRestoreFinish
;
pFsm
->
FpReConfigCb
=
mndReConfig
;
pFsm
->
FpReConfigCb
=
mndReConfig
;
pFsm
->
FpGetSnapshot
=
mndSyncGetSnapshot
;
pFsm
->
FpSnapshotStartRead
=
mndSnapshotStartRead
;
pFsm
->
FpSnapshotStopRead
=
mndSnapshotStopRead
;
pFsm
->
FpSnapshotDoRead
=
mndSnapshotDoRead
;
pFsm
->
FpSnapshotStartWrite
=
mndSnapshotStartWrite
;
pFsm
->
FpSnapshotStopWrite
=
mndSnapshotStopWrite
;
pFsm
->
FpSnapshotDoWrite
=
mndSnapshotDoWrite
;
return
pFsm
;
return
pFsm
;
}
}
...
...
source/dnode/mnode/sdb/src/sdbFile.c
浏览文件 @
6f48a60b
...
@@ -522,7 +522,6 @@ int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len) {
...
@@ -522,7 +522,6 @@ int32_t sdbDoRead(SSdb *pSdb, SSdbIter *pIter, void **ppBuf, int32_t *len) {
void
*
pBuf
=
taosMemoryCalloc
(
1
,
maxlen
);
void
*
pBuf
=
taosMemoryCalloc
(
1
,
maxlen
);
if
(
pBuf
==
NULL
)
{
if
(
pBuf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
sdbCloseIter
(
pIter
);
return
-
1
;
return
-
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录