Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2015db57
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看板
提交
2015db57
编写于
10月 09, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
alter pages
上级
ff8e38d3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
98 addition
and
4 deletion
+98
-4
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+1
-0
source/dnode/vnode/src/meta/metaOpen.c
source/dnode/vnode/src/meta/metaOpen.c
+12
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+8
-1
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
+2
-0
source/libs/tdb/src/db/tdbPCache.c
source/libs/tdb/src/db/tdbPCache.c
+73
-3
source/libs/tdb/src/inc/tdbInt.h
source/libs/tdb/src/inc/tdbInt.h
+1
-0
未找到文件。
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
2015db57
...
...
@@ -111,6 +111,7 @@ SSchemaWrapper* metaGetTableSchema(SMeta* pMeta, tb_uid_t uid, int32_t sver, boo
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
);
int32_t
metaGetTbTSchemaEx
(
SMeta
*
pMeta
,
tb_uid_t
suid
,
tb_uid_t
uid
,
int32_t
sver
,
STSchema
**
ppTSchema
);
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
);
int
metaAlterCache
(
SMeta
*
pMeta
,
int32_t
nPage
);
tb_uid_t
metaGetTableEntryUidByName
(
SMeta
*
pMeta
,
const
char
*
name
);
int64_t
metaGetTbNum
(
SMeta
*
pMeta
);
...
...
source/dnode/vnode/src/meta/metaOpen.c
浏览文件 @
2015db57
...
...
@@ -197,6 +197,18 @@ int metaClose(SMeta *pMeta) {
return
0
;
}
int
metaAlterCache
(
SMeta
*
pMeta
,
int32_t
nPage
)
{
metaWLock
(
pMeta
);
if
(
tdbAlter
(
pMeta
->
pEnv
,
nPage
)
<
0
)
{
metaULock
(
pMeta
);
return
-
1
;
}
metaULock
(
pMeta
);
return
0
;
}
int32_t
metaRLock
(
SMeta
*
pMeta
)
{
int32_t
ret
=
0
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
2015db57
...
...
@@ -1047,7 +1047,14 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void
}
if
(
pVnode
->
config
.
szCache
!=
alterReq
.
pages
)
{
// TODO
if
(
metaAlterCache
(
pVnode
->
pMeta
,
alterReq
.
pages
)
<
0
)
{
vError
(
"vgId:%d failed to change vnode pages from %d to %d failed since %s"
,
TD_VID
(
pVnode
),
pVnode
->
config
.
szCache
,
alterReq
.
pages
,
tstrerror
(
errno
));
return
errno
;
}
else
{
vInfo
(
"vgId:%d vnode pages is changed from %d to %d"
,
TD_VID
(
pVnode
),
pVnode
->
config
.
szCache
,
alterReq
.
pages
);
pVnode
->
config
.
szCache
=
alterReq
.
pages
;
}
}
if
(
pVnode
->
config
.
cacheLast
!=
alterReq
.
cacheLast
)
{
...
...
source/libs/tdb/inc/tdb.h
浏览文件 @
2015db57
...
...
@@ -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
tdbAbort
(
TDB
*
pDb
,
TXN
*
pTxn
);
int32_t
tdbAlter
(
TDB
*
pDb
,
int
pages
);
// TTB
int32_t
tdbTbOpen
(
const
char
*
tbname
,
int
keyLen
,
int
valLen
,
tdb_cmpr_fn_t
keyCmprFn
,
TDB
*
pEnv
,
TTB
**
ppTb
);
...
...
source/libs/tdb/src/db/tdbDb.c
浏览文件 @
2015db57
...
...
@@ -97,6 +97,8 @@ int tdbClose(TDB *pDb) {
return
0
;
}
int32_t
tdbAlter
(
TDB
*
pDb
,
int
pages
)
{
return
tdbPCacheAlter
(
pDb
->
pCache
,
pages
);
}
int32_t
tdbBegin
(
TDB
*
pDb
,
TXN
*
pTxn
)
{
SPager
*
pPager
;
int
ret
;
...
...
source/libs/tdb/src/db/tdbPCache.c
浏览文件 @
2015db57
...
...
@@ -61,7 +61,11 @@ int tdbPCacheOpen(int pageSize, int cacheSize, SPCache **ppCache) {
pCache
->
szPage
=
pageSize
;
pCache
->
nPages
=
cacheSize
;
pCache
->
aPage
=
(
SPage
**
)
&
pCache
[
1
];
pCache
->
aPage
=
(
SPage
**
)
tdbOsCalloc
(
cacheSize
,
sizeof
(
SPage
*
));
if
(
pCache
->
aPage
==
NULL
)
{
tdbOsFree
(
pCache
);
return
-
1
;
}
if
(
tdbPCacheOpenImpl
(
pCache
)
<
0
)
{
tdbOsFree
(
pCache
);
...
...
@@ -75,11 +79,78 @@ int tdbPCacheOpen(int pageSize, int cacheSize, SPCache **ppCache) {
int
tdbPCacheClose
(
SPCache
*
pCache
)
{
if
(
pCache
)
{
tdbPCacheCloseImpl
(
pCache
);
tdbOsFree
(
pCache
->
aPage
);
tdbOsFree
(
pCache
);
}
return
0
;
}
// TODO:
// if (pPage->id >= pCache->nPages) {
// free(pPage);
// pCache->aPage[pPage->id] = NULL;
// } else {
// add to free list
// }
static
int
tdbPCacheAlterImpl
(
SPCache
*
pCache
,
int32_t
nPage
)
{
if
(
pCache
->
nPages
==
nPage
)
{
return
0
;
}
else
if
(
pCache
->
nPages
<
nPage
)
{
SPage
**
aPage
=
tdbOsCalloc
(
nPage
,
sizeof
(
SPage
*
));
if
(
aPage
==
NULL
)
{
return
-
1
;
}
for
(
int32_t
iPage
=
pCache
->
nPage
;
iPage
<
nPage
;
iPage
++
)
{
if
(
tdbPageCreate
(
pCache
->
szPage
,
&
aPage
[
iPage
],
tdbDefaultMalloc
,
NULL
)
<
0
)
{
// TODO: handle error
return
-
1
;
}
// pPage->pgid = 0;
aPage
[
iPage
]
->
isAnchor
=
0
;
aPage
[
iPage
]
->
isLocal
=
1
;
aPage
[
iPage
]
->
nRef
=
0
;
aPage
[
iPage
]
->
pHashNext
=
NULL
;
aPage
[
iPage
]
->
pLruNext
=
NULL
;
aPage
[
iPage
]
->
pLruPrev
=
NULL
;
aPage
[
iPage
]
->
pDirtyNext
=
NULL
;
// add page to free list
aPage
[
iPage
]
->
pFreeNext
=
pCache
->
pFree
;
pCache
->
pFree
=
aPage
[
iPage
];
pCache
->
nFree
++
;
// add to local list
aPage
[
iPage
]
->
id
=
iPage
;
}
for
(
int32_t
iPage
=
0
;
iPage
<
pCache
->
nPage
;
iPage
++
)
{
aPage
[
iPage
]
=
pCache
->
aPage
[
iPage
];
}
tdbOsFree
(
pCache
->
aPage
);
pCache
->
nFree
=
nPage
-
pCache
->
nPage
;
pCache
->
aPage
=
aPage
;
}
pCache
->
nPages
=
nPage
;
return
0
;
}
int
tdbPCacheAlter
(
SPCache
*
pCache
,
int32_t
nPage
)
{
int
ret
=
0
;
tdbPCacheLock
(
pCache
);
ret
=
tdbPCacheAlterImpl
(
pCache
,
nPage
);
tdbPCacheUnlock
(
pCache
);
return
ret
;
}
SPage
*
tdbPCacheFetch
(
SPCache
*
pCache
,
const
SPgid
*
pPgid
,
TXN
*
pTxn
)
{
SPage
*
pPage
;
i32
nRef
;
...
...
@@ -310,8 +381,7 @@ static int tdbPCacheOpenImpl(SPCache *pCache) {
pCache
->
nFree
=
0
;
pCache
->
pFree
=
NULL
;
for
(
int
i
=
0
;
i
<
pCache
->
nPages
;
i
++
)
{
ret
=
tdbPageCreate
(
pCache
->
szPage
,
&
pPage
,
tdbDefaultMalloc
,
NULL
);
if
(
ret
<
0
)
{
if
(
tdbPageCreate
(
pCache
->
szPage
,
&
pPage
,
tdbDefaultMalloc
,
NULL
)
<
0
)
{
// TODO: handle error
return
-
1
;
}
...
...
source/libs/tdb/src/inc/tdbInt.h
浏览文件 @
2015db57
...
...
@@ -216,6 +216,7 @@ int tdbPagerRestore(SPager *pPager, SBTree *pBt);
int
tdbPCacheOpen
(
int
pageSize
,
int
cacheSize
,
SPCache
**
ppCache
);
int
tdbPCacheClose
(
SPCache
*
pCache
);
int
tdbPCacheAlter
(
SPCache
*
pCache
,
int32_t
nPage
);
SPage
*
tdbPCacheFetch
(
SPCache
*
pCache
,
const
SPgid
*
pPgid
,
TXN
*
pTxn
);
void
tdbPCacheRelease
(
SPCache
*
pCache
,
SPage
*
pPage
,
TXN
*
pTxn
);
int
tdbPCacheGetPageSize
(
SPCache
*
pCache
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录