Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a13f9acf
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a13f9acf
编写于
10月 13, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1652
上级
8edc164c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
24 addition
and
11 deletion
+24
-11
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+3
-0
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+6
-5
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+3
-2
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+11
-4
未找到文件。
src/dnode/src/dnodeVWrite.c
浏览文件 @
a13f9acf
...
...
@@ -244,6 +244,9 @@ static void *dnodeProcessWriteQueue(void *param) {
}
int32_t
code
=
vnodeProcessWrite
(
pVnode
,
type
,
pHead
,
pRspRet
);
dTrace
(
"%p, wal msg:%s is processed in vwrite queue, version:%"
PRIu64
", result:%s"
,
pHead
,
taosMsg
[
pHead
->
msgType
],
pHead
->
version
,
tstrerror
(
code
));
if
(
pWrite
)
{
pWrite
->
rpcMsg
.
code
=
code
;
if
(
code
<=
0
)
pWrite
->
processedCount
=
1
;
...
...
src/inc/taoserror.h
浏览文件 @
a13f9acf
...
...
@@ -247,6 +247,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, 0, 0x080B, "CPU cores
// sync
TAOS_DEFINE_ERROR
(
TSDB_CODE_SYN_INVALID_CONFIG
,
0
,
0x0900
,
"Invalid Sync Configuration"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SYN_NOT_ENABLED
,
0
,
0x0901
,
"Sync module not enabled"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SYN_INVALID_VERSION
,
0
,
0x0902
,
"Invalid sync version"
)
// wal
TAOS_DEFINE_ERROR
(
TSDB_CODE_WAL_APP_ERROR
,
0
,
0x1000
,
"Unexpected generic error in wal"
)
...
...
src/sync/src/syncMain.c
浏览文件 @
a13f9acf
...
...
@@ -341,18 +341,19 @@ int32_t syncForwardToPeer(void *param, void *data, void *mhandle, int qtype) {
pPeer
=
pNode
->
peerInfo
[
i
];
syncRestartConnection
(
pPeer
);
}
return
TSDB_CODE_SYN_INVALID_VERSION
;
}
else
{
// always update version
nodeVersion
=
pWalHead
->
version
;
sDebug
(
"vgId:%d, update version, replica:%d nodeRole:%d qtype:%d ver:%"
PRIu64
,
pNode
->
vgId
,
pNode
->
replica
,
nodeRole
,
qtype
,
pWalHead
->
version
);
sDebug
(
"vgId:%d, update version, replica:%d nodeRole:%s qtype:%d ver:%"
PRIu64
,
pNode
->
vgId
,
pNode
->
replica
,
syncRole
[
nodeRole
],
qtype
,
pWalHead
->
version
);
return
TSDB_CODE_SUCCESS
;
}
return
0
;
}
nodeVersion
=
pWalHead
->
version
;
sDebug
(
"vgId:%d, forward will send, replica:%d nodeRole:%
d
qtype:%d ver:%"
PRIu64
,
pNode
->
vgId
,
pNode
->
replica
,
nodeRole
,
qtype
,
pWalHead
->
version
);
sDebug
(
"vgId:%d, forward will send, replica:%d nodeRole:%
s
qtype:%d ver:%"
PRIu64
,
pNode
->
vgId
,
pNode
->
replica
,
syncRole
[
nodeRole
]
,
qtype
,
pWalHead
->
version
);
// only pkt from RPC or CQ can be forwarded
if
(
qtype
!=
TAOS_QTYPE_RPC
&&
qtype
!=
TAOS_QTYPE_CQ
)
return
0
;
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
a13f9acf
...
...
@@ -59,8 +59,9 @@ int32_t vnodeProcessRead(void *param, SReadMsg *pReadMsg) {
// TODO: Later, let slave to support query
// if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) {
if
(
pVnode
->
role
!=
TAOS_SYNC_ROLE_SLAVE
&&
pVnode
->
role
!=
TAOS_SYNC_ROLE_MASTER
)
{
vDebug
(
"vgId:%d, msgType:%s not processed, replica:%d role:%d"
,
pVnode
->
vgId
,
taosMsg
[
msgType
],
pVnode
->
syncCfg
.
replica
,
pVnode
->
role
);
if
(
pVnode
->
role
!=
TAOS_SYNC_ROLE_SLAVE
&&
pVnode
->
role
!=
TAOS_SYNC_ROLE_MASTER
)
{
vDebug
(
"vgId:%d, msgType:%s not processed, replica:%d role:%s"
,
pVnode
->
vgId
,
taosMsg
[
msgType
],
pVnode
->
syncCfg
.
replica
,
syncRole
[
pVnode
->
role
]);
return
TSDB_CODE_APP_NOT_READY
;
}
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
a13f9acf
...
...
@@ -71,7 +71,8 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
}
if
(
pVnode
->
role
!=
TAOS_SYNC_ROLE_MASTER
)
{
vDebug
(
"vgId:%d, msgType:%s not processed, replica:%d role:%d"
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
],
pVnode
->
syncCfg
.
replica
,
pVnode
->
role
);
vDebug
(
"vgId:%d, msgType:%s not processed, replica:%d role:%s"
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
],
pVnode
->
syncCfg
.
replica
,
syncRole
[
pVnode
->
role
]);
return
TSDB_CODE_APP_NOT_READY
;
}
...
...
@@ -85,18 +86,24 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
if
(
pHead
->
version
<=
pVnode
->
version
)
return
0
;
}
int64_t
lastVersion
=
pVnode
->
version
;
pVnode
->
version
=
pHead
->
version
;
// write into WAL
code
=
walWrite
(
pVnode
->
wal
,
pHead
);
if
(
code
<
0
)
return
code
;
// forward to peers, even it is WAL/FWD, it shall be called to update version in sync
// forward to peers, even it is WAL/FWD, it shall be called to update version in sync
int32_t
syncCode
=
0
;
syncCode
=
syncForwardToPeer
(
pVnode
->
sync
,
pHead
,
item
,
qtype
);
if
(
syncCode
<
0
)
return
syncCode
;
if
(
syncCode
<
0
)
{
pVnode
->
version
=
lastVersion
;
vError
(
"vgId:%d, msgType:%s not processed, reason:%s, wal ver:%"
PRIu64
" restore to last ver:%"
PRIu64
,
pVnode
->
vgId
,
taosMsg
[
pHead
->
msgType
],
tstrerror
(
syncCode
),
pHead
->
version
,
pVnode
->
version
);
return
syncCode
;
}
// write data locally
// write data locally
code
=
(
*
vnodeProcessWriteMsgFp
[
pHead
->
msgType
])(
pVnode
,
pHead
->
cont
,
item
);
if
(
code
<
0
)
return
code
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录