Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8e491c30
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看板
提交
8e491c30
编写于
6月 30, 2023
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tdb/recyle-ofp: nullize ofp's pager to mark uninitailized
上级
0ec80ff4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
12 deletion
+30
-12
source/libs/tdb/src/db/tdbBtree.c
source/libs/tdb/src/db/tdbBtree.c
+27
-10
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+3
-2
未找到文件。
source/libs/tdb/src/db/tdbBtree.c
浏览文件 @
8e491c30
...
...
@@ -1320,6 +1320,10 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader,
return
-
1
;
}
if
(
pDecoder
->
ofps
)
{
taosArrayPush
(
pDecoder
->
ofps
,
&
ofp
);
}
ofpCell
=
tdbPageGetCell
(
ofp
,
0
);
if
(
nLeft
<=
ofp
->
maxLocal
-
sizeof
(
SPgno
))
{
...
...
@@ -1354,11 +1358,16 @@ static int tdbBtreeDecodePayload(SPage *pPage, const SCell *pCell, int nHeader,
int
lastKeyPageSpace
=
0
;
// load left key & val to ovpages
while
(
pgno
!=
0
)
{
tdbTrace
(
"tdb decode-ofp, pTxn: %p, pgno:%u by cell:%p"
,
pTxn
,
pgno
,
pCell
);
ret
=
tdbLoadOvflPage
(
&
pgno
,
&
ofp
,
pTxn
,
pBt
);
if
(
ret
<
0
)
{
return
-
1
;
}
if
(
pDecoder
->
ofps
)
{
taosArrayPush
(
pDecoder
->
ofps
,
&
ofp
);
}
ofpCell
=
tdbPageGetCell
(
ofp
,
0
);
int
lastKeyPage
=
0
;
...
...
@@ -1567,27 +1576,21 @@ static int tdbBtreeCellSize(const SPage *pPage, SCell *pCell, int dropOfp, TXN *
bytes
=
ofp
->
maxLocal
-
sizeof
(
SPgno
);
}
SPgno
origPgno
=
pgno
;
//
SPgno origPgno = pgno;
memcpy
(
&
pgno
,
ofpCell
+
bytes
,
sizeof
(
pgno
));
/*
ret = tdbPagerWrite(pBt->pPager, ofp);
if (ret < 0) {
tdbError("failed to write page since %s", terrstr());
return -1;
}
// tdbPageDropCell(ofp, 0, pTxn, pBt);
// tdbPageZero(ofp, sizeof(SLeafHdr), tdbBtreeCellSize);
// tdbPageZero(ofp, sizeof(SIntHdr), tdbBtreeCellSize);
tdbPageDropCell(ofp, 0, pTxn, pBt);
*/
// SIntHdr *pIntHdr = (SIntHdr *)(ofp->pData);
// pIntHdr->flags = TDB_FLAG_ADD(0, TDB_BTREE_OVFL);
// pIntHdr->pgno = 0;
// ofp->pPager = NULL;
tdbPagerInsertFreePage
(
pBt
->
pPager
,
ofp
,
pTxn
);
// printf("tdb recycle, pTxn: %p, pgno:%u\n", pTxn, pgno);
tdbTrace
(
"tdb recycle, pTxn: %p, pgno:%u"
,
pTxn
,
origPgno
);
tdbPagerReturnPage
(
pPage
->
pPager
,
ofp
,
pTxn
);
nLeft
-=
bytes
;
...
...
@@ -2100,6 +2103,9 @@ int tdbBtcDelete(SBTC *pBtc) {
return
-
1
;
}
// btc.coder.ofps = taosArrayInit(8, sizeof(SPgno));
pBtc
->
coder
.
ofps
=
taosArrayInit
(
8
,
sizeof
(
SPage
*
));
tdbPageDropCell
(
pBtc
->
pPage
,
idx
,
pBtc
->
pTxn
,
pBtc
->
pBt
);
// update interior page or do balance
...
...
@@ -2155,6 +2161,17 @@ int tdbBtcDelete(SBTC *pBtc) {
}
}
SArray
*
ofps
=
pBtc
->
coder
.
ofps
;
if
(
ofps
)
{
for
(
int
i
=
0
;
i
<
TARRAY_SIZE
(
ofps
);
++
i
)
{
SPage
*
ofp
=
*
(
SPage
**
)
taosArrayGet
(
ofps
,
i
);
// tdbPagerInsertFreePage(pBtc->pBt->pPager, ofp, pBtc->pTxn);
}
taosArrayDestroy
(
ofps
);
pBtc
->
coder
.
ofps
=
NULL
;
}
return
0
;
}
...
...
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
8e491c30
...
...
@@ -720,7 +720,8 @@ int tdbPagerInsertFreePage(SPager *pPager, SPage *pPage, TXN *pTxn) {
int
code
=
0
;
SPgno
pgno
=
TDB_PAGE_PGNO
(
pPage
);
// tdbError("tdb/insert-free-page: tbc get page: %d.", pgno);
// memset(pPage->pData, 0, pPage->pageSize);
tdbTrace
(
"tdb/insert-free-page: tbc recycle page: %d."
,
pgno
);
code
=
tdbTbInsert
(
pPager
->
pEnv
->
pFreeDb
,
&
pgno
,
sizeof
(
pgno
),
NULL
,
0
,
pTxn
);
if
(
code
<
0
)
{
tdbError
(
"tdb/insert-free-page: tb insert failed with ret: %d."
,
code
);
...
...
@@ -763,7 +764,7 @@ static int tdbPagerRemoveFreePage(SPager *pPager, SPgno *pPgno, TXN *pTxn) {
}
*
pPgno
=
*
(
SPgno
*
)
pKey
;
// tdbError
("tdb/remove-free-page: tbc get page: %d.", *pPgno);
tdbTrace
(
"tdb/remove-free-page: tbc get page: %d."
,
*
pPgno
);
code
=
tdbTbcDelete
(
pCur
);
if
(
code
<
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录