Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cc9496e5
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看板
提交
cc9496e5
编写于
4月 24, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact vnode
上级
0c605acf
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
52 deletion
+63
-52
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+45
-2
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+3
-42
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+11
-4
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+4
-4
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
cc9496e5
...
...
@@ -61,15 +61,25 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad);
int
vnodeValidateTableHash
(
SVnode
*
pVnode
,
char
*
tableFName
);
// meta
typedef
struct
SMeta
SMeta
;
// todo: remove
typedef
struct
SMTbCursor
SMTbCursor
;
typedef
struct
SMeta
SMeta
;
// todo: remove
typedef
struct
SMetaReader
SMetaReader
;
typedef
struct
SMetaEntry
SMetaEntry
;
void
metaReaderInit
(
SMetaReader
*
pReader
,
SVnode
*
pVnode
,
int32_t
flags
);
void
metaReaderClear
(
SMetaReader
*
pReader
);
int
metaReadNext
(
SMetaReader
*
pReader
);
const
SMetaEntry
*
metaReaderGetEntry
(
SMetaReader
*
pReader
);
typedef
SVCreateTbReq
STbCfg
;
typedef
SVCreateTSmaReq
SSmaCfg
;
#if 1
typedef
struct
SMTbCursor
SMTbCursor
;
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
);
void
metaCloseTbCursor
(
SMTbCursor
*
pTbCur
);
char
*
metaTbCursorNext
(
SMTbCursor
*
pTbCur
);
#endif
// tsdb
typedef
struct
STsdb
STsdb
;
...
...
@@ -167,6 +177,39 @@ typedef struct {
uint64_t
uid
;
}
STableKeyInfo
;
struct
SMetaEntry
{
int64_t
version
;
int8_t
type
;
tb_uid_t
uid
;
const
char
*
name
;
union
{
struct
{
SSchemaWrapper
schema
;
SSchemaWrapper
schemaTag
;
}
stbEntry
;
struct
{
int64_t
ctime
;
int32_t
ttlDays
;
tb_uid_t
suid
;
const
void
*
pTags
;
}
ctbEntry
;
struct
{
int64_t
ctime
;
int32_t
ttlDays
;
SSchemaWrapper
schema
;
}
ntbEntry
;
};
};
struct
SMetaReader
{
int32_t
flags
;
SMeta
*
pMeta
;
SCoder
coder
;
SMetaEntry
me
;
void
*
pBuf
;
int
szBuf
;
};
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
cc9496e5
...
...
@@ -40,8 +40,6 @@ int metaOpen(SVnode* pVnode, SMeta** ppMeta);
int
metaClose
(
SMeta
*
pMeta
);
// metaEntry ==================
typedef
struct
SMetaEntry
SMetaEntry
;
int
metaEncodeEntry
(
SCoder
*
pCoder
,
const
SMetaEntry
*
pME
);
int
metaDecodeEntry
(
SCoder
*
pCoder
,
SMetaEntry
*
pME
);
...
...
@@ -51,13 +49,9 @@ int metaDropSTable(SMeta* pMeta, int64_t verison, SVDropStbReq* pReq);
int
metaCreateTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateTbReq
*
pReq
);
// metaQuery ==================
typedef
struct
SMetaReader
SMetaReader
;
void
metaEntryReaderInit
(
SMetaReader
*
pReader
,
SMeta
*
pMeta
,
int32_t
flags
);
void
metaEntryReaderClear
(
SMetaReader
*
pReader
);
int
metaGetTableEntryByVersion
(
SMetaReader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
);
int
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
);
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
);
int
metaGetTableEntryByVersion
(
SMetaReader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
);
int
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
);
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
);
// metaIdx ==================
int
metaOpenIdx
(
SMeta
*
pMeta
);
...
...
@@ -134,39 +128,6 @@ SMCtbCursor* metaOpenCtbCursor(SMeta* pMeta, tb_uid_t uid);
void
metaCloseCtbCurosr
(
SMCtbCursor
*
pCtbCur
);
tb_uid_t
metaCtbCursorNext
(
SMCtbCursor
*
pCtbCur
);
struct
SMetaEntry
{
int64_t
version
;
int8_t
type
;
tb_uid_t
uid
;
const
char
*
name
;
union
{
struct
{
SSchemaWrapper
schema
;
SSchemaWrapper
schemaTag
;
}
stbEntry
;
struct
{
int64_t
ctime
;
int32_t
ttlDays
;
tb_uid_t
suid
;
const
void
*
pTags
;
}
ctbEntry
;
struct
{
int64_t
ctime
;
int32_t
ttlDays
;
SSchemaWrapper
schema
;
}
ntbEntry
;
};
};
struct
SMetaReader
{
int32_t
flags
;
SMeta
*
pMeta
;
SCoder
coder
;
SMetaEntry
me
;
void
*
pBuf
;
int
szBuf
;
};
#ifndef META_REFACT
// SMetaDB
int
metaOpenDB
(
SMeta
*
pMeta
);
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
cc9496e5
...
...
@@ -15,13 +15,13 @@
#include "vnodeInt.h"
void
meta
EntryReaderInit
(
SMetaReader
*
pReader
,
SMeta
*
pMeta
,
int32_t
flags
)
{
void
meta
ReaderInit
(
SMetaReader
*
pReader
,
SVnode
*
pVnode
,
int32_t
flags
)
{
memset
(
pReader
,
0
,
sizeof
(
*
pReader
));
pReader
->
flags
=
flags
;
pReader
->
pMeta
=
pMeta
;
pReader
->
pMeta
=
p
Vnode
->
p
Meta
;
}
void
meta
Entry
ReaderClear
(
SMetaReader
*
pReader
)
{
void
metaReaderClear
(
SMetaReader
*
pReader
)
{
tCoderClear
(
&
pReader
->
coder
);
TDB_FREE
(
pReader
->
pBuf
);
}
...
...
@@ -74,7 +74,14 @@ int metaGetTableEntryByName(SMetaReader *pReader, const char *name) {
return
metaGetTableEntryByUid
(
pReader
,
uid
);
}
#if 1
int
metaReadNext
(
SMetaReader
*
pReader
)
{
// TODO
return
0
;
}
const
SMetaEntry
*
metaReaderGetEntry
(
SMetaReader
*
pReader
)
{
return
&
pReader
->
me
;
}
#if 1 // ===================================================
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
)
{
SMTbCursor
*
pTbCur
=
NULL
;
#if 0
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
cc9496e5
...
...
@@ -51,7 +51,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
}
// query meta
meta
EntryReaderInit
(
&
mer1
,
pVnode
->
pMeta
,
0
);
meta
ReaderInit
(
&
mer1
,
pVnode
,
0
);
if
(
metaGetTableEntryByName
(
&
mer1
,
infoReq
.
tbName
)
<
0
)
{
goto
_exit
;
...
...
@@ -66,7 +66,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
schemaTag
=
mer1
.
me
.
stbEntry
.
schemaTag
;
metaRsp
.
suid
=
mer1
.
me
.
uid
;
}
else
if
(
mer1
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
meta
EntryReaderInit
(
&
mer2
,
pVnode
->
pMeta
,
0
);
meta
ReaderInit
(
&
mer2
,
pVnode
,
0
);
if
(
metaGetTableEntryByUid
(
&
mer2
,
mer1
.
me
.
ctbEntry
.
suid
)
<
0
)
goto
_exit
;
metaRsp
.
suid
=
mer2
.
me
.
uid
;
...
...
@@ -113,8 +113,8 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
_exit:
taosMemoryFree
(
metaRsp
.
pSchemas
);
meta
Entry
ReaderClear
(
&
mer2
);
meta
Entry
ReaderClear
(
&
mer1
);
metaReaderClear
(
&
mer2
);
metaReaderClear
(
&
mer1
);
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录