Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0c605acf
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
0c605acf
编写于
4月 24, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact meta
上级
c704496f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
29 deletion
+38
-29
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+9
-7
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+14
-7
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+15
-15
未找到文件。
source/dnode/vnode/src/inc/meta.h
浏览文件 @
0c605acf
...
...
@@ -51,13 +51,13 @@ int metaDropSTable(SMeta* pMeta, int64_t verison, SVDropStbReq* pReq);
int
metaCreateTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateTbReq
*
pReq
);
// metaQuery ==================
typedef
struct
SMeta
EntryReader
SMetaEntry
Reader
;
typedef
struct
SMeta
Reader
SMeta
Reader
;
void
metaEntryReaderInit
(
SMeta
EntryReader
*
pReader
);
void
metaEntryReaderClear
(
SMeta
Entry
Reader
*
pReader
);
int
metaGetTableEntryByVersion
(
SMeta
*
pMeta
,
SMetaEntry
Reader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
);
int
metaGetTableEntryByUid
(
SMeta
*
pMeta
,
SMetaEntry
Reader
*
pReader
,
tb_uid_t
uid
);
int
metaGetTableEntryByName
(
SMeta
*
pMeta
,
SMetaEntry
Reader
*
pReader
,
const
char
*
name
);
void
metaEntryReaderInit
(
SMeta
Reader
*
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
);
// metaIdx ==================
int
metaOpenIdx
(
SMeta
*
pMeta
);
...
...
@@ -158,7 +158,9 @@ struct SMetaEntry {
};
};
struct
SMetaEntryReader
{
struct
SMetaReader
{
int32_t
flags
;
SMeta
*
pMeta
;
SCoder
coder
;
SMetaEntry
me
;
void
*
pBuf
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
0c605acf
...
...
@@ -15,14 +15,19 @@
#include "vnodeInt.h"
void
metaEntryReaderInit
(
SMetaEntryReader
*
pReader
)
{
memset
(
pReader
,
0
,
sizeof
(
*
pReader
));
}
void
metaEntryReaderInit
(
SMetaReader
*
pReader
,
SMeta
*
pMeta
,
int32_t
flags
)
{
memset
(
pReader
,
0
,
sizeof
(
*
pReader
));
pReader
->
flags
=
flags
;
pReader
->
pMeta
=
pMeta
;
}
void
metaEntryReaderClear
(
SMeta
Entry
Reader
*
pReader
)
{
void
metaEntryReaderClear
(
SMetaReader
*
pReader
)
{
tCoderClear
(
&
pReader
->
coder
);
TDB_FREE
(
pReader
->
pBuf
);
}
int
metaGetTableEntryByVersion
(
SMeta
*
pMeta
,
SMetaEntryReader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
)
{
int
metaGetTableEntryByVersion
(
SMetaReader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
STbDbKey
tbDbKey
=
{.
version
=
version
,
.
uid
=
uid
};
// query table.db
...
...
@@ -43,7 +48,8 @@ _err:
return
-
1
;
}
int
metaGetTableEntryByUid
(
SMeta
*
pMeta
,
SMetaEntryReader
*
pReader
,
tb_uid_t
uid
)
{
int
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
int64_t
version
;
// query uid.idx
...
...
@@ -52,10 +58,11 @@ int metaGetTableEntryByUid(SMeta *pMeta, SMetaEntryReader *pReader, tb_uid_t uid
}
version
=
*
(
int64_t
*
)
pReader
->
pBuf
;
return
metaGetTableEntryByVersion
(
p
Meta
,
p
Reader
,
version
,
uid
);
return
metaGetTableEntryByVersion
(
pReader
,
version
,
uid
);
}
int
metaGetTableEntryByName
(
SMeta
*
pMeta
,
SMetaEntryReader
*
pReader
,
const
char
*
name
)
{
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
tb_uid_t
uid
;
// query name.idx
...
...
@@ -64,7 +71,7 @@ int metaGetTableEntryByName(SMeta *pMeta, SMetaEntryReader *pReader, const char
}
uid
=
*
(
tb_uid_t
*
)
pReader
->
pBuf
;
return
metaGetTableEntryByUid
(
p
Meta
,
p
Reader
,
uid
);
return
metaGetTableEntryByUid
(
pReader
,
uid
);
}
#if 1
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
0c605acf
...
...
@@ -22,17 +22,17 @@ int vnodeQueryOpen(SVnode *pVnode) {
void
vnodeQueryClose
(
SVnode
*
pVnode
)
{
qWorkerDestroy
((
void
**
)
&
pVnode
->
pQuery
);
}
int
vnodeGetTableMeta
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
STableInfoReq
infoReq
=
{
0
};
STableMetaRsp
metaRsp
=
{
0
};
SMeta
EntryReader
mer1
=
{
0
};
SMeta
EntryReader
mer2
=
{
0
};
char
tableFName
[
TSDB_TABLE_FNAME_LEN
];
SRpcMsg
rpcMsg
;
int32_t
code
=
0
;
int32_t
rspLen
=
0
;
void
*
pRsp
=
NULL
;
SSchemaWrapper
schema
=
{
0
};
SSchemaWrapper
schemaTag
=
{
0
};
STableInfoReq
infoReq
=
{
0
};
STableMetaRsp
metaRsp
=
{
0
};
SMeta
Reader
mer1
=
{
0
};
SMeta
Reader
mer2
=
{
0
};
char
tableFName
[
TSDB_TABLE_FNAME_LEN
];
SRpcMsg
rpcMsg
;
int32_t
code
=
0
;
int32_t
rspLen
=
0
;
void
*
pRsp
=
NULL
;
SSchemaWrapper
schema
=
{
0
};
SSchemaWrapper
schemaTag
=
{
0
};
// decode req
if
(
tDeserializeSTableInfoReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
infoReq
)
!=
0
)
{
...
...
@@ -51,9 +51,9 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
}
// query meta
metaEntryReaderInit
(
&
mer1
);
metaEntryReaderInit
(
&
mer1
,
pVnode
->
pMeta
,
0
);
if
(
metaGetTableEntryByName
(
pVnode
->
pMeta
,
&
mer1
,
infoReq
.
tbName
)
<
0
)
{
if
(
metaGetTableEntryByName
(
&
mer1
,
infoReq
.
tbName
)
<
0
)
{
goto
_exit
;
}
...
...
@@ -66,8 +66,8 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
schemaTag
=
mer1
.
me
.
stbEntry
.
schemaTag
;
metaRsp
.
suid
=
mer1
.
me
.
uid
;
}
else
if
(
mer1
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
metaEntryReaderInit
(
&
mer2
);
if
(
metaGetTableEntryByUid
(
pVnode
->
pMeta
,
&
mer2
,
mer1
.
me
.
ctbEntry
.
suid
)
<
0
)
goto
_exit
;
metaEntryReaderInit
(
&
mer2
,
pVnode
->
pMeta
,
0
);
if
(
metaGetTableEntryByUid
(
&
mer2
,
mer1
.
me
.
ctbEntry
.
suid
)
<
0
)
goto
_exit
;
metaRsp
.
suid
=
mer2
.
me
.
uid
;
schema
=
mer2
.
me
.
stbEntry
.
schema
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录