Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e7476679
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,发现更多精彩内容 >>
提交
e7476679
编写于
12月 20, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
0896bcf7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
55 addition
and
51 deletion
+55
-51
source/dnode/vnode/impl/CMakeLists.txt
source/dnode/vnode/impl/CMakeLists.txt
+1
-1
source/dnode/vnode/impl/inc/vnodeDef.h
source/dnode/vnode/impl/inc/vnodeDef.h
+1
-0
source/dnode/vnode/impl/src/vnodeCommit.c
source/dnode/vnode/impl/src/vnodeCommit.c
+2
-1
source/dnode/vnode/impl/src/vnodeMain.c
source/dnode/vnode/impl/src/vnodeMain.c
+3
-0
source/dnode/vnode/impl/src/vnodeWrite.c
source/dnode/vnode/impl/src/vnodeWrite.c
+48
-49
未找到文件。
source/dnode/vnode/impl/CMakeLists.txt
浏览文件 @
e7476679
...
...
@@ -19,5 +19,5 @@ target_link_libraries(
# test
if
(
${
BUILD_TEST
}
)
#
add_subdirectory(test)
add_subdirectory
(
test
)
endif
(
${
BUILD_TEST
}
)
\ No newline at end of file
source/dnode/vnode/impl/inc/vnodeDef.h
浏览文件 @
e7476679
...
...
@@ -71,6 +71,7 @@ struct SVnode {
SWal
*
pWal
;
SVnodeSync
*
pSync
;
SVnodeFS
*
pFs
;
tsem_t
canCommit
;
};
int
vnodeScheduleTask
(
SVnodeTask
*
task
);
...
...
source/dnode/vnode/impl/src/vnodeCommit.c
浏览文件 @
e7476679
...
...
@@ -38,9 +38,10 @@ int vnodeCommit(void *arg) {
metaCommit
(
pVnode
->
pMeta
);
tqCommit
(
pVnode
->
pTq
);
tsdbCommit
(
pVnode
->
pT
q
);
tsdbCommit
(
pVnode
->
pT
sdb
);
vnodeBufPoolRecycle
(
pVnode
);
tsem_post
(
&
(
pVnode
->
canCommit
));
// TODO
return
0
;
}
...
...
source/dnode/vnode/impl/src/vnodeMain.c
浏览文件 @
e7476679
...
...
@@ -74,11 +74,14 @@ static SVnode *vnodeNew(const char *path, const SVnodeCfg *pVnodeCfg) {
pVnode
->
path
=
strdup
(
path
);
vnodeOptionsCopy
(
&
(
pVnode
->
config
),
pVnodeCfg
);
tsem_init
(
&
(
pVnode
->
canCommit
),
0
,
1
);
return
pVnode
;
}
static
void
vnodeFree
(
SVnode
*
pVnode
)
{
if
(
pVnode
)
{
tsem_destroy
(
&
(
pVnode
->
canCommit
));
tfree
(
pVnode
->
path
);
free
(
pVnode
);
}
...
...
source/dnode/vnode/impl/src/vnodeWrite.c
浏览文件 @
e7476679
...
...
@@ -31,14 +31,14 @@ int vnodeProcessNoWalWMsgs(SVnode *pVnode, SRpcMsg *pMsg) {
}
int
vnodeProcessWMsgs
(
SVnode
*
pVnode
,
SArray
*
pMsgs
)
{
SRpcMsg
*
pMsg
;
SRpcMsg
*
pMsg
;
SVnodeReq
*
pVnodeReq
;
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pMsgs
);
i
++
)
{
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pMsgs
,
i
);
// ser request version
void
*
pBuf
=
pMsg
->
pCont
;
void
*
pBuf
=
pMsg
->
pCont
;
int64_t
ver
=
pVnode
->
state
.
processed
++
;
taosEncodeFixedU64
(
&
pBuf
,
ver
);
...
...
@@ -52,65 +52,64 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) {
// Apply each request now
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pMsgs
);
i
++
)
{
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pMsgs
,
i
);
SVnodeReq
vReq
;
// Apply the request
{
void
*
ptr
=
vnodeMalloc
(
pVnode
,
pMsg
->
contLen
);
if
(
ptr
==
NULL
)
{
// TODO: handle error
}
// TODO: Now we just need a
vnodeApplyWMsg
(
pVnode
,
pMsg
,
NULL
);
}
return
0
;
}
int
vnodeApplyWMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
SVnodeReq
vReq
;
void
*
ptr
=
vnodeMalloc
(
pVnode
,
pMsg
->
contLen
);
if
(
ptr
==
NULL
)
{
// TODO: handle error
}
// TODO: copy here need to be extended
memcpy
(
ptr
,
pMsg
->
pCont
,
pMsg
->
contLen
);
// TODO: copy here need to be extended
memcpy
(
ptr
,
pMsg
->
pCont
,
pMsg
->
contLen
);
// todo: change the interface here
uint64_t
ver
;
taosDecodeFixedU64
(
pMsg
->
pCont
,
&
ver
);
if
(
tqPushMsg
(
pVnode
->
pTq
,
ptr
,
ver
)
<
0
)
{
// TODO: handle error
}
// todo: change the interface here
uint64_t
ver
;
taosDecodeFixedU64
(
pMsg
->
pCont
,
&
ver
);
if
(
tqPushMsg
(
pVnode
->
pTq
,
ptr
,
ver
)
<
0
)
{
vnodeParseReq
(
pMsg
->
pCont
,
&
vReq
,
pMsg
->
msgType
);
switch
(
pMsg
->
msgType
)
{
case
TSDB_MSG_TYPE_CREATE_TABLE
:
if
(
metaCreateTable
(
pVnode
->
pMeta
,
&
(
vReq
.
ctReq
))
<
0
)
{
// TODO: handle error
}
vnodeParseReq
(
pMsg
->
pCont
,
&
vReq
,
pMsg
->
msgType
);
switch
(
pMsg
->
msgType
)
{
case
TSDB_MSG_TYPE_CREATE_TABLE
:
if
(
metaCreateTable
(
pVnode
->
pMeta
,
&
(
vReq
.
ctReq
))
<
0
)
{
// TODO: handle error
}
// TODO: maybe need to clear the requst struct
break
;
case
TSDB_MSG_TYPE_DROP_TABLE
:
if
(
metaDropTable
(
pVnode
->
pMeta
,
vReq
.
dtReq
.
uid
)
<
0
)
{
// TODO: handle error
}
break
;
case
TSDB_MSG_TYPE_SUBMIT
:
if
(
tsdbInsertData
(
pVnode
->
pTsdb
,
(
SSubmitMsg
*
)
ptr
)
<
0
)
{
// TODO: handle error
}
break
;
default:
break
;
// TODO: maybe need to clear the requst struct
break
;
case
TSDB_MSG_TYPE_DROP_TABLE
:
if
(
metaDropTable
(
pVnode
->
pMeta
,
vReq
.
dtReq
.
uid
)
<
0
)
{
// TODO: handle error
}
pVnode
->
state
.
applied
=
ver
;
}
// Check if it needs to commit
if
(
vnodeShouldCommit
(
pVnode
))
{
if
(
vnodeAsyncCommit
(
pVnode
)
<
0
)
{
break
;
case
TSDB_MSG_TYPE_SUBMIT
:
if
(
tsdbInsertData
(
pVnode
->
pTsdb
,
(
SSubmitMsg
*
)
ptr
)
<
0
)
{
// TODO: handle error
}
}
break
;
default:
break
;
}
return
0
;
}
pVnode
->
state
.
applied
=
ver
;
int
vnodeApplyWMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
// TODO
// Check if it needs to commit
if
(
vnodeShouldCommit
(
pVnode
))
{
tsem_wait
(
&
(
pVnode
->
canCommit
));
if
(
vnodeAsyncCommit
(
pVnode
)
<
0
)
{
// TODO: handle error
}
}
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录