Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0901640b
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看板
提交
0901640b
编写于
7月 06, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make snapshot compile
上级
35fb7bbd
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
23 addition
and
9 deletion
+23
-9
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+1
-1
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+2
-0
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+5
-1
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+8
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+4
-2
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+3
-4
未找到文件。
include/libs/transport/trpc.h
浏览文件 @
0901640b
...
...
@@ -27,7 +27,7 @@ extern "C" {
#define TAOS_CONN_SERVER 0
#define TAOS_CONN_CLIENT 1
#define IsReq(pMsg) (pMsg->msgType & 1U)
#define IsReq(pMsg)
(pMsg->msgType & 1U)
extern
int32_t
tsRpcHeadSize
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
0901640b
...
...
@@ -212,7 +212,9 @@ typedef struct {
struct
SVState
{
int64_t
committed
;
int64_t
applied
;
int64_t
applyTerm
;
int64_t
commitID
;
int64_t
commitTerm
;
};
struct
SVnodeInfo
{
...
...
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
0901640b
...
...
@@ -223,6 +223,7 @@ int vnodeCommit(SVnode *pVnode) {
// save info
info
.
config
=
pVnode
->
config
;
info
.
state
.
committed
=
pVnode
->
state
.
applied
;
info
.
state
.
commitTerm
=
pVnode
->
state
.
applyTerm
;
info
.
state
.
commitID
=
pVnode
->
state
.
commitID
;
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
TD_DIRSEP
,
pVnode
->
path
);
if
(
vnodeSaveInfo
(
dir
,
&
info
)
<
0
)
{
...
...
@@ -270,7 +271,7 @@ int vnodeCommit(SVnode *pVnode) {
ASSERT
(
0
);
return
-
1
;
}
pVnode
->
state
.
committed
=
info
.
state
.
committed
;
// postCommit
...
...
@@ -316,6 +317,7 @@ static int vnodeEncodeState(const void *pObj, SJson *pJson) {
if
(
tjsonAddIntegerToObject
(
pJson
,
"commit version"
,
pState
->
committed
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"commit ID"
,
pState
->
commitID
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"commit term"
,
pState
->
commitTerm
)
<
0
)
return
-
1
;
return
0
;
}
...
...
@@ -328,6 +330,8 @@ static int vnodeDecodeState(const SJson *pJson, void *pObj) {
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"commit ID"
,
pState
->
commitID
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"commit term"
,
pState
->
commitTerm
,
code
);
if
(
code
<
0
)
return
-
1
;
return
0
;
}
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
0901640b
...
...
@@ -79,8 +79,10 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
strcpy
(
pVnode
->
path
,
path
);
pVnode
->
config
=
info
.
config
;
pVnode
->
state
.
committed
=
info
.
state
.
committed
;
pVnode
->
state
.
commitTerm
=
info
.
state
.
commitTerm
;
pVnode
->
state
.
applied
=
info
.
state
.
committed
;
pVnode
->
state
.
commitID
=
info
.
state
.
commitID
;
pVnode
->
state
.
commitTerm
=
info
.
state
.
commitTerm
;
pVnode
->
pTfs
=
pTfs
;
pVnode
->
msgCb
=
msgCb
;
pVnode
->
blockCount
=
0
;
...
...
@@ -194,4 +196,9 @@ void vnodeStop(SVnode *pVnode) {}
int64_t
vnodeGetSyncHandle
(
SVnode
*
pVnode
)
{
return
pVnode
->
sync
;
}
void
vnodeGetSnapshot
(
SVnode
*
pVnode
,
SSnapshot
*
pSnapshot
)
{
pSnapshot
->
lastApplyIndex
=
pVnode
->
state
.
committed
;
}
void
vnodeGetSnapshot
(
SVnode
*
pVnode
,
SSnapshot
*
pSnapshot
)
{
pSnapshot
->
data
=
NULL
;
pSnapshot
->
lastApplyIndex
=
pVnode
->
state
.
committed
;
pSnapshot
->
lastApplyTerm
=
pVnode
->
state
.
commitTerm
;
pSnapshot
->
lastConfigIndex
=
-
1
;
}
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
0901640b
...
...
@@ -143,6 +143,7 @@ int32_t vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
version
);
pVnode
->
state
.
applied
=
version
;
pVnode
->
state
.
applyTerm
=
pMsg
->
info
.
conn
.
applyTerm
;
// skip header
pReq
=
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
));
...
...
@@ -169,7 +170,7 @@ int32_t vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRp
if
(
vnodeProcessDropTbReq
(
pVnode
,
version
,
pReq
,
len
,
pRsp
)
<
0
)
goto
_err
;
break
;
case
TDMT_VND_DROP_TTL_TABLE
:
//if (vnodeProcessDropTtlTbReq(pVnode, version, pReq, len, pRsp) < 0) goto _err;
//
if (vnodeProcessDropTtlTbReq(pVnode, version, pReq, len, pRsp) < 0) goto _err;
break
;
case
TDMT_VND_CREATE_SMA
:
{
if
(
vnodeProcessCreateTSmaReq
(
pVnode
,
version
,
pReq
,
len
,
pRsp
)
<
0
)
goto
_err
;
...
...
@@ -799,7 +800,8 @@ _exit:
taosArrayDestroy
(
submitRsp
.
pArray
);
// TODO: the partial success scenario and the error case
// => If partial success, extract the success submitted rows and reconstruct a new submit msg, and push to level 1/level 2.
// => If partial success, extract the success submitted rows and reconstruct a new submit msg, and push to level
// 1/level 2.
// TODO: refactor
if
((
terrno
==
TSDB_CODE_SUCCESS
)
&&
(
pRsp
->
code
==
TSDB_CODE_SUCCESS
))
{
tdProcessRSmaSubmit
(
pVnode
->
pSma
,
pReq
,
STREAM_INPUT__DATA_SUBMIT
);
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
0901640b
...
...
@@ -432,20 +432,19 @@ static void vnodeSyncRollBackMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta
static
int32_t
vnodeSnapshotStartRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pParam
,
void
**
ppReader
)
{
SVnode
*
pVnode
=
pFsm
->
data
;
SSnapshotParam
*
pSnapshotParam
=
pParam
;
int32_t
code
=
vnodeSnapshotReaderOpen
(
pVnode
,
(
SVSnapshotReader
**
)
ppReader
,
pSnapshotParam
->
start
,
pSnapshotParam
->
end
);
int32_t
code
=
vnodeSnapReaderOpen
(
pVnode
,
pSnapshotParam
->
start
,
pSnapshotParam
->
end
,
(
SVSnapReader
**
)
ppReader
);
return
code
;
}
static
int32_t
vnodeSnapshotStopRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
)
{
SVnode
*
pVnode
=
pFsm
->
data
;
int32_t
code
=
vnodeSnap
shot
ReaderClose
(
pReader
);
int32_t
code
=
vnodeSnapReaderClose
(
pReader
);
return
code
;
}
static
int32_t
vnodeSnapshotDoRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
,
void
**
ppBuf
,
int32_t
*
len
)
{
SVnode
*
pVnode
=
pFsm
->
data
;
int32_t
code
=
vnodeSnap
shotRead
(
pReader
,
(
const
void
**
)
ppBuf
,
len
);
int32_t
code
=
vnodeSnap
Read
(
pReader
,
(
uint8_t
**
)
ppBuf
,
len
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录