Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1d149e55
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
1d149e55
编写于
5月 06, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: format sma code
上级
2383b316
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
64 deletion
+63
-64
source/dnode/mnode/impl/inc/mndSma.h
source/dnode/mnode/impl/inc/mndSma.h
+0
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+0
-48
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+48
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+15
-14
未找到文件。
source/dnode/mnode/impl/inc/mndSma.h
浏览文件 @
1d149e55
...
...
@@ -26,7 +26,6 @@ int32_t mndInitSma(SMnode *pMnode);
void
mndCleanupSma
(
SMnode
*
pMnode
);
SSmaObj
*
mndAcquireSma
(
SMnode
*
pMnode
,
char
*
smaName
);
void
mndReleaseSma
(
SMnode
*
pMnode
,
SSmaObj
*
pSma
);
int32_t
mndProcessGetSmaReq
(
SMnode
*
pMnode
,
SUserIndexReq
*
indexReq
,
SUserIndexRsp
*
rsp
,
bool
*
exist
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
1d149e55
...
...
@@ -44,7 +44,6 @@ static int32_t mndProcessCompactDbReq(SNodeMsg *pReq);
static
int32_t
mndRetrieveDbs
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rowsCapacity
);
static
void
mndCancelGetNextDb
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessGetDbCfgReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessGetIndexReq
(
SNodeMsg
*
pReq
);
int32_t
mndInitDb
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{
...
...
@@ -63,7 +62,6 @@ int32_t mndInitDb(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_USE_DB
,
mndProcessUseDbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_COMPACT_DB
,
mndProcessCompactDbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_DB_CFG
,
mndProcessGetDbCfgReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_INDEX
,
mndProcessGetIndexReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_DB
,
mndRetrieveDbs
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_DB
,
mndCancelGetNextDb
);
...
...
@@ -1543,49 +1541,3 @@ static void mndCancelGetNextDb(SMnode *pMnode, void *pIter) {
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbCancelFetch
(
pSdb
,
pIter
);
}
static
int32_t
mndProcessGetIndexReq
(
SNodeMsg
*
pReq
)
{
SUserIndexReq
indexReq
=
{
0
};
SMnode
*
pMnode
=
pReq
->
pNode
;
int32_t
code
=
-
1
;
SUserIndexRsp
rsp
=
{
0
};
bool
exist
=
false
;
if
(
tDeserializeSUserIndexReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
indexReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
code
=
mndProcessGetSmaReq
(
pMnode
,
&
indexReq
,
&
rsp
,
&
exist
);
if
(
code
)
{
goto
_OVER
;
}
if
(
!
exist
)
{
// TODO GET INDEX FROM FULLTEXT
code
=
-
1
;
terrno
=
TSDB_CODE_MND_DB_INDEX_NOT_EXIST
;
}
else
{
int32_t
contLen
=
tSerializeSUserIndexRsp
(
NULL
,
0
,
&
rsp
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
-
1
;
goto
_OVER
;
}
tSerializeSUserIndexRsp
(
pRsp
,
contLen
,
&
rsp
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
code
=
0
;
}
_OVER:
if
(
code
!=
0
)
{
mError
(
"failed to get index %s since %s"
,
indexReq
.
indexFName
,
terrstr
());
}
return
code
;
}
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
1d149e55
...
...
@@ -40,6 +40,7 @@ static int32_t mndProcessMCreateSmaReq(SNodeMsg *pReq);
static
int32_t
mndProcessMDropSmaReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessVCreateSmaRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessVDropSmaRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessGetSmaReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndRetrieveSma
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
void
mndCancelGetNextSma
(
SMnode
*
pMnode
,
void
*
pIter
);
...
...
@@ -56,6 +57,7 @@ int32_t mndInitSma(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_SMA
,
mndProcessMDropSmaReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_CREATE_SMA_RSP
,
mndProcessVCreateSmaRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_DROP_SMA_RSP
,
mndProcessVDropSmaRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_GET_INDEX
,
mndProcessGetSmaReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndRetrieveSma
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_INDEX
,
mndCancelGetNextSma
);
...
...
@@ -686,7 +688,7 @@ _OVER:
return
code
;
}
int32_t
mndProcessGetSmaReq
(
SMnode
*
pMnode
,
SUserIndexReq
*
indexReq
,
SUserIndexRsp
*
rsp
,
bool
*
exist
)
{
static
int32_t
mndGetSma
(
SMnode
*
pMnode
,
SUserIndexReq
*
indexReq
,
SUserIndexRsp
*
rsp
,
bool
*
exist
)
{
int32_t
code
=
-
1
;
SSmaObj
*
pSma
=
NULL
;
...
...
@@ -715,6 +717,51 @@ int32_t mndProcessGetSmaReq(SMnode *pMnode, SUserIndexReq *indexReq, SUserIndexR
}
mndReleaseSma
(
pMnode
,
pSma
);
return
code
;
}
static
int32_t
mndProcessGetSmaReq
(
SNodeMsg
*
pReq
)
{
SUserIndexReq
indexReq
=
{
0
};
SMnode
*
pMnode
=
pReq
->
pNode
;
int32_t
code
=
-
1
;
SUserIndexRsp
rsp
=
{
0
};
bool
exist
=
false
;
if
(
tDeserializeSUserIndexReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
indexReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
code
=
mndGetSma
(
pMnode
,
&
indexReq
,
&
rsp
,
&
exist
);
if
(
code
)
{
goto
_OVER
;
}
if
(
!
exist
)
{
// TODO GET INDEX FROM FULLTEXT
code
=
-
1
;
terrno
=
TSDB_CODE_MND_DB_INDEX_NOT_EXIST
;
}
else
{
int32_t
contLen
=
tSerializeSUserIndexRsp
(
NULL
,
0
,
&
rsp
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
-
1
;
goto
_OVER
;
}
tSerializeSUserIndexRsp
(
pRsp
,
contLen
,
&
rsp
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
contLen
;
code
=
0
;
}
_OVER:
if
(
code
!=
0
)
{
mError
(
"failed to get index %s since %s"
,
indexReq
.
indexFName
,
terrstr
());
}
return
code
;
}
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
1d149e55
...
...
@@ -21,8 +21,8 @@
#include "mndShow.h"
#include "mndTrans.h"
#define
TSDB_
VGROUP_VER_NUMBER 1
#define
TSDB_
VGROUP_RESERVE_SIZE 64
#define VGROUP_VER_NUMBER 1
#define VGROUP_RESERVE_SIZE 64
static
SSdbRow
*
mndVgroupActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndVgroupActionInsert
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
...
...
@@ -40,13 +40,15 @@ static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
static
void
mndCancelGetNextVnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitVgroup
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_VGROUP
,
.
keyType
=
SDB_KEY_INT32
,
.
encodeFp
=
(
SdbEncodeFp
)
mndVgroupActionEncode
,
.
decodeFp
=
(
SdbDecodeFp
)
mndVgroupActionDecode
,
.
insertFp
=
(
SdbInsertFp
)
mndVgroupActionInsert
,
.
updateFp
=
(
SdbUpdateFp
)
mndVgroupActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndVgroupActionDelete
,};
SSdbTable
table
=
{
.
sdbType
=
SDB_VGROUP
,
.
keyType
=
SDB_KEY_INT32
,
.
encodeFp
=
(
SdbEncodeFp
)
mndVgroupActionEncode
,
.
decodeFp
=
(
SdbDecodeFp
)
mndVgroupActionDecode
,
.
insertFp
=
(
SdbInsertFp
)
mndVgroupActionInsert
,
.
updateFp
=
(
SdbUpdateFp
)
mndVgroupActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndVgroupActionDelete
,
};
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CREATE_VNODE_RSP
,
mndProcessCreateVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_ALTER_VNODE_RSP
,
mndProcessAlterVnodeRsp
);
...
...
@@ -66,7 +68,7 @@ void mndCleanupVgroup(SMnode *pMnode) {}
SSdbRaw
*
mndVgroupActionEncode
(
SVgObj
*
pVgroup
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_VGROUP
,
TSDB_VGROUP_VER_NUMBER
,
sizeof
(
SVgObj
)
+
TSDB_
VGROUP_RESERVE_SIZE
);
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_VGROUP
,
VGROUP_VER_NUMBER
,
sizeof
(
SVgObj
)
+
VGROUP_RESERVE_SIZE
);
if
(
pRaw
==
NULL
)
goto
_OVER
;
int32_t
dataPos
=
0
;
...
...
@@ -83,7 +85,7 @@ SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup) {
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
SDB_SET_INT32
(
pRaw
,
dataPos
,
pVgid
->
dnodeId
,
_OVER
)
}
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
TSDB_
VGROUP_RESERVE_SIZE
,
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
VGROUP_RESERVE_SIZE
,
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
_OVER
)
terrno
=
0
;
...
...
@@ -105,7 +107,7 @@ SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) {
int8_t
sver
=
0
;
if
(
sdbGetRawSoftVer
(
pRaw
,
&
sver
)
!=
0
)
goto
_OVER
;
if
(
sver
!=
TSDB_
VGROUP_VER_NUMBER
)
{
if
(
sver
!=
VGROUP_VER_NUMBER
)
{
terrno
=
TSDB_CODE_SDB_INVALID_DATA_VER
;
goto
_OVER
;
}
...
...
@@ -133,7 +135,7 @@ SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) {
pVgid
->
role
=
TAOS_SYNC_STATE_LEADER
;
}
}
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
TSDB_
VGROUP_RESERVE_SIZE
,
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
VGROUP_RESERVE_SIZE
,
_OVER
)
terrno
=
0
;
...
...
@@ -664,7 +666,6 @@ static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
int32_t
numOfRows
=
0
;
SVgObj
*
pVgroup
=
NULL
;
int32_t
cols
=
0
;
// int32_t dnodeId = pShow->replica;
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pShow
->
pIter
,
(
void
**
)
&
pVgroup
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录