Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2f003140
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看板
提交
2f003140
编写于
1月 19, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add dependency for scheduler
上级
7ab261d7
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
351 addition
and
358 deletion
+351
-358
include/common/tmsg.h
include/common/tmsg.h
+346
-354
source/dnode/mnode/impl/CMakeLists.txt
source/dnode/mnode/impl/CMakeLists.txt
+2
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+0
-1
source/libs/scheduler/CMakeLists.txt
source/libs/scheduler/CMakeLists.txt
+2
-2
未找到文件。
include/common/tmsg.h
浏览文件 @
2f003140
...
...
@@ -140,214 +140,6 @@ typedef enum _mgmt_table {
#define TSDB_COL_IS_NORMAL_COL(f) ((f & (~(TSDB_COL_NULL))) == TSDB_COL_NORMAL)
#define TSDB_COL_IS_UD_COL(f) ((f & (~(TSDB_COL_NULL))) == TSDB_COL_UDC)
#define TSDB_COL_REQ_NULL(f) (((f)&TSDB_COL_NULL) != 0)
typedef
struct
{
int32_t
keyLen
;
int32_t
valueLen
;
void
*
key
;
void
*
value
;
}
SKv
;
typedef
struct
{
int32_t
connId
;
int32_t
hbType
;
}
SClientHbKey
;
typedef
struct
{
SClientHbKey
connKey
;
SHashObj
*
info
;
// hash<Skv.key, Skv>
}
SClientHbReq
;
typedef
struct
{
int64_t
reqId
;
SArray
*
reqs
;
// SArray<SClientHbReq>
}
SClientHbBatchReq
;
typedef
struct
{
SClientHbKey
connKey
;
int32_t
status
;
int32_t
bodyLen
;
void
*
body
;
}
SClientHbRsp
;
typedef
struct
{
int64_t
reqId
;
int64_t
rspId
;
SArray
*
rsps
;
// SArray<SClientHbRsp>
}
SClientHbBatchRsp
;
static
FORCE_INLINE
uint32_t
hbKeyHashFunc
(
const
char
*
key
,
uint32_t
keyLen
)
{
return
taosIntHash_64
(
key
,
keyLen
);
}
int
tSerializeSClientHbReq
(
void
**
buf
,
const
SClientHbReq
*
pReq
);
void
*
tDeserializeSClientHbReq
(
void
*
buf
,
SClientHbReq
*
pReq
);
int
tSerializeSClientHbRsp
(
void
**
buf
,
const
SClientHbRsp
*
pRsp
);
void
*
tDeserializeSClientHbRsp
(
void
*
buf
,
SClientHbRsp
*
pRsp
);
static
FORCE_INLINE
void
tFreeClientHbReq
(
void
*
pReq
)
{
SClientHbReq
*
req
=
(
SClientHbReq
*
)
pReq
;
if
(
req
->
info
)
taosHashCleanup
(
req
->
info
);
}
int
tSerializeSClientHbBatchReq
(
void
**
buf
,
const
SClientHbBatchReq
*
pReq
);
void
*
tDeserializeSClientHbBatchReq
(
void
*
buf
,
SClientHbBatchReq
*
pReq
);
static
FORCE_INLINE
void
tFreeClientHbBatchReq
(
void
*
pReq
,
bool
deep
)
{
SClientHbBatchReq
*
req
=
(
SClientHbBatchReq
*
)
pReq
;
if
(
deep
)
{
taosArrayDestroyEx
(
req
->
reqs
,
tFreeClientHbReq
);
}
else
{
taosArrayDestroy
(
req
->
reqs
);
}
free
(
pReq
);
}
int
tSerializeSClientHbBatchRsp
(
void
**
buf
,
const
SClientHbBatchRsp
*
pBatchRsp
);
void
*
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
SClientHbBatchRsp
*
pBatchRsp
);
static
FORCE_INLINE
int
taosEncodeSKv
(
void
**
buf
,
const
SKv
*
pKv
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pKv
->
keyLen
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pKv
->
valueLen
);
tlen
+=
taosEncodeBinary
(
buf
,
pKv
->
key
,
pKv
->
keyLen
);
tlen
+=
taosEncodeBinary
(
buf
,
pKv
->
value
,
pKv
->
valueLen
);
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSKv
(
void
*
buf
,
SKv
*
pKv
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pKv
->
keyLen
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pKv
->
valueLen
);
buf
=
taosDecodeBinary
(
buf
,
&
pKv
->
key
,
pKv
->
keyLen
);
buf
=
taosDecodeBinary
(
buf
,
&
pKv
->
value
,
pKv
->
valueLen
);
return
buf
;
}
static
FORCE_INLINE
int
taosEncodeSClientHbKey
(
void
**
buf
,
const
SClientHbKey
*
pKey
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pKey
->
connId
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pKey
->
hbType
);
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSClientHbKey
(
void
*
buf
,
SClientHbKey
*
pKey
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pKey
->
connId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pKey
->
hbType
);
return
buf
;
}
typedef
struct
SMqHbVgInfo
{
int32_t
vgId
;
}
SMqHbVgInfo
;
static
FORCE_INLINE
int
taosEncodeSMqVgInfo
(
void
**
buf
,
const
SMqHbVgInfo
*
pVgInfo
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pVgInfo
->
vgId
);
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqVgInfo
(
void
*
buf
,
SMqHbVgInfo
*
pVgInfo
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pVgInfo
->
vgId
);
return
buf
;
}
typedef
struct
SMqHbTopicInfo
{
int32_t
epoch
;
int64_t
topicUid
;
char
name
[
TSDB_TOPIC_FNAME_LEN
];
SArray
*
pVgInfo
;
}
SMqHbTopicInfo
;
static
FORCE_INLINE
int
taosEncodeSMqHbTopicInfoMsg
(
void
**
buf
,
const
SMqHbTopicInfo
*
pTopicInfo
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pTopicInfo
->
epoch
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pTopicInfo
->
topicUid
);
tlen
+=
taosEncodeString
(
buf
,
pTopicInfo
->
name
);
int32_t
sz
=
taosArrayGetSize
(
pTopicInfo
->
pVgInfo
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbVgInfo
*
pVgInfo
=
(
SMqHbVgInfo
*
)
taosArrayGet
(
pTopicInfo
->
pVgInfo
,
i
);
tlen
+=
taosEncodeSMqVgInfo
(
buf
,
pVgInfo
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqHbTopicInfoMsg
(
void
*
buf
,
SMqHbTopicInfo
*
pTopicInfo
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pTopicInfo
->
epoch
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pTopicInfo
->
topicUid
);
buf
=
taosDecodeStringTo
(
buf
,
pTopicInfo
->
name
);
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pTopicInfo
->
pVgInfo
=
taosArrayInit
(
sz
,
sizeof
(
SMqHbVgInfo
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbVgInfo
vgInfo
;
buf
=
taosDecodeSMqVgInfo
(
buf
,
&
vgInfo
);
taosArrayPush
(
pTopicInfo
->
pVgInfo
,
&
vgInfo
);
}
return
buf
;
}
typedef
struct
SMqHbMsg
{
int32_t
status
;
// ask hb endpoint
int32_t
epoch
;
int64_t
consumerId
;
SArray
*
pTopics
;
// SArray<SMqHbTopicInfo>
}
SMqHbMsg
;
static
FORCE_INLINE
int
taosEncodeSMqMsg
(
void
**
buf
,
const
SMqHbMsg
*
pMsg
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pMsg
->
status
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pMsg
->
epoch
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pMsg
->
consumerId
);
int32_t
sz
=
taosArrayGetSize
(
pMsg
->
pTopics
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbTopicInfo
*
topicInfo
=
(
SMqHbTopicInfo
*
)
taosArrayGet
(
pMsg
->
pTopics
,
i
);
tlen
+=
taosEncodeSMqHbTopicInfoMsg
(
buf
,
topicInfo
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqMsg
(
void
*
buf
,
SMqHbMsg
*
pMsg
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pMsg
->
status
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pMsg
->
epoch
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pMsg
->
consumerId
);
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pMsg
->
pTopics
=
taosArrayInit
(
sz
,
sizeof
(
SMqHbTopicInfo
));
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbTopicInfo
topicInfo
;
buf
=
taosDecodeSMqHbTopicInfoMsg
(
buf
,
&
topicInfo
);
taosArrayPush
(
pMsg
->
pTopics
,
&
topicInfo
);
}
return
buf
;
}
typedef
struct
SMqSetCVgReq
{
int32_t
vgId
;
int64_t
consumerId
;
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
char
cGroup
[
TSDB_CONSUMER_GROUP_LEN
];
}
SMqSetCVgReq
;
static
FORCE_INLINE
int32_t
tEncodeSMqSetCVgReq
(
void
**
buf
,
const
SMqSetCVgReq
*
pReq
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
vgId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
consumerId
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
topicName
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
cGroup
);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDecodeSMqSetCVgReq
(
void
*
buf
,
SMqSetCVgReq
*
pReq
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
vgId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
consumerId
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
topicName
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
cGroup
);
return
buf
;
}
typedef
struct
{
int32_t
vgId
;
char
*
dbName
;
...
...
@@ -384,6 +176,18 @@ typedef struct SSubmitBlk {
char
data
[];
}
SSubmitBlk
;
typedef
struct
{
/* data */
}
SSubmitReq
;
typedef
struct
{
/* data */
}
SSubmitRsp
;
typedef
struct
{
/* data */
}
SSubmitReqReader
;
// Submit message for this TSDB
typedef
struct
{
SMsgHead
header
;
...
...
@@ -486,111 +290,25 @@ static FORCE_INLINE void* taosDecodeSEpSet(void* buf, SEpSet* pEp) {
}
return
buf
;
}
typedef
struct
SMqHbRsp
{
int
8_t
status
;
//idle or not
int
8_t
vnodeChange
d
;
int8_t
epChanged
;
// should use new epset
int8_t
reserved
;
typedef
struct
{
int32_t
acctId
;
int
64_t
clusterId
;
int
32_t
connI
d
;
int8_t
superUser
;
int8_t
align
[
3
]
;
SEpSet
epSet
;
}
S
MqHb
Rsp
;
}
S
Connect
Rsp
;
static
FORCE_INLINE
int
taosEncodeSMqHbRsp
(
void
**
buf
,
const
SMqHbRsp
*
pRsp
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
status
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
vnodeChanged
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
epChanged
);
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pRsp
->
epSet
);
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqHbRsp
(
void
*
buf
,
SMqHbRsp
*
pRsp
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
status
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
vnodeChanged
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
epChanged
);
buf
=
taosDecodeSEpSet
(
buf
,
&
pRsp
->
epSet
);
return
buf
;
}
typedef
struct
SMqHbOneTopicBatchRsp
{
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
SArray
*
rsps
;
// SArray<SMqHbRsp>
}
SMqHbOneTopicBatchRsp
;
static
FORCE_INLINE
int
taosEncodeSMqHbOneTopicBatchRsp
(
void
**
buf
,
const
SMqHbOneTopicBatchRsp
*
pBatchRsp
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeString
(
buf
,
pBatchRsp
->
topicName
);
int32_t
sz
=
taosArrayGetSize
(
pBatchRsp
->
rsps
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbRsp
*
pRsp
=
(
SMqHbRsp
*
)
taosArrayGet
(
pBatchRsp
->
rsps
,
i
);
tlen
+=
taosEncodeSMqHbRsp
(
buf
,
pRsp
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqHbOneTopicBatchRsp
(
void
*
buf
,
SMqHbOneTopicBatchRsp
*
pBatchRsp
)
{
int32_t
sz
;
buf
=
taosDecodeStringTo
(
buf
,
pBatchRsp
->
topicName
);
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pBatchRsp
->
rsps
=
taosArrayInit
(
sz
,
sizeof
(
SMqHbRsp
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbRsp
rsp
;
buf
=
taosDecodeSMqHbRsp
(
buf
,
&
rsp
);
buf
=
taosArrayPush
(
pBatchRsp
->
rsps
,
&
rsp
);
}
return
buf
;
}
typedef
struct
SMqHbBatchRsp
{
int64_t
consumerId
;
SArray
*
batchRsps
;
// SArray<SMqHbOneTopicBatchRsp>
}
SMqHbBatchRsp
;
static
FORCE_INLINE
int
taosEncodeSMqHbBatchRsp
(
void
**
buf
,
const
SMqHbBatchRsp
*
pBatchRsp
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pBatchRsp
->
consumerId
);
int32_t
sz
;
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbOneTopicBatchRsp
*
pRsp
=
(
SMqHbOneTopicBatchRsp
*
)
taosArrayGet
(
pBatchRsp
->
batchRsps
,
i
);
tlen
+=
taosEncodeSMqHbOneTopicBatchRsp
(
buf
,
pRsp
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqHbBatchRsp
(
void
*
buf
,
SMqHbBatchRsp
*
pBatchRsp
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pBatchRsp
->
consumerId
);
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pBatchRsp
->
batchRsps
=
taosArrayInit
(
sz
,
sizeof
(
SMqHbOneTopicBatchRsp
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbOneTopicBatchRsp
rsp
;
buf
=
taosDecodeSMqHbOneTopicBatchRsp
(
buf
,
&
rsp
);
buf
=
taosArrayPush
(
pBatchRsp
->
batchRsps
,
&
rsp
);
}
return
buf
;
}
typedef
struct
{
int32_t
acctId
;
int64_t
clusterId
;
int32_t
connId
;
int8_t
superUser
;
int8_t
align
[
3
];
SEpSet
epSet
;
}
SConnectRsp
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
int32_t
maxUsers
;
int32_t
maxDbs
;
int32_t
maxTimeSeries
;
int32_t
maxStreams
;
int32_t
accessState
;
// Configured only by command
int64_t
maxStorage
;
// In unit of GB
}
SCreateAcctReq
,
SAlterAcctReq
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_PASSWORD_LEN
];
int32_t
maxUsers
;
int32_t
maxDbs
;
int32_t
maxTimeSeries
;
int32_t
maxStreams
;
int32_t
accessState
;
// Configured only by command
int64_t
maxStorage
;
// In unit of GB
}
SCreateAcctReq
,
SAlterAcctReq
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
...
...
@@ -1152,45 +870,7 @@ typedef struct {
char
desc
[
TSDB_STEP_DESC_LEN
];
}
SStartupReq
;
// mq related
typedef
struct
{
}
SMqConnectReq
;
typedef
struct
{
}
SMqConnectRsp
;
typedef
struct
{
}
SMqDisconnectReq
;
typedef
struct
{
}
SMqDisconnectRsp
;
typedef
struct
{
}
SMqAckReq
;
typedef
struct
{
}
SMqAckRsp
;
typedef
struct
{
}
SMqResetReq
;
typedef
struct
{
}
SMqResetRsp
;
// mq related end
typedef
struct
{
/* data */
}
SSubmitReq
;
typedef
struct
{
/* data */
}
SSubmitRsp
;
typedef
struct
{
/* data */
}
SSubmitReqReader
;
typedef
struct
{
typedef
struct
SSubQueryMsg
{
SMsgHead
header
;
uint64_t
sId
;
uint64_t
queryId
;
...
...
@@ -1557,6 +1237,318 @@ typedef struct {
#pragma pack(pop)
static
FORCE_INLINE
int32_t
tEncodeSMsgHead
(
void
**
buf
,
const
SMsgHead
*
pMsg
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pMsg
->
contLen
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pMsg
->
vgId
);
return
tlen
;
}
typedef
struct
SMqHbRsp
{
int8_t
status
;
//idle or not
int8_t
vnodeChanged
;
int8_t
epChanged
;
// should use new epset
int8_t
reserved
;
SEpSet
epSet
;
}
SMqHbRsp
;
static
FORCE_INLINE
int
taosEncodeSMqHbRsp
(
void
**
buf
,
const
SMqHbRsp
*
pRsp
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
status
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
vnodeChanged
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pRsp
->
epChanged
);
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pRsp
->
epSet
);
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqHbRsp
(
void
*
buf
,
SMqHbRsp
*
pRsp
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
status
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
vnodeChanged
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pRsp
->
epChanged
);
buf
=
taosDecodeSEpSet
(
buf
,
&
pRsp
->
epSet
);
return
buf
;
}
typedef
struct
SMqHbOneTopicBatchRsp
{
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
SArray
*
rsps
;
// SArray<SMqHbRsp>
}
SMqHbOneTopicBatchRsp
;
static
FORCE_INLINE
int
taosEncodeSMqHbOneTopicBatchRsp
(
void
**
buf
,
const
SMqHbOneTopicBatchRsp
*
pBatchRsp
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeString
(
buf
,
pBatchRsp
->
topicName
);
int32_t
sz
=
taosArrayGetSize
(
pBatchRsp
->
rsps
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbRsp
*
pRsp
=
(
SMqHbRsp
*
)
taosArrayGet
(
pBatchRsp
->
rsps
,
i
);
tlen
+=
taosEncodeSMqHbRsp
(
buf
,
pRsp
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqHbOneTopicBatchRsp
(
void
*
buf
,
SMqHbOneTopicBatchRsp
*
pBatchRsp
)
{
int32_t
sz
;
buf
=
taosDecodeStringTo
(
buf
,
pBatchRsp
->
topicName
);
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pBatchRsp
->
rsps
=
taosArrayInit
(
sz
,
sizeof
(
SMqHbRsp
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbRsp
rsp
;
buf
=
taosDecodeSMqHbRsp
(
buf
,
&
rsp
);
buf
=
taosArrayPush
(
pBatchRsp
->
rsps
,
&
rsp
);
}
return
buf
;
}
typedef
struct
SMqHbBatchRsp
{
int64_t
consumerId
;
SArray
*
batchRsps
;
// SArray<SMqHbOneTopicBatchRsp>
}
SMqHbBatchRsp
;
static
FORCE_INLINE
int
taosEncodeSMqHbBatchRsp
(
void
**
buf
,
const
SMqHbBatchRsp
*
pBatchRsp
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pBatchRsp
->
consumerId
);
int32_t
sz
;
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbOneTopicBatchRsp
*
pRsp
=
(
SMqHbOneTopicBatchRsp
*
)
taosArrayGet
(
pBatchRsp
->
batchRsps
,
i
);
tlen
+=
taosEncodeSMqHbOneTopicBatchRsp
(
buf
,
pRsp
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqHbBatchRsp
(
void
*
buf
,
SMqHbBatchRsp
*
pBatchRsp
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pBatchRsp
->
consumerId
);
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pBatchRsp
->
batchRsps
=
taosArrayInit
(
sz
,
sizeof
(
SMqHbOneTopicBatchRsp
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbOneTopicBatchRsp
rsp
;
buf
=
taosDecodeSMqHbOneTopicBatchRsp
(
buf
,
&
rsp
);
buf
=
taosArrayPush
(
pBatchRsp
->
batchRsps
,
&
rsp
);
}
return
buf
;
}
typedef
struct
{
int32_t
keyLen
;
int32_t
valueLen
;
void
*
key
;
void
*
value
;
}
SKv
;
typedef
struct
{
int32_t
connId
;
int32_t
hbType
;
}
SClientHbKey
;
typedef
struct
{
SClientHbKey
connKey
;
SHashObj
*
info
;
// hash<Skv.key, Skv>
}
SClientHbReq
;
typedef
struct
{
int64_t
reqId
;
SArray
*
reqs
;
// SArray<SClientHbReq>
}
SClientHbBatchReq
;
typedef
struct
{
SClientHbKey
connKey
;
int32_t
status
;
int32_t
bodyLen
;
void
*
body
;
}
SClientHbRsp
;
typedef
struct
{
int64_t
reqId
;
int64_t
rspId
;
SArray
*
rsps
;
// SArray<SClientHbRsp>
}
SClientHbBatchRsp
;
static
FORCE_INLINE
uint32_t
hbKeyHashFunc
(
const
char
*
key
,
uint32_t
keyLen
)
{
return
taosIntHash_64
(
key
,
keyLen
);
}
int
tSerializeSClientHbReq
(
void
**
buf
,
const
SClientHbReq
*
pReq
);
void
*
tDeserializeSClientHbReq
(
void
*
buf
,
SClientHbReq
*
pReq
);
int
tSerializeSClientHbRsp
(
void
**
buf
,
const
SClientHbRsp
*
pRsp
);
void
*
tDeserializeSClientHbRsp
(
void
*
buf
,
SClientHbRsp
*
pRsp
);
static
FORCE_INLINE
void
tFreeClientHbReq
(
void
*
pReq
)
{
SClientHbReq
*
req
=
(
SClientHbReq
*
)
pReq
;
if
(
req
->
info
)
taosHashCleanup
(
req
->
info
);
}
int
tSerializeSClientHbBatchReq
(
void
**
buf
,
const
SClientHbBatchReq
*
pReq
);
void
*
tDeserializeSClientHbBatchReq
(
void
*
buf
,
SClientHbBatchReq
*
pReq
);
static
FORCE_INLINE
void
tFreeClientHbBatchReq
(
void
*
pReq
,
bool
deep
)
{
SClientHbBatchReq
*
req
=
(
SClientHbBatchReq
*
)
pReq
;
if
(
deep
)
{
taosArrayDestroyEx
(
req
->
reqs
,
tFreeClientHbReq
);
}
else
{
taosArrayDestroy
(
req
->
reqs
);
}
free
(
pReq
);
}
int
tSerializeSClientHbBatchRsp
(
void
**
buf
,
const
SClientHbBatchRsp
*
pBatchRsp
);
void
*
tDeserializeSClientHbBatchRsp
(
void
*
buf
,
SClientHbBatchRsp
*
pBatchRsp
);
static
FORCE_INLINE
int
taosEncodeSKv
(
void
**
buf
,
const
SKv
*
pKv
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pKv
->
keyLen
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pKv
->
valueLen
);
tlen
+=
taosEncodeBinary
(
buf
,
pKv
->
key
,
pKv
->
keyLen
);
tlen
+=
taosEncodeBinary
(
buf
,
pKv
->
value
,
pKv
->
valueLen
);
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSKv
(
void
*
buf
,
SKv
*
pKv
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pKv
->
keyLen
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pKv
->
valueLen
);
buf
=
taosDecodeBinary
(
buf
,
&
pKv
->
key
,
pKv
->
keyLen
);
buf
=
taosDecodeBinary
(
buf
,
&
pKv
->
value
,
pKv
->
valueLen
);
return
buf
;
}
static
FORCE_INLINE
int
taosEncodeSClientHbKey
(
void
**
buf
,
const
SClientHbKey
*
pKey
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pKey
->
connId
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pKey
->
hbType
);
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSClientHbKey
(
void
*
buf
,
SClientHbKey
*
pKey
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pKey
->
connId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pKey
->
hbType
);
return
buf
;
}
typedef
struct
SMqHbVgInfo
{
int32_t
vgId
;
}
SMqHbVgInfo
;
static
FORCE_INLINE
int
taosEncodeSMqVgInfo
(
void
**
buf
,
const
SMqHbVgInfo
*
pVgInfo
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pVgInfo
->
vgId
);
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqVgInfo
(
void
*
buf
,
SMqHbVgInfo
*
pVgInfo
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pVgInfo
->
vgId
);
return
buf
;
}
typedef
struct
SMqHbTopicInfo
{
int32_t
epoch
;
int64_t
topicUid
;
char
name
[
TSDB_TOPIC_FNAME_LEN
];
SArray
*
pVgInfo
;
}
SMqHbTopicInfo
;
static
FORCE_INLINE
int
taosEncodeSMqHbTopicInfoMsg
(
void
**
buf
,
const
SMqHbTopicInfo
*
pTopicInfo
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pTopicInfo
->
epoch
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pTopicInfo
->
topicUid
);
tlen
+=
taosEncodeString
(
buf
,
pTopicInfo
->
name
);
int32_t
sz
=
taosArrayGetSize
(
pTopicInfo
->
pVgInfo
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbVgInfo
*
pVgInfo
=
(
SMqHbVgInfo
*
)
taosArrayGet
(
pTopicInfo
->
pVgInfo
,
i
);
tlen
+=
taosEncodeSMqVgInfo
(
buf
,
pVgInfo
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqHbTopicInfoMsg
(
void
*
buf
,
SMqHbTopicInfo
*
pTopicInfo
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pTopicInfo
->
epoch
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pTopicInfo
->
topicUid
);
buf
=
taosDecodeStringTo
(
buf
,
pTopicInfo
->
name
);
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pTopicInfo
->
pVgInfo
=
taosArrayInit
(
sz
,
sizeof
(
SMqHbVgInfo
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbVgInfo
vgInfo
;
buf
=
taosDecodeSMqVgInfo
(
buf
,
&
vgInfo
);
taosArrayPush
(
pTopicInfo
->
pVgInfo
,
&
vgInfo
);
}
return
buf
;
}
typedef
struct
SMqHbMsg
{
int32_t
status
;
// ask hb endpoint
int32_t
epoch
;
int64_t
consumerId
;
SArray
*
pTopics
;
// SArray<SMqHbTopicInfo>
}
SMqHbMsg
;
static
FORCE_INLINE
int
taosEncodeSMqMsg
(
void
**
buf
,
const
SMqHbMsg
*
pMsg
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pMsg
->
status
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pMsg
->
epoch
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pMsg
->
consumerId
);
int32_t
sz
=
taosArrayGetSize
(
pMsg
->
pTopics
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbTopicInfo
*
topicInfo
=
(
SMqHbTopicInfo
*
)
taosArrayGet
(
pMsg
->
pTopics
,
i
);
tlen
+=
taosEncodeSMqHbTopicInfoMsg
(
buf
,
topicInfo
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
taosDecodeSMqMsg
(
void
*
buf
,
SMqHbMsg
*
pMsg
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pMsg
->
status
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pMsg
->
epoch
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pMsg
->
consumerId
);
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pMsg
->
pTopics
=
taosArrayInit
(
sz
,
sizeof
(
SMqHbTopicInfo
));
for
(
int
i
=
0
;
i
<
sz
;
i
++
)
{
SMqHbTopicInfo
topicInfo
;
buf
=
taosDecodeSMqHbTopicInfoMsg
(
buf
,
&
topicInfo
);
taosArrayPush
(
pMsg
->
pTopics
,
&
topicInfo
);
}
return
buf
;
}
typedef
struct
SMqSetCVgReq
{
int32_t
vgId
;
int64_t
consumerId
;
char
topicName
[
TSDB_TOPIC_FNAME_LEN
];
char
cGroup
[
TSDB_CONSUMER_GROUP_LEN
];
char
*
sql
;
char
*
logicalPlan
;
char
*
physicalPlan
;
SArray
*
tasks
;
// SArray<SSubQueryMsg>
}
SMqSetCVgReq
;
static
FORCE_INLINE
int32_t
tEncodeSMqSetCVgReq
(
void
**
buf
,
const
SMqSetCVgReq
*
pReq
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
vgId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
consumerId
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
topicName
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
cGroup
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
sql
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
logicalPlan
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
physicalPlan
);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDecodeSMqSetCVgReq
(
void
*
buf
,
SMqSetCVgReq
*
pReq
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
vgId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
consumerId
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
topicName
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
cGroup
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
sql
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
logicalPlan
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
physicalPlan
);
pReq
->
tasks
=
NULL
;
return
buf
;
}
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mnode/impl/CMakeLists.txt
浏览文件 @
2f003140
...
...
@@ -7,6 +7,7 @@ target_include_directories(
)
target_link_libraries
(
mnode
PRIVATE scheduler
PRIVATE sdb
PRIVATE wal
PRIVATE transport
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
2f003140
...
...
@@ -26,6 +26,7 @@
#include "tlog.h"
#include "trpc.h"
#include "ttimer.h"
#include "scheduler.h"
#include "mnode.h"
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
2f003140
...
...
@@ -13,7 +13,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "mndConsumer.h"
#include "mndDb.h"
#include "mndDnode.h"
...
...
source/libs/scheduler/CMakeLists.txt
浏览文件 @
2f003140
...
...
@@ -9,7 +9,7 @@ target_include_directories(
target_link_libraries
(
scheduler
P
RIVATE
os util planner qcom common catalog transport
P
UBLIC
os util planner qcom common catalog transport
)
if
(
${
BUILD_TEST
}
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录