Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fed05bb6
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看板
提交
fed05bb6
编写于
11月 16, 2021
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add memallocator dependency
上级
6cb65f43
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
85 addition
and
60 deletion
+85
-60
include/dnode/vnode/tq/tq.h
include/dnode/vnode/tq/tq.h
+70
-54
include/libs/wal/wal.h
include/libs/wal/wal.h
+3
-3
source/dnode/vnode/tq/inc/tqMetaStore.h
source/dnode/vnode/tq/inc/tqMetaStore.h
+0
-1
source/libs/wal/src/wal.c
source/libs/wal/src/wal.c
+12
-2
未找到文件。
include/dnode/vnode/tq/tq.h
浏览文件 @
fed05bb6
...
...
@@ -18,6 +18,7 @@
#include "os.h"
#include "tutil.h"
#include "mallocator.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -37,19 +38,19 @@ typedef struct TmqOneAck {
typedef
struct
TmqAcks
{
int32_t
ackNum
;
//should be sorted
//
should be sorted
TmqOneAck
acks
[];
}
TmqAcks
;
//TODO: put msgs into common
//
TODO: put msgs into common
typedef
struct
TmqConnectReq
{
TmqMsgHead
head
;
TmqAcks
acks
;
TmqAcks
acks
;
}
TmqConnectReq
;
typedef
struct
TmqConnectRsp
{
TmqMsgHead
head
;
int8_t
status
;
int8_t
status
;
}
TmqConnectRsp
;
typedef
struct
TmqDisconnectReq
{
...
...
@@ -58,12 +59,12 @@ typedef struct TmqDisconnectReq {
typedef
struct
TmqDisconnectRsp
{
TmqMsgHead
head
;
int8_t
status
;
int8_t
status
;
}
TmqDisconnectRsp
;
typedef
struct
TmqConsumeReq
{
TmqMsgHead
head
;
TmqAcks
acks
;
TmqAcks
acks
;
}
TmqConsumeReq
;
typedef
struct
TmqMsgContent
{
...
...
@@ -80,90 +81,105 @@ typedef struct TmqConsumeRsp {
typedef
struct
TmqSubscribeReq
{
TmqMsgHead
head
;
int32_t
topicNum
;
int64_t
topic
[];
int32_t
topicNum
;
int64_t
topic
[];
}
TmqSubscribeReq
;
typedef
struct
tmqSubscribeRsp
{
TmqMsgHead
head
;
int64_t
vgId
;
char
ep
[
TSDB_EP_LEN
];
//
TSDB_EP_LEN
int64_t
vgId
;
char
ep
[
TSDB_EP_LEN
];
//
TSDB_EP_LEN
}
TmqSubscribeRsp
;
typedef
struct
TmqHeartbeatReq
{
}
TmqHeartbeatReq
;
typedef
struct
TmqHeartbeatRsp
{
}
TmqHeartbeatRsp
;
typedef
struct
TqTopicVhandle
{
int64_t
topicId
;
//executor for filter
void
*
filterExec
;
//callback for mnode
//trigger when vnode list associated topic change
//
executor for filter
void
*
filterExec
;
//
callback for mnode
//
trigger when vnode list associated topic change
void
*
(
*
mCallback
)(
void
*
,
void
*
);
}
TqTopicVhandle
;
typedef
struct
STQ
{
//the collection of group handle
//the handle of kvstore
}
STQ
;
#define TQ_BUFFER_SIZE 8
//TODO: define a serializer and deserializer
//
TODO: define a serializer and deserializer
typedef
struct
TqBufferItem
{
int64_t
offset
;
//executors are identical but not concurrent
//so it must be a copy in each item
void
*
executor
;
//
executors are identical but not concurrent
//
so it must be a copy in each item
void
*
executor
;
int64_t
size
;
void
*
content
;
void
*
content
;
}
TqBufferItem
;
typedef
struct
TqBufferHandle
{
//char* topic; //c style, end with '\0'
//int64_t cgId;
//void* ahandle;
int64_t
nextConsumeOffset
;
int64_t
topicId
;
int32_t
head
;
int32_t
tail
;
//
char* topic; //c style, end with '\0'
//
int64_t cgId;
//
void* ahandle;
int64_t
nextConsumeOffset
;
int64_t
topicId
;
int32_t
head
;
int32_t
tail
;
TqBufferItem
buffer
[
TQ_BUFFER_SIZE
];
}
TqBufferHandle
;
typedef
struct
TqListHandle
{
TqBufferHandle
bufHandle
;
TqBufferHandle
bufHandle
;
struct
TqListHandle
*
next
;
}
TqListHandle
;
typedef
struct
TqGroupHandle
{
int64_t
cId
;
int64_t
cgId
;
void
*
ahandle
;
int32_t
topicNum
;
TqListHandle
*
head
;
int64_t
cId
;
int64_t
cgId
;
void
*
ahandle
;
int32_t
topicNum
;
TqListHandle
*
head
;
}
TqGroupHandle
;
typedef
struct
TqQueryExec
{
void
*
src
;
void
*
src
;
TqBufferItem
*
dest
;
void
*
executor
;
void
*
executor
;
}
TqQueryExec
;
typedef
struct
TqQueryMsg
{
TqQueryExec
*
exec
;
struct
TqQueryMsg
*
next
;
TqQueryExec
*
exec
;
struct
TqQueryMsg
*
next
;
}
TqQueryMsg
;
//init in each vnode
STQ
*
tqInit
(
void
*
ref_func
(
void
*
),
void
*
unref_func
(
void
*
));
void
tqCleanUp
(
STQ
*
);
typedef
struct
TqLogReader
{
void
*
logHandle
;
int32_t
(
*
walRead
)(
void
*
logHandle
,
void
**
data
,
int64_t
ver
);
int64_t
(
*
walGetFirstVer
)(
void
*
logHandle
);
int64_t
(
*
walGetSnapshotVer
)(
void
*
logHandle
);
int64_t
(
*
walGetLastVer
)(
void
*
logHandle
);
}
TqLogReader
;
typedef
struct
TqConfig
{
// TODO
}
TqConfig
;
typedef
struct
STQ
{
// the collection of group handle
// the handle of kvstore
const
char
*
path
;
TqConfig
*
tqConfig
;
TqLogReader
*
tqLogReader
;
SMemAllocatorFactory
*
allocFac
;
}
STQ
;
// open in each vnode
STQ
*
tqOpen
(
const
char
*
path
,
TqConfig
*
tqConfig
,
TqLogReader
*
tqLogReader
,
SMemAllocatorFactory
*
allocFac
);
void
tqDestroy
(
STQ
*
);
//void* will be replace by a msg type
//
void* will be replace by a msg type
int
tqPushMsg
(
STQ
*
,
void
*
msg
,
int64_t
version
);
int
tqCommit
(
STQ
*
);
...
...
@@ -179,16 +195,16 @@ int tqRegisterContext(TqGroupHandle*, void* ahandle);
int
tqLaunchQuery
(
TqGroupHandle
*
);
int
tqSendLaunchQuery
(
TqGroupHandle
*
);
int
tqSerializeGroupHandle
(
TqGroupHandle
*
gHandle
,
void
**
ppBytes
);
void
*
tqSerializeListHandle
(
TqListHandle
*
listHandle
,
void
*
ptr
);
void
*
tqSerializeBufHandle
(
TqBufferHandle
*
bufHandle
,
void
*
ptr
);
void
*
tqSerializeBufItem
(
TqBufferItem
*
bufItem
,
void
*
ptr
);
int
tqSerializeGroupHandle
(
TqGroupHandle
*
gHandle
,
void
**
ppBytes
);
void
*
tqSerializeListHandle
(
TqListHandle
*
listHandle
,
void
*
ptr
);
void
*
tqSerializeBufHandle
(
TqBufferHandle
*
bufHandle
,
void
*
ptr
);
void
*
tqSerializeBufItem
(
TqBufferItem
*
bufItem
,
void
*
ptr
);
const
void
*
tqDeserializeGroupHandle
(
const
void
*
pBytes
,
TqGroupHandle
*
ghandle
);
const
void
*
tqDeserializeBufHandle
(
const
void
*
pBytes
,
TqBufferHandle
*
bufHandle
);
const
void
*
tqDeserializeBufItem
(
const
void
*
pBytes
,
TqBufferItem
*
bufItem
);
const
void
*
tqDeserializeGroupHandle
(
const
void
*
pBytes
,
TqGroupHandle
*
ghandle
);
const
void
*
tqDeserializeBufHandle
(
const
void
*
pBytes
,
TqBufferHandle
*
bufHandle
);
const
void
*
tqDeserializeBufItem
(
const
void
*
pBytes
,
TqBufferItem
*
bufItem
);
int
tqGetGHandleSSize
(
const
TqGroupHandle
*
gHandle
);
int
tqGetGHandleSSize
(
const
TqGroupHandle
*
gHandle
);
int
tqBufHandleSSize
();
int
tqBufItemSSize
();
...
...
include/libs/wal/wal.h
浏览文件 @
fed05bb6
...
...
@@ -75,9 +75,9 @@ int32_t walRead(SWal *, SWalHead **, int64_t ver);
int32_t
walReadWithFp
(
SWal
*
,
FWalWrite
writeFp
,
int64_t
verStart
,
int32_t
readNum
);
// lifecycle check
int
32_t
wal
FirstVer
(
SWal
*
);
int
32_t
walPersisted
Ver
(
SWal
*
);
int
32_t
wal
LastVer
(
SWal
*
);
int
64_t
walGet
FirstVer
(
SWal
*
);
int
64_t
walGetSnapshot
Ver
(
SWal
*
);
int
64_t
walGet
LastVer
(
SWal
*
);
// int32_t walDataCorrupted(SWal*);
#ifdef __cplusplus
...
...
source/dnode/vnode/tq/inc/tqMetaStore.h
浏览文件 @
fed05bb6
...
...
@@ -17,7 +17,6 @@
#define _TQ_META_STORE_H_
#include "os.h"
#include "tq.h"
#ifdef __cplusplus
...
...
source/libs/wal/src/wal.c
浏览文件 @
fed05bb6
...
...
@@ -27,10 +27,20 @@ void walClose(SWal *pWal) {}
void
walFsync
(
SWal
*
pWal
,
bool
force
)
{}
int64_t
walWrite
(
SWal
*
pWal
,
int64_t
index
,
void
*
body
,
int32_t
bodyLen
)
{}
int64_t
walWrite
(
SWal
*
pWal
,
int64_t
index
,
void
*
body
,
int32_t
bodyLen
)
{
return
0
;
}
int32_t
walCommit
(
SWal
*
pWal
,
int64_t
ver
)
{
return
0
;
}
int32_t
walRollback
(
SWal
*
pWal
,
int64_t
ver
)
{
return
0
;
}
int32_t
walPrune
(
SWal
*
pWal
,
int64_t
ver
)
{
return
0
;
}
\ No newline at end of file
int32_t
walPrune
(
SWal
*
pWal
,
int64_t
ver
)
{
return
0
;
}
int32_t
walRead
(
SWal
*
,
SWalHead
**
,
int64_t
ver
);
int32_t
walReadWithFp
(
SWal
*
,
FWalWrite
writeFp
,
int64_t
verStart
,
int32_t
readNum
);
int64_t
walGetFirstVer
(
SWal
*
);
int64_t
walGetSnapshotVer
(
SWal
*
);
int64_t
walGetLastVer
(
SWal
*
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录