Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0f3e49d8
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
0f3e49d8
编写于
4月 22, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact META 7
上级
44c5e42f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
99 addition
and
7 deletion
+99
-7
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+20
-4
source/dnode/vnode/src/meta/metaOpen.c
source/dnode/vnode/src/meta/metaOpen.c
+1
-1
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+54
-1
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+23
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+1
-1
未找到文件。
source/dnode/vnode/src/inc/meta.h
浏览文件 @
0f3e49d8
...
@@ -45,16 +45,25 @@ typedef struct SMetaEntry SMetaEntry;
...
@@ -45,16 +45,25 @@ typedef struct SMetaEntry SMetaEntry;
int
metaEncodeEntry
(
SCoder
*
pCoder
,
const
SMetaEntry
*
pME
);
int
metaEncodeEntry
(
SCoder
*
pCoder
,
const
SMetaEntry
*
pME
);
int
metaDecodeEntry
(
SCoder
*
pCoder
,
SMetaEntry
*
pME
);
int
metaDecodeEntry
(
SCoder
*
pCoder
,
SMetaEntry
*
pME
);
// metaTable ==================
int
metaCreateSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
);
int
metaDropSTable
(
SMeta
*
pMeta
,
int64_t
verison
,
SVDropStbReq
*
pReq
);
// metaQuery ==================
typedef
struct
SMetaEntryReader
SMetaEntryReader
;
void
metaEntryReaderInit
(
SMetaEntryReader
*
pReader
);
void
metaEntryReaderClear
(
SMetaEntryReader
*
pReader
);
int
metaGetTableEntryByVersion
(
SMeta
*
pMeta
,
SMetaEntryReader
*
pReader
,
int64_t
version
);
int
metaGetTableEntryByUid
(
SMeta
*
pMeta
,
SMetaEntryReader
*
pReader
,
tb_uid_t
uid
);
int
metaGetTableEntryByName
(
SMeta
*
pMeta
,
SMetaEntryReader
*
pReader
,
const
char
*
name
);
// metaIdx ==================
// metaIdx ==================
int
metaOpenIdx
(
SMeta
*
pMeta
);
int
metaOpenIdx
(
SMeta
*
pMeta
);
void
metaCloseIdx
(
SMeta
*
pMeta
);
void
metaCloseIdx
(
SMeta
*
pMeta
);
int
metaSaveTableToIdx
(
SMeta
*
pMeta
,
const
STbCfg
*
pTbOptions
);
int
metaSaveTableToIdx
(
SMeta
*
pMeta
,
const
STbCfg
*
pTbOptions
);
int
metaRemoveTableFromIdx
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
int
metaRemoveTableFromIdx
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
// metaTable ==================
int
metaCreateSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
);
int
metaDropSTable
(
SMeta
*
pMeta
,
int64_t
verison
,
SVDropStbReq
*
pReq
);
// metaCommit ==================
// metaCommit ==================
int
metaBegin
(
SMeta
*
pMeta
);
int
metaBegin
(
SMeta
*
pMeta
);
...
@@ -148,6 +157,13 @@ struct SMetaEntry {
...
@@ -148,6 +157,13 @@ struct SMetaEntry {
};
};
};
};
struct
SMetaEntryReader
{
SCoder
coder
;
SMetaEntry
me
;
void
*
pBuf
;
int
szBuf
;
};
#ifndef META_REFACT
#ifndef META_REFACT
// SMetaDB
// SMetaDB
int
metaOpenDB
(
SMeta
*
pMeta
);
int
metaOpenDB
(
SMeta
*
pMeta
);
...
...
source/dnode/vnode/src/meta/metaOpen.c
浏览文件 @
0f3e49d8
...
@@ -66,7 +66,7 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
...
@@ -66,7 +66,7 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
}
}
// open pUidIdx
// open pUidIdx
ret
=
tdbDbOpen
(
"uid.
db
"
,
sizeof
(
tb_uid_t
),
sizeof
(
int64_t
),
uidIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pUidIdx
);
ret
=
tdbDbOpen
(
"uid.
idx
"
,
sizeof
(
tb_uid_t
),
sizeof
(
int64_t
),
uidIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pUidIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId: %d failed to open meta uid idx since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId: %d failed to open meta uid idx since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
0f3e49d8
...
@@ -15,6 +15,57 @@
...
@@ -15,6 +15,57 @@
#include "vnodeInt.h"
#include "vnodeInt.h"
void
metaEntryReaderInit
(
SMetaEntryReader
*
pReader
)
{
memset
(
pReader
,
0
,
sizeof
(
*
pReader
));
}
void
metaEntryReaderClear
(
SMetaEntryReader
*
pReader
)
{
tCoderClear
(
&
pReader
->
coder
);
TDB_FREE
(
pReader
->
pBuf
);
}
int
metaGetTableEntryByVersion
(
SMeta
*
pMeta
,
SMetaEntryReader
*
pReader
,
int64_t
version
)
{
// query table.db
if
(
tdbDbGet
(
pMeta
->
pTbDb
,
&
version
,
sizeof
(
version
),
&
pReader
->
pBuf
,
&
pReader
->
szBuf
)
<
0
)
{
goto
_err
;
}
// decode the entry
tCoderInit
(
&
pReader
->
coder
,
TD_LITTLE_ENDIAN
,
pReader
->
pBuf
,
pReader
->
szBuf
,
TD_DECODER
);
if
(
metaDecodeEntry
(
&
pReader
->
coder
,
&
pReader
->
me
)
<
0
)
{
goto
_err
;
}
return
0
;
_err:
return
-
1
;
}
int
metaGetTableEntryByUid
(
SMeta
*
pMeta
,
SMetaEntryReader
*
pReader
,
tb_uid_t
uid
)
{
int64_t
version
;
// query uid.idx
if
(
tdbDbGet
(
pMeta
->
pUidIdx
,
&
uid
,
sizeof
(
uid
),
&
pReader
->
pBuf
,
&
pReader
->
szBuf
)
<
0
)
{
return
-
1
;
}
version
=
*
(
int64_t
*
)
pReader
->
pBuf
;
return
metaGetTableEntryByVersion
(
pMeta
,
pReader
,
version
);
}
int
metaGetTableEntryByName
(
SMeta
*
pMeta
,
SMetaEntryReader
*
pReader
,
const
char
*
name
)
{
tb_uid_t
uid
;
// query name.idx
if
(
tdbDbGet
(
pMeta
->
pNameIdx
,
name
,
strlen
(
name
)
+
1
,
&
pReader
->
pBuf
,
&
pReader
->
szBuf
)
<
0
)
{
return
-
1
;
}
uid
=
*
(
tb_uid_t
*
)
pReader
->
pBuf
;
return
metaGetTableEntryByUid
(
pMeta
,
pReader
,
uid
);
}
#if 1
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
)
{
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
)
{
SMTbCursor
*
pTbCur
=
NULL
;
SMTbCursor
*
pTbCur
=
NULL
;
#if 0
#if 0
...
@@ -391,4 +442,6 @@ void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode) {
...
@@ -391,4 +442,6 @@ void *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid, bool isDecode) {
#endif
#endif
#endif
#endif
return
NULL
;
return
NULL
;
}
}
\ No newline at end of file
#endif
\ No newline at end of file
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
0f3e49d8
...
@@ -22,6 +22,28 @@ int vnodeQueryOpen(SVnode *pVnode) {
...
@@ -22,6 +22,28 @@ int vnodeQueryOpen(SVnode *pVnode) {
void
vnodeQueryClose
(
SVnode
*
pVnode
)
{
qWorkerDestroy
((
void
**
)
&
pVnode
->
pQuery
);
}
void
vnodeQueryClose
(
SVnode
*
pVnode
)
{
qWorkerDestroy
((
void
**
)
&
pVnode
->
pQuery
);
}
int
vnodeGetTableMeta
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
int
vnodeGetTableMeta
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
STableInfoReq
infoReq
=
{
0
};
SMetaEntryReader
meReader
=
{
0
};
int32_t
code
=
0
;
// decode req
if
(
tDeserializeSTableInfoReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
infoReq
)
!=
0
)
{
code
=
TSDB_CODE_INVALID_MSG
;
goto
_exit
;
}
// query meta
metaEntryReaderInit
(
&
meReader
);
if
(
metaGetTableEntryByName
(
pVnode
->
pMeta
,
&
meReader
,
NULL
)
<
0
)
{
goto
_exit
;
}
// fill response
_exit:
return
0
;
#if 0
STbCfg *pTbCfg = NULL;
STbCfg *pTbCfg = NULL;
STbCfg *pStbCfg = NULL;
STbCfg *pStbCfg = NULL;
tb_uid_t uid;
tb_uid_t uid;
...
@@ -147,6 +169,7 @@ _exit:
...
@@ -147,6 +169,7 @@ _exit:
rpcMsg.code = code;
rpcMsg.code = code;
tmsgSendRsp(&rpcMsg);
tmsgSendRsp(&rpcMsg);
#endif
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
0f3e49d8
...
@@ -231,7 +231,7 @@ static int vnodeProcessCreateStbReq(SVnode *pVnode, int64_t version, void *pReq,
...
@@ -231,7 +231,7 @@ static int vnodeProcessCreateStbReq(SVnode *pVnode, int64_t version, void *pReq,
goto
_err
;
goto
_err
;
}
}
if
(
metaCreateSTable
(
pVnode
->
pMeta
,
version
,
pR
eq
)
<
0
)
{
if
(
metaCreateSTable
(
pVnode
->
pMeta
,
version
,
&
r
eq
)
<
0
)
{
pRsp
->
code
=
terrno
;
pRsp
->
code
=
terrno
;
goto
_err
;
goto
_err
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录