Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6cd9d270
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
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看板
提交
6cd9d270
编写于
3月 22, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more TDB
上级
d5afc724
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
1 addition
and
149 deletion
+1
-149
source/libs/tdb/src/db/tdbBtree.c
source/libs/tdb/src/db/tdbBtree.c
+1
-149
未找到文件。
source/libs/tdb/src/db/tdbBtree.c
浏览文件 @
6cd9d270
...
...
@@ -498,150 +498,6 @@ static int tdbBtreeBalanceDeeper(SBTree *pBt, SPage *pRoot, SPage **ppChild) {
return
0
;
}
static
int
tdbBtreeBalanceStep1
(
SBtreeBalanceHelper
*
pBlh
)
{
int
nCells
;
int
i
;
int
idxStart
;
int
nChild
;
int
ret
;
SPage
*
pParent
;
SPgno
pgno
;
SCell
*
pCell
;
SCellDecoder
cd
;
SBTree
*
pBt
;
pParent
=
pBlh
->
pParent
;
nCells
=
TDB_PAGE_TOTAL_CELLS
(
pParent
);
nChild
=
nCells
+
1
;
pBt
=
pBlh
->
pBt
;
// TODO: ASSERT below needs to be removed
ASSERT
(
pParent
->
nOverflow
==
0
);
ASSERT
(
pBlh
->
idx
<=
nCells
);
if
(
nChild
<
3
)
{
idxStart
=
0
;
pBlh
->
nOld
=
nChild
;
}
else
{
if
(
pBlh
->
idx
==
0
)
{
idxStart
=
0
;
}
else
if
(
pBlh
->
idx
==
nCells
)
{
idxStart
=
pBlh
->
idx
-
2
;
}
else
{
idxStart
=
pBlh
->
idx
-
1
;
}
pBlh
->
nOld
=
3
;
}
i
=
pBlh
->
nOld
-
1
;
if
(
idxStart
+
i
==
nCells
)
{
// pgno = ((SBtPageHdr *)(pParent->pAmHdr))[0].rChild;
}
else
{
pCell
=
tdbPageGetCell
(
pParent
,
idxStart
+
i
);
// TODO: no need to decode the payload part, and even the kLen, vLen part
// we only need the pgno part
ret
=
tdbBtreeDecodeCell
(
pParent
,
pCell
,
&
cd
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
pgno
=
cd
.
pgno
;
}
for
(;;)
{
ret
=
tdbPagerFetchPage
(
pBt
->
pPager
,
pgno
,
&
(
pBlh
->
pOldPages
[
i
]),
tdbBtreeInitPage
,
pBt
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
// Loop over
if
((
i
--
)
==
0
)
break
;
{
// TODO
// ASSERT(0);
}
}
return
0
;
}
static
int
tdbBtreeBalanceStep2
(
SBtreeBalanceHelper
*
pBlh
)
{
#if 0
SPage *pPage;
int oidx;
int cidx;
int limit;
SCell *pCell;
for (int i = 0; i < pBlh->nOld; i++) {
pPage = pBlh->pOldPages[i];
oidx = 0;
cidx = 0;
if (oidx < pPage->nOverflow) {
limit = pPage->aiOvfl[oidx];
} else {
limit = pPage->pPageHdr->nCells;
}
// Loop to copy each cell pointer out
for (;;) {
if (oidx >= pPage->nOverflow && cidx >= pPage->pPageHdr->nCells) break;
if (cidx < limit) {
// Get local cells
pCell = tdbPageGetCell(pPage, cidx);
} else if (cidx == limit) {
// Get overflow cells
pCell = pPage->apOvfl[oidx++];
if (oidx < pPage->nOverflow) {
limit = pPage->aiOvfl[oidx];
} else {
limit = pPage->pPageHdr->nCells;
}
} else {
ASSERT(0);
}
}
{
// TODO: Copy divider cells here
}
}
/* TODO */
#endif
return
0
;
}
static
int
tdbBtreeBalanceStep3
(
SBtreeBalanceHelper
*
pBlh
)
{
// Figure out number of pages needed after balance
for
(
int
i
=
0
;
i
<
pBlh
->
nOld
;
i
++
)
{
/* TODO */
}
return
0
;
}
static
int
tdbBtreeBalanceStep4
(
SBtreeBalanceHelper
*
pBlh
)
{
// TODO
return
0
;
}
static
int
tdbBtreeBalanceStep5
(
SBtreeBalanceHelper
*
pBlh
)
{
// TODO
return
0
;
}
static
int
tdbBtreeBalanceStep6
(
SBtreeBalanceHelper
*
pBlh
)
{
// TODO
return
0
;
}
static
int
tdbBtreeBalanceNonRoot
(
SBTree
*
pBt
,
SPage
*
pParent
,
int
idx
)
{
int
ret
;
...
...
@@ -771,11 +627,7 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
}
{
// TODO: Reset states
}
{
// TODO: Clear resources
// Do the actual redistribute
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录