Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
11cb0afa
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
11cb0afa
编写于
4月 22, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
8cfcd6d4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
37 addition
and
22 deletion
+37
-22
include/common/tmsg.h
include/common/tmsg.h
+7
-1
include/libs/qcom/query.h
include/libs/qcom/query.h
+0
-6
source/common/src/tmsg.c
source/common/src/tmsg.c
+20
-7
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+8
-6
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+2
-2
未找到文件。
include/common/tmsg.h
浏览文件 @
11cb0afa
...
...
@@ -639,13 +639,19 @@ int32_t tSerializeSQnodeListReq(void* buf, int32_t bufLen, SQnodeListReq* pReq);
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
typedef
struct
{
SArray
*
epSetList
;
// SArray<SEpSet
>
SArray
*
addrsList
;
// SArray<SQueryNodeAddr
>
}
SQnodeListRsp
;
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
int32_t
tDeserializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
);
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
SEpSet
epSet
;
}
SQueryNodeAddr
;
typedef
struct
{
SArray
*
pArray
;
// Array of SUseDbRsp
}
SUseDbBatchRsp
;
...
...
include/libs/qcom/query.h
浏览文件 @
11cb0afa
...
...
@@ -129,12 +129,6 @@ typedef struct SMsgSendInfo {
SDataBuf
msgInfo
;
}
SMsgSendInfo
;
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
SEpSet
epSet
;
}
SQueryNodeAddr
;
typedef
struct
SQueryNodeStat
{
int32_t
tableNum
;
// vg table number, unit is TSDB_TABLE_NUM_UNIT
}
SQueryNodeStat
;
...
...
source/common/src/tmsg.c
浏览文件 @
11cb0afa
...
...
@@ -114,6 +114,19 @@ int32_t tDecodeSEpSet(SCoder *pDecoder, SEpSet *pEp) {
return
0
;
}
int32_t
tEncodeSQueryNodeAddr
(
SCoder
*
pEncoder
,
SQueryNodeAddr
*
pAddr
)
{
if
(
tEncodeI32
(
pEncoder
,
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
tDecodeSQueryNodeAddr
(
SCoder
*
pDecoder
,
SQueryNodeAddr
*
pAddr
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pEp
->
inUse
);
...
...
@@ -2058,11 +2071,11 @@ int32_t tSerializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp)
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
int32_t
num
=
taosArrayGetSize
(
pRsp
->
epSet
List
);
int32_t
num
=
taosArrayGetSize
(
pRsp
->
addrs
List
);
if
(
tEncodeI32
(
&
encoder
,
num
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
S
EpSet
*
epSet
=
taosArrayGet
(
pRsp
->
epSet
List
,
i
);
if
(
tEncodeS
EpSet
(
&
encoder
,
epSet
)
<
0
)
return
-
1
;
S
QueryNodeAddr
*
addr
=
taosArrayGet
(
pRsp
->
addrs
List
,
i
);
if
(
tEncodeS
QueryNodeAddr
(
&
encoder
,
addr
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
...
...
@@ -2078,10 +2091,10 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
int32_t
num
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
num
)
<
0
)
return
-
1
;
pRsp
->
epSetList
=
taosArrayInit
(
num
,
sizeof
(
SEpSet
));
if
(
NULL
==
pRsp
->
epSet
List
)
return
-
1
;
pRsp
->
addrsList
=
taosArrayInit
(
num
,
sizeof
(
SQueryNodeAddr
));
if
(
NULL
==
pRsp
->
addrs
List
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
if
(
tDecodeS
EpSet
(
&
decoder
,
TARRAY_GET_ELEM
(
pRsp
->
epSet
List
,
i
))
<
0
)
return
-
1
;
if
(
tDecodeS
QueryNodeAddr
(
&
decoder
,
TARRAY_GET_ELEM
(
pRsp
->
addrs
List
,
i
))
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
...
...
@@ -2089,7 +2102,7 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
return
0
;
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
epSet
List
);
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
addrs
List
);
}
int32_t
tSerializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
11cb0afa
...
...
@@ -444,8 +444,8 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
goto
_OVER
;
}
qlistRsp
.
epSetList
=
taosArrayInit
(
5
,
sizeof
(
SEpSet
));
if
(
NULL
==
qlistRsp
.
epSet
List
)
{
qlistRsp
.
addrsList
=
taosArrayInit
(
5
,
sizeof
(
SQueryNodeAddr
));
if
(
NULL
==
qlistRsp
.
addrs
List
)
{
mError
(
"failed to alloc epSet while process qnode list req"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
...
...
@@ -455,11 +455,13 @@ static int32_t mndProcessQnodeListReq(SNodeMsg *pReq) {
void
*
pIter
=
sdbFetch
(
pSdb
,
SDB_QNODE
,
NULL
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
SEpSet
epSet
=
{.
numOfEps
=
1
};
tstrncpy
(
epSet
.
eps
[
0
].
fqdn
,
pObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
epSet
.
eps
[
0
].
port
=
pObj
->
pDnode
->
port
;
SQueryNodeAddr
nodeAddr
=
{
0
};
nodeAddr
.
nodeId
=
QNODE_HANDLE
;
nodeAddr
.
epSet
.
numOfEps
=
1
;
tstrncpy
(
nodeAddr
.
epSet
.
eps
[
0
].
fqdn
,
pObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
nodeAddr
.
epSet
.
eps
[
0
].
port
=
pObj
->
pDnode
->
port
;
(
void
)
taosArrayPush
(
qlistRsp
.
epSetList
,
&
epSet
);
(
void
)
taosArrayPush
(
qlistRsp
.
addrsList
,
&
nodeAddr
);
numOfRows
++
;
sdbRelease
(
pSdb
,
pObj
);
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
11cb0afa
...
...
@@ -359,10 +359,10 @@ PROCESS_QLIST_OVER:
if
(
code
!=
0
)
{
tFreeSQnodeListRsp
(
&
out
);
out
.
epSet
List
=
NULL
;
out
.
addrs
List
=
NULL
;
}
*
(
SArray
**
)
output
=
out
.
epSet
List
;
*
(
SArray
**
)
output
=
out
.
addrs
List
;
return
code
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录