Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
35b82d79
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看板
未验证
提交
35b82d79
编写于
3月 09, 2022
作者:
L
Liu Jicong
提交者:
GitHub
3月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10657 from taosdata/feature/tq
define stream token
上级
3d248b72
913e8d70
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
58 addition
and
22 deletion
+58
-22
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+17
-1
source/dnode/vnode/src/inc/tqPush.h
source/dnode/vnode/src/inc/tqPush.h
+8
-5
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+20
-0
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+1
-1
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+1
-1
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+0
-3
source/libs/wal/test/walMetaTest.cpp
source/libs/wal/test/walMetaTest.cpp
+11
-11
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
35b82d79
...
...
@@ -59,7 +59,7 @@ typedef struct {
SWalCfg
walCfg
;
uint32_t
hashBegin
;
uint32_t
hashEnd
;
int8_t
hashMethod
;
int8_t
hashMethod
;
}
SVnodeCfg
;
typedef
struct
{
...
...
@@ -202,6 +202,22 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad);
/* ------------------------- TQ READ --------------------------- */
enum
{
TQ_STREAM_TOKEN__DATA
=
1
,
TQ_STREAM_TOKEN__WATERMARK
,
TQ_STREAM_TOKEN__CHECKPOINT
,
};
typedef
struct
{
int8_t
type
;
int8_t
reserved
[
7
];
union
{
void
*
data
;
int64_t
wmTs
;
int64_t
checkpointId
;
};
}
STqStreamToken
;
STqReadHandle
*
tqInitSubmitMsgScanner
(
SMeta
*
pMeta
);
static
FORCE_INLINE
void
tqReadHandleSetColIdList
(
STqReadHandle
*
pReadHandle
,
SArray
*
pColIdList
)
{
...
...
source/dnode/vnode/src/inc/tqPush.h
浏览文件 @
35b82d79
...
...
@@ -16,9 +16,11 @@
#ifndef _TQ_PUSH_H_
#define _TQ_PUSH_H_
#include "executor.h"
#include "thash.h"
#include "trpc.h"
#include "ttimer.h"
#include "vnode.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -39,11 +41,12 @@ typedef struct {
}
STqClientPusher
;
typedef
struct
{
int8_t
type
;
int8_t
nodeType
;
int8_t
reserved
[
6
];
int64_t
streamId
;
SEpSet
epSet
;
int8_t
type
;
int8_t
nodeType
;
int8_t
reserved
[
6
];
int64_t
streamId
;
qTaskInfo_t
task
;
// TODO sync function
}
STqStreamPusher
;
typedef
struct
{
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
35b82d79
...
...
@@ -67,6 +67,26 @@ void tqClose(STQ* pTq) {
}
int
tqPushMsg
(
STQ
*
pTq
,
void
*
msg
,
tmsg_t
msgType
,
int64_t
version
)
{
if
(
msgType
!=
TDMT_VND_SUBMIT
)
return
0
;
void
*
pIter
=
taosHashIterate
(
pTq
->
tqPushMgr
->
pHash
,
NULL
);
while
(
pIter
!=
NULL
)
{
STqPusher
*
pusher
=
*
(
STqPusher
**
)
pIter
;
if
(
pusher
->
type
==
TQ_PUSHER_TYPE__STREAM
)
{
STqStreamPusher
*
streamPusher
=
(
STqStreamPusher
*
)
pusher
;
// repack
STqStreamToken
*
token
=
malloc
(
sizeof
(
STqStreamToken
));
if
(
token
==
NULL
)
{
taosHashCancelIterate
(
pTq
->
tqPushMgr
->
pHash
,
pIter
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
token
->
type
=
TQ_STREAM_TOKEN__DATA
;
token
->
data
=
msg
;
// set input
// exec
}
// send msg to ep
}
// iterate hash
// process all msg
// if waiting
...
...
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
35b82d79
...
...
@@ -73,7 +73,7 @@ STqStreamPusher* tqAddStreamPusher(STqPushMgr* pushMgr, int64_t streamId, SEpSet
streamPusher
->
type
=
TQ_PUSHER_TYPE__STREAM
;
streamPusher
->
nodeType
=
0
;
streamPusher
->
streamId
=
streamId
;
memcpy
(
&
streamPusher
->
epSet
,
pEpSet
,
sizeof
(
SEpSet
));
/*memcpy(&streamPusher->epSet, pEpSet, sizeof(SEpSet));*/
if
(
taosHashPut
(
pushMgr
->
pHash
,
&
streamId
,
sizeof
(
int64_t
),
&
streamPusher
,
sizeof
(
void
*
))
<
0
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
35b82d79
...
...
@@ -12,7 +12,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "vnode.h"
...
...
@@ -37,6 +36,7 @@ int32_t tqReadHandleSetMsg(STqReadHandle* pReadHandle, SSubmitReq* pMsg, int64_t
pMsg
->
length
=
htonl
(
pMsg
->
length
);
pMsg
->
numOfBlocks
=
htonl
(
pMsg
->
numOfBlocks
);
// iterate and convert
if
(
tInitSubmitMsgIter
(
pMsg
,
&
pReadHandle
->
msgIter
)
<
0
)
return
-
1
;
while
(
true
)
{
if
(
tGetSubmitMsgNext
(
&
pReadHandle
->
msgIter
,
&
pReadHandle
->
pBlock
)
<
0
)
return
-
1
;
...
...
source/libs/wal/src/walWrite.c
浏览文件 @
35b82d79
...
...
@@ -34,9 +34,6 @@ int32_t walCommit(SWal *pWal, int64_t ver) {
int32_t
walRollback
(
SWal
*
pWal
,
int64_t
ver
)
{
int
code
;
char
fnameStr
[
WAL_FILE_LEN
];
if
(
ver
==
pWal
->
vers
.
lastVer
)
{
return
0
;
}
if
(
ver
>
pWal
->
vers
.
lastVer
||
ver
<
pWal
->
vers
.
commitVer
)
{
terrno
=
TSDB_CODE_WAL_INVALID_VER
;
return
-
1
;
...
...
source/libs/wal/test/walMetaTest.cpp
浏览文件 @
35b82d79
...
...
@@ -124,13 +124,8 @@ class WalRetentionEnv : public ::testing::Test {
void
SetUp
()
override
{
SWalCfg
cfg
;
cfg
.
rollPeriod
=
-
1
,
cfg
.
segSize
=
-
1
,
cfg
.
retentionPeriod
=
-
1
,
cfg
.
retentionSize
=
0
,
cfg
.
rollPeriod
=
0
,
cfg
.
vgId
=
0
,
cfg
.
level
=
TAOS_WAL_FSYNC
;
cfg
.
rollPeriod
=
-
1
,
cfg
.
segSize
=
-
1
,
cfg
.
retentionPeriod
=
-
1
,
cfg
.
retentionSize
=
0
,
cfg
.
rollPeriod
=
0
,
cfg
.
vgId
=
0
,
cfg
.
level
=
TAOS_WAL_FSYNC
;
pWal
=
walOpen
(
pathName
,
&
cfg
);
ASSERT
(
pWal
!=
NULL
);
}
...
...
@@ -241,6 +236,12 @@ TEST_F(WalCleanEnv, rollback) {
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
i
);
}
code
=
walRollback
(
pWal
,
12
);
ASSERT_NE
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
9
);
code
=
walRollback
(
pWal
,
9
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
8
);
code
=
walRollback
(
pWal
,
5
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
4
);
...
...
@@ -324,7 +325,7 @@ TEST_F(WalKeepEnv, readHandleRead) {
TEST_F
(
WalRetentionEnv
,
repairMeta1
)
{
walResetEnv
();
int
code
;
int
i
;
for
(
i
=
0
;
i
<
100
;
i
++
)
{
char
newStr
[
100
];
...
...
@@ -336,14 +337,14 @@ TEST_F(WalRetentionEnv, repairMeta1) {
TearDown
();
//getchar();
//
getchar();
char
buf
[
100
];
sprintf
(
buf
,
"%s/meta-ver%d"
,
pathName
,
0
);
taosRemoveFile
(
buf
);
sprintf
(
buf
,
"%s/meta-ver%d"
,
pathName
,
1
);
taosRemoveFile
(
buf
);
SetUp
();
//getchar();
//
getchar();
ASSERT_EQ
(
pWal
->
vers
.
lastVer
,
99
);
...
...
@@ -401,5 +402,4 @@ TEST_F(WalRetentionEnv, repairMeta1) {
EXPECT_EQ
(
newStr
[
j
],
pRead
->
pHead
->
head
.
body
[
j
]);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录