Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
167657c1
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,发现更多精彩内容 >>
提交
167657c1
编写于
4月 19, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: sync
上级
eeb45f21
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
31 deletion
+38
-31
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+30
-27
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+4
-2
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+2
-2
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+2
-0
未找到文件。
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
167657c1
...
...
@@ -97,7 +97,7 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
static
void
vmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
int64_t
version
;
SRpcMsg
rsp
;
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SNodeMsg
*
));
if
(
pArray
==
NULL
)
{
...
...
@@ -116,13 +116,15 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
}
}
#if 1
int64_t
version
;
vnodePreprocessWriteReqs
(
pVnode
->
pImpl
,
pArray
,
&
version
);
numOfMsgs
=
taosArrayGetSize
(
pArray
);
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
SNodeMsg
*
pMsg
=
*
(
SNodeMsg
**
)
taosArrayGet
(
pArray
,
i
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
SRpcMsg
rsp
;
rsp
.
pCont
=
NULL
;
rsp
.
contLen
=
0
;
...
...
@@ -132,20 +134,9 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
int32_t
code
=
vnodeProcessWriteReq
(
pVnode
->
pImpl
,
pRpc
,
version
++
,
&
rsp
);
tmsgSendRsp
(
&
rsp
);
#if 0
if (pRsp != NULL) {
pRsp->ahandle = pRpc->ahandle;
taosMemoryFree(pRsp);
} else {
if (code != 0 && terrno != 0) code = terrno;
vmSendRsp(pVnode->pWrapper, pMsg, code);
}
#endif
}
#else
// sync integration response
/*
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pArray
);
i
++
)
{
SNodeMsg
*
pMsg
;
SRpcMsg
*
pRpc
;
...
...
@@ -153,18 +144,18 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
pMsg
=
*
(
SNodeMsg
**
)
taosArrayGet
(
pArray
,
i
);
pRpc
=
&
pMsg
->
rpcMsg
;
// set request version
void *pBuf = POINTER_SHIFT(pRpc->pCont, sizeof(SMsgHead));
// int64_t ver = pVnode->pImpl->state.processed++; // ???????
int64_t ver;
taosEncodeFixedI64(&pBuf, ver);
rsp
.
ahandle
=
pRpc
->
ahandle
;
rsp
.
handle
=
pRpc
->
handle
;
rsp
.
pCont
=
NULL
;
rsp
.
contLen
=
0
;
int32_t ret = syncPropose(
pVnode->pImpl->sync
, pRpc, false);
int32_t
ret
=
syncPropose
(
vnodeGetSyncHandle
(
pVnode
->
pImpl
)
,
pRpc
,
false
);
if
(
ret
==
TAOS_SYNC_PROPOSE_NOT_LEADER
)
{
// not leader
// send response
rsp
.
code
=
-
1
;
tmsgSendRsp
(
&
rsp
);
}
else
if
(
ret
==
TAOS_SYNC_PROPOSE_OTHER_ERROR
)
{
// send response
rsp
.
code
=
-
2
;
tmsgSendRsp
(
&
rsp
);
}
else
if
(
ret
==
TAOS_SYNC_PROPOSE_SUCCESS
)
{
// ok
// send response in applyQ
...
...
@@ -172,7 +163,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
assert
(
0
);
}
}
*/
#endif
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
SNodeMsg
*
pMsg
=
*
(
SNodeMsg
**
)
taosArrayGet
(
pArray
,
i
);
...
...
@@ -187,13 +178,25 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
static
void
vmProcessApplyQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SNodeMsg
*
pMsg
=
NULL
;
SRpcMsg
rsp
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
#if 0
taosGetQitem(qall, (void **)&pMsg);
// todo
SRpcMsg
*
pRsp
=
NULL
;
// (void)vnodeProcessWriteReq(pVnode->pImpl, &pMsg->rpcMsg, &pRsp);
if (pMsg->rpcMsg.handle != NULL && pMsg->rpcMsg.ahandle != NULL) {
rsp.ahandle = pMsg->rpcMsg.ahandle;
rsp.handle = pMsg->rpcMsg.handle;
rsp.code = 0;
rsp.pCont = NULL;
rsp.contLen = 0;
if (vnodeProcessWriteReq(pVnode->pImpl, &pMsg->rpcMsg, &rsp) < 0) {
rsp.code = terrno;
tmsgSendRsp(&rsp);
}
}
#endif
}
}
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
167657c1
...
...
@@ -21,10 +21,10 @@
#include "tqueue.h"
#include "trpc.h"
#include "sync.h"
#include "tarray.h"
#include "tfs.h"
#include "wal.h"
#include "sync.h"
#include "tcommon.h"
#include "tfs.h"
...
...
@@ -61,6 +61,8 @@ int32_t vnodeSync(SVnode *pVnode);
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
);
int
vnodeValidateTableHash
(
SVnodeCfg
*
pVnodeOptions
,
char
*
tableFName
);
int64_t
vnodeGetSyncHandle
(
SVnode
*
pVnode
);
// meta
typedef
struct
SMeta
SMeta
;
// todo: remove
typedef
struct
SMTbCursor
SMTbCursor
;
...
...
@@ -148,7 +150,7 @@ struct SVnodeCfg {
bool
isWeak
;
STsdbCfg
tsdbCfg
;
SWalCfg
walCfg
;
SSyncCfg
syncCfg
;
// sync integration
SSyncCfg
syncCfg
;
// sync integration
uint32_t
hashBegin
;
uint32_t
hashEnd
;
int8_t
hashMethod
;
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
167657c1
...
...
@@ -54,8 +54,8 @@ typedef struct SQWorkerMgmt SQHandle;
#define VNODE_META_DIR "meta"
#define VNODE_TSDB_DIR "tsdb"
#define VNODE_TQ_DIR "tq"
#define VNODE_WAL_DIR "wal"
#define VNODE_TQ_DIR
"tq"
#define VNODE_WAL_DIR
"wal"
typedef
struct
{
int8_t
streamType
;
// sma or other
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
167657c1
...
...
@@ -165,3 +165,5 @@ void vnodeClose(SVnode *pVnode) {
taosMemoryFree
(
pVnode
);
}
}
int64_t
vnodeGetSyncHandle
(
SVnode
*
pVnode
)
{
return
pVnode
->
sync
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录