Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c17f8244
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看板
提交
c17f8244
编写于
11月 07, 2022
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(tdb): new interface of meta prep async commit
上级
b8dd3843
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
69 addition
and
5 deletion
+69
-5
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-0
source/dnode/vnode/src/meta/metaCommit.c
source/dnode/vnode/src/meta/metaCommit.c
+1
-0
source/libs/tdb/inc/tdb.h
source/libs/tdb/inc/tdb.h
+1
-0
source/libs/tdb/src/db/tdbDb.c
source/libs/tdb/src/db/tdbDb.c
+18
-1
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+47
-4
source/libs/tdb/src/inc/tdbInt.h
source/libs/tdb/src/inc/tdbInt.h
+1
-0
未找到文件。
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
c17f8244
...
...
@@ -102,6 +102,7 @@ int metaClose(SMeta* pMeta);
int
metaBegin
(
SMeta
*
pMeta
,
int8_t
fromSys
);
int
metaCommit
(
SMeta
*
pMeta
);
int
metaFinishCommit
(
SMeta
*
pMeta
);
int
metaPrepareAsyncCommit
(
SMeta
*
pMeta
);
int
metaCreateSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
);
int
metaAlterSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
);
int
metaDropSTable
(
SMeta
*
pMeta
,
int64_t
verison
,
SVDropStbReq
*
pReq
,
SArray
*
tbUidList
);
...
...
source/dnode/vnode/src/meta/metaCommit.c
浏览文件 @
c17f8244
...
...
@@ -35,6 +35,7 @@ int metaBegin(SMeta *pMeta, int8_t fromSys) {
// commit the meta txn
int
metaCommit
(
SMeta
*
pMeta
)
{
return
tdbCommit
(
pMeta
->
pEnv
,
&
pMeta
->
txn
);
}
int
metaFinishCommit
(
SMeta
*
pMeta
)
{
return
tdbPostCommit
(
pMeta
->
pEnv
,
&
pMeta
->
txn
);
}
int
metaPrepareAsyncCommit
(
SMeta
*
pMeta
)
{
return
tdbPrepareAsyncCommit
(
pMeta
->
pEnv
,
&
pMeta
->
txn
);
}
// abort the meta txn
int
metaAbort
(
SMeta
*
pMeta
)
{
return
tdbAbort
(
pMeta
->
pEnv
,
&
pMeta
->
txn
);
}
source/libs/tdb/inc/tdb.h
浏览文件 @
c17f8244
...
...
@@ -36,6 +36,7 @@ int32_t tdbClose(TDB *pDb);
int32_t
tdbBegin
(
TDB
*
pDb
,
TXN
*
pTxn
);
int32_t
tdbCommit
(
TDB
*
pDb
,
TXN
*
pTxn
);
int32_t
tdbPostCommit
(
TDB
*
pDb
,
TXN
*
pTxn
);
int32_t
tdbPrepareAsyncCommit
(
TDB
*
pDb
,
TXN
*
pTxn
);
int32_t
tdbAbort
(
TDB
*
pDb
,
TXN
*
pTxn
);
int32_t
tdbAlter
(
TDB
*
pDb
,
int
pages
);
...
...
source/libs/tdb/src/db/tdbDb.c
浏览文件 @
c17f8244
...
...
@@ -138,7 +138,24 @@ int32_t tdbPostCommit(TDB *pDb, TXN *pTxn) {
for
(
pPager
=
pDb
->
pgrList
;
pPager
;
pPager
=
pPager
->
pNext
)
{
ret
=
tdbPagerPostCommit
(
pPager
,
pTxn
);
if
(
ret
<
0
)
{
tdbError
(
"failed to commit pager since %s. dbName:%s, txnId:%"
PRId64
,
tstrerror
(
terrno
),
pDb
->
dbName
,
pTxn
->
txnId
);
tdbError
(
"failed to commit pager since %s. dbName:%s, txnId:%"
PRId64
,
tstrerror
(
terrno
),
pDb
->
dbName
,
pTxn
->
txnId
);
return
-
1
;
}
}
return
0
;
}
int32_t
tdbPrepareAsyncCommit
(
TDB
*
pDb
,
TXN
*
pTxn
)
{
SPager
*
pPager
;
int
ret
;
for
(
pPager
=
pDb
->
pgrList
;
pPager
;
pPager
=
pPager
->
pNext
)
{
ret
=
tdbPagerPrepareAsyncCommit
(
pPager
,
pTxn
);
if
(
ret
<
0
)
{
tdbError
(
"failed to commit pager since %s. dbName:%s, txnId:%"
PRId64
,
tstrerror
(
terrno
),
pDb
->
dbName
,
pTxn
->
txnId
);
return
-
1
;
}
}
...
...
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
c17f8244
...
...
@@ -287,6 +287,10 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
return
-
1
;
}
return
0
;
}
int
tdbPagerPostCommit
(
SPager
*
pPager
,
TXN
*
pTxn
)
{
// remove the journal file
if
(
tdbOsClose
(
pPager
->
jfd
)
<
0
)
{
tdbError
(
"failed to close jfd due to %s. file:%s"
,
strerror
(
errno
),
pPager
->
jFileName
);
...
...
@@ -305,15 +309,54 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
return
0
;
}
int
tdbPagerPostCommit
(
SPager
*
pPager
,
TXN
*
pTxn
)
{
if
(
tdbOsRemove
(
pPager
->
jFileName
)
<
0
&&
errno
!=
ENOENT
)
{
tdbError
(
"failed to remove file due to %s. file:%s"
,
strerror
(
errno
),
pPager
->
jFileName
);
int
tdbPagerPrepareAsyncCommit
(
SPager
*
pPager
,
TXN
*
pTxn
)
{
SPage
*
pPage
;
int
ret
;
// sync the journal file
ret
=
tdbOsFSync
(
pPager
->
jfd
);
if
(
ret
<
0
)
{
tdbError
(
"failed to fsync jfd due to %s. jFileName:%s"
,
strerror
(
errno
),
pPager
->
jFileName
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
pPager
->
inTran
=
0
;
// loop to write the dirty pages to file
SRBTreeIter
iter
=
tRBTreeIterCreate
(
&
pPager
->
rbt
,
1
);
SRBTreeNode
*
pNode
=
NULL
;
while
((
pNode
=
tRBTreeIterNext
(
&
iter
))
!=
NULL
)
{
pPage
=
(
SPage
*
)
pNode
;
if
(
pPage
->
isLocal
)
continue
;
ret
=
tdbPagerWritePageToDB
(
pPager
,
pPage
);
if
(
ret
<
0
)
{
tdbError
(
"failed to write page to db since %s"
,
tstrerror
(
terrno
));
return
-
1
;
}
}
tdbTrace
(
"tdbttl commit:%p, %d/%d"
,
pPager
,
pPager
->
dbOrigSize
,
pPager
->
dbFileSize
);
pPager
->
dbOrigSize
=
pPager
->
dbFileSize
;
// release the page
iter
=
tRBTreeIterCreate
(
&
pPager
->
rbt
,
1
);
while
((
pNode
=
tRBTreeIterNext
(
&
iter
))
!=
NULL
)
{
pPage
=
(
SPage
*
)
pNode
;
if
(
pPage
->
isLocal
)
continue
;
pPage
->
isDirty
=
0
;
tRBTreeDrop
(
&
pPager
->
rbt
,
(
SRBTreeNode
*
)
pPage
);
tdbPCacheRelease
(
pPager
->
pCache
,
pPage
,
pTxn
);
}
/*
tRBTreeCreate(&pPager->rbt, pageCmpFn);
// sync the db file
if (tdbOsFSync(pPager->fd) < 0) {
tdbError("failed to fsync fd due to %s. file:%s", strerror(errno), pPager->dbFileName);
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
}
*/
return
0
;
}
...
...
source/libs/tdb/src/inc/tdbInt.h
浏览文件 @
c17f8244
...
...
@@ -191,6 +191,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage);
int
tdbPagerBegin
(
SPager
*
pPager
,
TXN
*
pTxn
);
int
tdbPagerCommit
(
SPager
*
pPager
,
TXN
*
pTxn
);
int
tdbPagerPostCommit
(
SPager
*
pPager
,
TXN
*
pTxn
);
int
tdbPagerPrepareAsyncCommit
(
SPager
*
pPager
,
TXN
*
pTxn
);
int
tdbPagerAbort
(
SPager
*
pPager
,
TXN
*
pTxn
);
int
tdbPagerFetchPage
(
SPager
*
pPager
,
SPgno
*
ppgno
,
SPage
**
ppPage
,
int
(
*
initPage
)(
SPage
*
,
void
*
,
int
),
void
*
arg
,
TXN
*
pTxn
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录