Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a1a2b833
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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,发现更多精彩内容 >>
提交
a1a2b833
编写于
7月 03, 2023
作者:
S
Shungang Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: ttl fill cache only in initialization
上级
db63b436
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
54 addition
and
49 deletion
+54
-49
source/dnode/vnode/src/inc/metaTtl.h
source/dnode/vnode/src/inc/metaTtl.h
+1
-1
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
+0
-4
source/dnode/vnode/src/meta/metaOpen.c
source/dnode/vnode/src/meta/metaOpen.c
+42
-39
source/dnode/vnode/src/meta/metaTtl.c
source/dnode/vnode/src/meta/metaTtl.c
+3
-3
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+7
-2
未找到文件。
source/dnode/vnode/src/inc/metaTtl.h
浏览文件 @
a1a2b833
...
...
@@ -81,7 +81,7 @@ typedef struct {
int
ttlMgrOpen
(
STtlManger
**
ppTtlMgr
,
TDB
*
pEnv
,
int8_t
rollback
);
int
ttlMgrClose
(
STtlManger
*
pTtlMgr
);
int
ttlMgr
Begi
n
(
STtlManger
*
pTtlMgr
,
void
*
pMeta
);
int
ttlMgr
PostOpe
n
(
STtlManger
*
pTtlMgr
,
void
*
pMeta
);
int
ttlMgrConvert
(
TTB
*
pOldTtlIdx
,
TTB
*
pNewTtlIdx
,
void
*
pMeta
);
int
ttlMgrFlush
(
STtlManger
*
pTtlMgr
,
TXN
*
pTxn
);
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
a1a2b833
...
...
@@ -136,6 +136,7 @@ typedef struct STbUidStore STbUidStore;
#define META_BEGIN_HEAP_NIL 2
int
metaOpen
(
SVnode
*
pVnode
,
SMeta
**
ppMeta
,
int8_t
rollback
);
int
metaPostOpen
(
SVnode
*
pVnode
,
SMeta
**
ppMeta
);
// for operations depend on "meta txn"
int
metaClose
(
SMeta
**
pMeta
);
int
metaBegin
(
SMeta
*
pMeta
,
int8_t
fromSys
);
TXN
*
metaGetTxn
(
SMeta
*
pMeta
);
...
...
source/dnode/vnode/src/meta/metaCommit.c
浏览文件 @
a1a2b833
...
...
@@ -40,10 +40,6 @@ int metaBegin(SMeta *pMeta, int8_t heap) {
return
-
1
;
}
if
(
ttlMgrBegin
(
pMeta
->
pTtlMgr
,
pMeta
)
<
0
)
{
return
-
1
;
}
tdbCommit
(
pMeta
->
pEnv
,
pMeta
->
txn
);
return
0
;
...
...
source/dnode/vnode/src/meta/metaOpen.c
浏览文件 @
a1a2b833
...
...
@@ -29,6 +29,8 @@ static int ncolIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen
static
int32_t
metaInitLock
(
SMeta
*
pMeta
)
{
return
taosThreadRwlockInit
(
&
pMeta
->
lock
,
NULL
);
}
static
int32_t
metaDestroyLock
(
SMeta
*
pMeta
)
{
return
taosThreadRwlockDestroy
(
&
pMeta
->
lock
);
}
static
void
metaCleanup
(
SMeta
**
ppMeta
);
int
metaOpen
(
SVnode
*
pVnode
,
SMeta
**
ppMeta
,
int8_t
rollback
)
{
SMeta
*
pMeta
=
NULL
;
int
ret
;
...
...
@@ -180,52 +182,27 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) {
return
0
;
_err:
if
(
pMeta
->
pIdx
)
metaCloseIdx
(
pMeta
);
if
(
pMeta
->
pStreamDb
)
tdbTbClose
(
pMeta
->
pStreamDb
);
if
(
pMeta
->
pNcolIdx
)
tdbTbClose
(
pMeta
->
pNcolIdx
);
if
(
pMeta
->
pBtimeIdx
)
tdbTbClose
(
pMeta
->
pBtimeIdx
);
if
(
pMeta
->
pSmaIdx
)
tdbTbClose
(
pMeta
->
pSmaIdx
);
if
(
pMeta
->
pTtlMgr
)
ttlMgrClose
(
pMeta
->
pTtlMgr
);
if
(
pMeta
->
pTagIvtIdx
)
indexClose
(
pMeta
->
pTagIvtIdx
);
if
(
pMeta
->
pTagIdx
)
tdbTbClose
(
pMeta
->
pTagIdx
);
if
(
pMeta
->
pCtbIdx
)
tdbTbClose
(
pMeta
->
pCtbIdx
);
if
(
pMeta
->
pSuidIdx
)
tdbTbClose
(
pMeta
->
pSuidIdx
);
if
(
pMeta
->
pNameIdx
)
tdbTbClose
(
pMeta
->
pNameIdx
);
if
(
pMeta
->
pUidIdx
)
tdbTbClose
(
pMeta
->
pUidIdx
);
if
(
pMeta
->
pSkmDb
)
tdbTbClose
(
pMeta
->
pSkmDb
);
if
(
pMeta
->
pTbDb
)
tdbTbClose
(
pMeta
->
pTbDb
);
if
(
pMeta
->
pEnv
)
tdbClose
(
pMeta
->
pEnv
);
metaDestroyLock
(
pMeta
);
taosMemoryFree
(
pMeta
);
metaCleanup
(
&
pMeta
);
return
-
1
;
}
int
meta
Close
(
SMeta
**
ppMeta
)
{
int
meta
PostOpen
(
SVnode
*
pVnode
,
SMeta
**
ppMeta
)
{
SMeta
*
pMeta
=
*
ppMeta
;
if
(
pMeta
)
{
if
(
pMeta
->
pEnv
)
metaAbort
(
pMeta
);
if
(
pMeta
->
pCache
)
metaCacheClose
(
pMeta
);
if
(
pMeta
->
pIdx
)
metaCloseIdx
(
pMeta
);
if
(
pMeta
->
pStreamDb
)
tdbTbClose
(
pMeta
->
pStreamDb
);
if
(
pMeta
->
pNcolIdx
)
tdbTbClose
(
pMeta
->
pNcolIdx
);
if
(
pMeta
->
pBtimeIdx
)
tdbTbClose
(
pMeta
->
pBtimeIdx
);
if
(
pMeta
->
pSmaIdx
)
tdbTbClose
(
pMeta
->
pSmaIdx
);
if
(
pMeta
->
pTtlMgr
)
ttlMgrClose
(
pMeta
->
pTtlMgr
);
if
(
pMeta
->
pTagIvtIdx
)
indexClose
(
pMeta
->
pTagIvtIdx
);
if
(
pMeta
->
pTagIdx
)
tdbTbClose
(
pMeta
->
pTagIdx
);
if
(
pMeta
->
pCtbIdx
)
tdbTbClose
(
pMeta
->
pCtbIdx
);
if
(
pMeta
->
pSuidIdx
)
tdbTbClose
(
pMeta
->
pSuidIdx
);
if
(
pMeta
->
pNameIdx
)
tdbTbClose
(
pMeta
->
pNameIdx
);
if
(
pMeta
->
pUidIdx
)
tdbTbClose
(
pMeta
->
pUidIdx
);
if
(
pMeta
->
pSkmDb
)
tdbTbClose
(
pMeta
->
pSkmDb
);
if
(
pMeta
->
pTbDb
)
tdbTbClose
(
pMeta
->
pTbDb
);
if
(
pMeta
->
pEnv
)
tdbClose
(
pMeta
->
pEnv
);
metaDestroyLock
(
pMeta
);
taosMemoryFreeClear
(
*
ppMeta
);
if
(
ttlMgrPostOpen
(
pMeta
->
pTtlMgr
,
pMeta
)
<
0
)
{
metaError
(
"vgId:%d, failed to post open meta ttl since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
}
return
0
;
_err:
metaCleanup
(
ppMeta
);
return
-
1
;
}
int
metaClose
(
SMeta
**
ppMeta
)
{
metaCleanup
(
ppMeta
);
return
0
;
}
int
metaAlterCache
(
SMeta
*
pMeta
,
int32_t
nPage
)
{
...
...
@@ -270,6 +247,32 @@ int32_t metaULock(SMeta *pMeta) {
return
ret
;
}
static
void
metaCleanup
(
SMeta
**
ppMeta
)
{
SMeta
*
pMeta
=
*
ppMeta
;
if
(
pMeta
)
{
if
(
pMeta
->
pEnv
)
metaAbort
(
pMeta
);
if
(
pMeta
->
pCache
)
metaCacheClose
(
pMeta
);
if
(
pMeta
->
pIdx
)
metaCloseIdx
(
pMeta
);
if
(
pMeta
->
pStreamDb
)
tdbTbClose
(
pMeta
->
pStreamDb
);
if
(
pMeta
->
pNcolIdx
)
tdbTbClose
(
pMeta
->
pNcolIdx
);
if
(
pMeta
->
pBtimeIdx
)
tdbTbClose
(
pMeta
->
pBtimeIdx
);
if
(
pMeta
->
pSmaIdx
)
tdbTbClose
(
pMeta
->
pSmaIdx
);
if
(
pMeta
->
pTtlMgr
)
ttlMgrClose
(
pMeta
->
pTtlMgr
);
if
(
pMeta
->
pTagIvtIdx
)
indexClose
(
pMeta
->
pTagIvtIdx
);
if
(
pMeta
->
pTagIdx
)
tdbTbClose
(
pMeta
->
pTagIdx
);
if
(
pMeta
->
pCtbIdx
)
tdbTbClose
(
pMeta
->
pCtbIdx
);
if
(
pMeta
->
pSuidIdx
)
tdbTbClose
(
pMeta
->
pSuidIdx
);
if
(
pMeta
->
pNameIdx
)
tdbTbClose
(
pMeta
->
pNameIdx
);
if
(
pMeta
->
pUidIdx
)
tdbTbClose
(
pMeta
->
pUidIdx
);
if
(
pMeta
->
pSkmDb
)
tdbTbClose
(
pMeta
->
pSkmDb
);
if
(
pMeta
->
pTbDb
)
tdbTbClose
(
pMeta
->
pTbDb
);
if
(
pMeta
->
pEnv
)
tdbClose
(
pMeta
->
pEnv
);
metaDestroyLock
(
pMeta
);
taosMemoryFreeClear
(
*
ppMeta
);
}
}
static
int
tbDbKeyCmpr
(
const
void
*
pKey1
,
int
kLen1
,
const
void
*
pKey2
,
int
kLen2
)
{
STbDbKey
*
pTbDbKey1
=
(
STbDbKey
*
)
pKey1
;
STbDbKey
*
pTbDbKey2
=
(
STbDbKey
*
)
pKey2
;
...
...
source/dnode/vnode/src/meta/metaTtl.c
浏览文件 @
a1a2b833
...
...
@@ -79,8 +79,8 @@ int ttlMgrClose(STtlManger *pTtlMgr) {
return
0
;
}
int
ttlMgr
Begi
n
(
STtlManger
*
pTtlMgr
,
void
*
pMeta
)
{
metaInfo
(
"ttl mgr start open"
);
int
ttlMgr
PostOpe
n
(
STtlManger
*
pTtlMgr
,
void
*
pMeta
)
{
metaInfo
(
"ttl mgr start
post
open"
);
int
ret
;
int64_t
startNs
=
taosGetTimestampNs
();
...
...
@@ -112,7 +112,7 @@ int ttlMgrBegin(STtlManger *pTtlMgr, void *pMeta) {
int64_t
endNs
=
taosGetTimestampNs
();
metaInfo
(
"ttl mgr open end, hash size: %d, time consumed: %"
PRId64
" ns"
,
taosHashGetSize
(
pTtlMgr
->
pTtlCache
),
metaInfo
(
"ttl mgr
post
open end, hash size: %d, time consumed: %"
PRId64
" ns"
,
taosHashGetSize
(
pTtlMgr
->
pTtlCache
),
endNs
-
startNs
);
_out:
return
ret
;
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
a1a2b833
...
...
@@ -76,7 +76,7 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, STfs *p
}
SSyncCfg
*
pCfg
=
&
info
.
config
.
syncCfg
;
pCfg
->
replicaNum
=
0
;
pCfg
->
totalReplicaNum
=
0
;
memset
(
&
pCfg
->
nodeInfo
,
0
,
sizeof
(
pCfg
->
nodeInfo
));
...
...
@@ -109,7 +109,7 @@ int32_t vnodeAlterReplica(const char *path, SAlterVnodeReplicaReq *pReq, STfs *p
pCfg
->
myIndex
=
pReq
->
replica
+
pReq
->
learnerSelfIndex
;
}
vInfo
(
"vgId:%d, save config while alter, replicas:%d totalReplicas:%d selfIndex:%d"
,
vInfo
(
"vgId:%d, save config while alter, replicas:%d totalReplicas:%d selfIndex:%d"
,
pReq
->
vgId
,
pCfg
->
replicaNum
,
pCfg
->
totalReplicaNum
,
pCfg
->
myIndex
);
info
.
config
.
syncCfg
=
*
pCfg
;
...
...
@@ -416,6 +416,11 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
goto
_err
;
}
if
(
metaPostOpen
(
pVnode
,
&
pVnode
->
pMeta
)
<
0
)
{
vError
(
"vgId:%d, failed to post open vnode meta since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
}
// open sync
if
(
vnodeSyncOpen
(
pVnode
,
dir
))
{
vError
(
"vgId:%d, failed to open sync since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录