Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
58a76164
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看板
提交
58a76164
编写于
2月 04, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt index
上级
9b7d9356
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
60 addition
and
22 deletion
+60
-22
source/dnode/mnode/impl/inc/mndIndex.h
source/dnode/mnode/impl/inc/mndIndex.h
+23
-0
source/dnode/mnode/impl/src/mndIndex.c
source/dnode/mnode/impl/src/mndIndex.c
+21
-19
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+1
-1
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+15
-2
未找到文件。
source/dnode/mnode/impl/inc/mndIndex.h
0 → 100644
浏览文件 @
58a76164
#ifndef _TD_MND_IDX_H_
#define _TD_MND_IDX_H_
#include "mndInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
mndInitIdx
(
SMnode
*
pMnode
);
void
mndCleanupIdx
(
SMnode
*
pMnode
);
SIdxObj
*
mndAcquireIdx
(
SMnode
*
pMnode
,
char
*
Name
);
void
mndReleaseIdx
(
SMnode
*
pMnode
,
SIdxObj
*
pSma
);
int32_t
mndDropIdxsByStb
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SStbObj
*
pStb
);
int32_t
mndDropIdxsByDb
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
);
int32_t
mndGetTableIdx
(
SMnode
*
pMnode
,
char
*
tbFName
,
STableIndexRsp
*
rsp
,
bool
*
exist
);
int32_t
mndRetrieveTagIdx
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MND_IDX_H_*/
\ No newline at end of file
source/dnode/mnode/impl/src/mndIndex.c
浏览文件 @
58a76164
...
...
@@ -14,9 +14,9 @@
*/
#define _DEFAULT_SOURCE
#include "mndIndex.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndIdx.h"
#include "mndInfoSchema.h"
#include "mndMnode.h"
#include "mndPrivilege.h"
...
...
@@ -68,11 +68,12 @@ int32_t mndInitIdx(SMnode *pMnode) {
// mndSetMsgHandle(pMnode, TDMT_MND_DROP_SMA, mndProcessDropIdxReq);
// mndSetMsgHandle(pMnode, TDMT_VND_CREATE_SMA_RSP, mndTransProcessRsp);
// mndSetMsgHandle(pMnode, TDMT_VND_DROP_SMA_RSP, mndTransProcessRsp);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_INDEX
,
mndProcessGetIdxReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_TABLE_INDEX
,
mndProcessGetTbIdxReq
);
//
mndSetMsgHandle(pMnode, TDMT_MND_GET_INDEX, mndProcessGetIdxReq);
//
mndSetMsgHandle(pMnode, TDMT_MND_GET_TABLE_INDEX, mndProcessGetTbIdxReq);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndRetrieveIdx
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndCancelGetNextIdx
);
// type same with sma
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_INDEX, mndRetrieveIdx);
// mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_INDEX, mndCancelGetNextIdx);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
@@ -612,11 +613,11 @@ static int32_t mndProcessGetTbIdxReq(SRpcMsg *pReq) {
return
0
;
}
static
int32_t
mndRetrieve
Idx
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
int32_t
mndRetrieveTag
Idx
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
S
SmaObj
*
pSma
=
NULL
;
S
IdxObj
*
pIdx
=
NULL
;
int32_t
cols
=
0
;
SDbObj
*
pDb
=
NULL
;
...
...
@@ -624,28 +625,28 @@ static int32_t mndRetrieveIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
pDb
=
mndAcquireDb
(
pMnode
,
pShow
->
db
);
if
(
pDb
==
NULL
)
return
0
;
}
int
invalid
=
-
1
;
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_
SMA
,
pShow
->
pIter
,
(
void
**
)
&
pSma
);
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_
IDX
,
pShow
->
pIter
,
(
void
**
)
&
pIdx
);
if
(
pShow
->
pIter
==
NULL
)
break
;
if
(
NULL
!=
pDb
&&
p
Sma
->
dbUid
!=
pDb
->
uid
)
{
sdbRelease
(
pSdb
,
p
Sma
);
if
(
NULL
!=
pDb
&&
p
Idx
->
dbUid
!=
pDb
->
uid
)
{
sdbRelease
(
pSdb
,
p
Idx
);
continue
;
}
cols
=
0
;
SName
sma
Name
=
{
0
};
tNameFromString
(
&
smaName
,
pSma
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
SName
idx
Name
=
{
0
};
tNameFromString
(
&
idxName
,
pIdx
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
char
n1
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_TO_VARSTR
(
n1
,
(
char
*
)
tNameGetTableName
(
&
sma
Name
));
STR_TO_VARSTR
(
n1
,
(
char
*
)
tNameGetTableName
(
&
idx
Name
));
char
n2
[
TSDB_DB_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_TO_VARSTR
(
n2
,
(
char
*
)
mndGetDbStr
(
p
Sma
->
db
));
STR_TO_VARSTR
(
n2
,
(
char
*
)
mndGetDbStr
(
p
Idx
->
db
));
SName
stbName
=
{
0
};
tNameFromString
(
&
stbName
,
p
Sma
->
stb
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
tNameFromString
(
&
stbName
,
p
Idx
->
stb
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
char
n3
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_TO_VARSTR
(
n3
,
(
char
*
)
tNameGetTableName
(
&
stbName
));
...
...
@@ -659,13 +660,14 @@ static int32_t mndRetrieveIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
n3
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pSma
->
dstVgId
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
invalid
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
p
Sma
->
createdTime
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
p
Idx
->
createdTime
,
false
);
numOfRows
++
;
sdbRelease
(
pSdb
,
p
Sma
);
sdbRelease
(
pSdb
,
p
Idx
);
}
mndReleaseDb
(
pMnode
,
pDb
);
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
58a76164
...
...
@@ -21,7 +21,7 @@
#include "mndDnode.h"
#include "mndFunc.h"
#include "mndGrant.h"
#include "mndI
d
x.h"
#include "mndI
nde
x.h"
#include "mndInfoSchema.h"
#include "mndMnode.h"
#include "mndPerfSchema.h"
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
58a76164
...
...
@@ -17,6 +17,7 @@
#include "mndSma.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndIndex.h"
#include "mndInfoSchema.h"
#include "mndMnode.h"
#include "mndPrivilege.h"
...
...
@@ -46,6 +47,18 @@ static int32_t mndRetrieveSma(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
static
void
mndCancelGetNextSma
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndDestroySmaObj
(
SSmaObj
*
pSmaObj
);
// sma index and tag index
static
int32_t
mndRetrieveIdx
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
// TODO
int32_t
read
=
mndRetrieveSma
(
pReq
,
pShow
,
pBlock
,
rows
);
read
+=
mndRetrieveTagIdx
(
pReq
,
pShow
,
pBlock
,
rows
-
read
);
return
read
;
}
static
void
mndCancelGetNextIdx
(
SMnode
*
pMnode
,
void
*
pIter
)
{
// TODO
}
int32_t
mndInitSma
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{
.
sdbType
=
SDB_SMA
,
...
...
@@ -64,8 +77,8 @@ int32_t mndInitSma(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_INDEX
,
mndProcessGetSmaReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_TABLE_INDEX
,
mndProcessGetTbSmaReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndRetrieve
Sma
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndCancelGetNext
Sma
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndRetrieve
Idx
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndCancelGetNext
Idx
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录