Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
976cf60b
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
976cf60b
编写于
3月 09, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more TDB
上级
f9c09351
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
125 addition
and
68 deletion
+125
-68
source/libs/tdb/CMakeLists.txt
source/libs/tdb/CMakeLists.txt
+1
-0
source/libs/tdb/src/db/tdbBtree.c
source/libs/tdb/src/db/tdbBtree.c
+124
-68
未找到文件。
source/libs/tdb/CMakeLists.txt
浏览文件 @
976cf60b
...
...
@@ -8,6 +8,7 @@ target_sources(tdb
"src/db/tdbBtree.c"
"src/db/tdbDb.c"
"src/db/tdbEnv.c"
"src/db/tdbPage.c"
)
target_include_directories
(
...
...
source/libs/tdb/src/db/tdbBtree.c
浏览文件 @
976cf60b
...
...
@@ -405,6 +405,16 @@ static int tdbBtreeInitPage(SPage *pPage, void *arg) {
}
#ifndef TDB_BTREE_BALANCE
typedef
struct
{
SBTree
*
pBt
;
SPage
*
pParent
;
int
idx
;
i8
nOldPages
;
SPage
*
pOldPages
[
3
];
i8
nNewPages
;
SPage
*
pNewPages
[
5
];
}
SBtreeBalanceHelper
;
static
int
tdbBtreeCopyPageContent
(
SPage
*
pFrom
,
SPage
*
pTo
)
{
/* TODO */
...
...
@@ -450,20 +460,8 @@ static int tdbBtreeBalanceDeeper(SBTree *pBt, SPage *pRoot, SPage **ppChild) {
return
0
;
}
static
int
tdbBtreeBalanceNonRoot
(
SBTree
*
pBt
,
SPage
*
pParent
,
int
idx
)
{
int
nOldPages
;
SPage
*
pOldPages
[
3
];
int
nNewPages
;
SPage
*
pNewPages
[
5
];
void
*
pCell
;
SPgno
pgno
;
int
i
;
int
nDiv
;
int
ret
;
SPage
*
pPage
;
void
*
pCellDiv
[
2
];
{
static
int
tdbBtreeBalanceStep1
(
SBtreeBalanceHelper
*
pBlh
)
{
#if 0
// TODO: Find three or less sibling pages on either side
i = pParent->pPageHdr->nCells + pParent->nOverflow;
if (i < 1) {
...
...
@@ -516,26 +514,84 @@ static int tdbBtreeBalanceNonRoot(SBTree *pBt, SPage *pParent, int idx) {
}
/* code */
}
#endif
return
0
;
}
static
int
tdbBtreeBalanceStep2
(
SBtreeBalanceHelper
*
pBlh
)
{
// TODO
return
0
;
}
static
int
tdbBtreeBalanceStep3
(
SBtreeBalanceHelper
*
pBlh
)
{
// 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
;
SBtreeBalanceHelper
blh
;
blh
.
pBt
=
pBt
;
blh
.
pParent
=
pParent
;
blh
.
idx
=
idx
;
// Step 1: find two sibling pages and get engough info about the old pages
ret
=
tdbBtreeBalanceStep1
(
&
blh
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
{
// TODO: Load all cells on the old page and the divider cells
// Step 2: Load all cells on the old page and the divider cells
ret
=
tdbBtreeBalanceStep2
(
&
blh
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
{
// TODO: Get the number of pages needed to hold all cells
// Step 3: Get the number of pages needed to hold all cells
ret
=
tdbBtreeBalanceStep3
(
&
blh
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
{
// TODO: Allocate enough new pages. Reuse old pages as much as possible
// Step 4: Allocate enough new pages. Reuse old pages as much as possible
ret
=
tdbBtreeBalanceStep4
(
&
blh
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
{
// TODO: Insert new divider cells into pParent
// Step 5: Insert new divider cells into pParent
ret
=
tdbBtreeBalanceStep5
(
&
blh
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
{
// TODO: Update the sibling pages
// Step 6: Update the sibling pages
ret
=
tdbBtreeBalanceStep6
(
&
blh
);
if
(
ret
<
0
)
{
ASSERT
(
0
);
return
-
1
;
}
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录