Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9d031f4d
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
9d031f4d
编写于
5月 28, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into enh/tsdb_optimize
上级
5bcc9c54
884e7d0d
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
53 addition
and
27 deletion
+53
-27
docs/en/07-develop/09-udf.md
docs/en/07-develop/09-udf.md
+14
-14
docs/en/14-reference/12-config/index.md
docs/en/14-reference/12-config/index.md
+1
-1
docs/zh/07-develop/09-udf.md
docs/zh/07-develop/09-udf.md
+1
-1
include/libs/wal/wal.h
include/libs/wal/wal.h
+3
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+16
-11
source/dnode/vnode/src/tq/tqRestore.c
source/dnode/vnode/src/tq/tqRestore.c
+10
-0
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+8
-0
未找到文件。
docs/en/07-develop/09-udf.md
浏览文件 @
9d031f4d
...
@@ -304,7 +304,7 @@ def start() -> bytes:
...
@@ -304,7 +304,7 @@ def start() -> bytes:
def reduce(inputs: datablock, buf: bytes) -> bytes
def reduce(inputs: datablock, buf: bytes) -> bytes
# deserialize buf to state
# deserialize buf to state
# reduce the inputs and state into new_state.
# reduce the inputs and state into new_state.
# use inputs.data(i,j) to access python o
jb
ect of location(i,j)
# use inputs.data(i,j) to access python o
bj
ect of location(i,j)
# serialize new_state into new_state_bytes
# serialize new_state into new_state_bytes
return new_state_bytes
return new_state_bytes
def finish(buf: bytes) -> output_type:
def finish(buf: bytes) -> output_type:
...
...
docs/en/14-reference/12-config/index.md
浏览文件 @
9d031f4d
...
@@ -111,7 +111,7 @@ The parameters described in this document by the effect that they have on the sy
...
@@ -111,7 +111,7 @@ The parameters described in this document by the effect that they have on the sy
| Attribute | Description |
| Attribute | Description |
| ------------- | ---------------------------------------------- |
| ------------- | ---------------------------------------------- |
| Applicable | Client/Server |
| Applicable | Client/Server |
| Meaning | The maximum waiting time to get ava
li
able conn |
| Meaning | The maximum waiting time to get ava
il
able conn |
| Value Range | 10-50000000(ms) |
| Value Range | 10-50000000(ms) |
| Default Value | 500000 |
| Default Value | 500000 |
...
...
docs/zh/07-develop/09-udf.md
浏览文件 @
9d031f4d
...
@@ -303,7 +303,7 @@ def start() -> bytes:
...
@@ -303,7 +303,7 @@ def start() -> bytes:
def reduce(inputs: datablock, buf: bytes) -> bytes
def reduce(inputs: datablock, buf: bytes) -> bytes
# deserialize buf to state
# deserialize buf to state
# reduce the inputs and state into new_state.
# reduce the inputs and state into new_state.
# use inputs.data(i,j) to access python o
jb
ect of location(i,j)
# use inputs.data(i,j) to access python o
bj
ect of location(i,j)
# serialize new_state into new_state_bytes
# serialize new_state into new_state_bytes
return new_state_bytes
return new_state_bytes
def finish(buf: bytes) -> output_type:
def finish(buf: bytes) -> output_type:
...
...
include/libs/wal/wal.h
浏览文件 @
9d031f4d
...
@@ -149,6 +149,7 @@ struct SWalReader {
...
@@ -149,6 +149,7 @@ struct SWalReader {
TdFilePtr
pIdxFile
;
TdFilePtr
pIdxFile
;
int64_t
curFileFirstVer
;
int64_t
curFileFirstVer
;
int64_t
curVersion
;
int64_t
curVersion
;
int64_t
skipToVersion
;
// skip data and jump to destination version, usually used by stream resume ignoring untreated data
int64_t
capacity
;
int64_t
capacity
;
TdThreadMutex
mutex
;
TdThreadMutex
mutex
;
SWalFilterCond
cond
;
SWalFilterCond
cond
;
...
@@ -200,6 +201,8 @@ int32_t walReaderSeekVer(SWalReader *pRead, int64_t ver);
...
@@ -200,6 +201,8 @@ int32_t walReaderSeekVer(SWalReader *pRead, int64_t ver);
int32_t
walNextValidMsg
(
SWalReader
*
pRead
);
int32_t
walNextValidMsg
(
SWalReader
*
pRead
);
int64_t
walReaderGetCurrentVer
(
const
SWalReader
*
pReader
);
int64_t
walReaderGetCurrentVer
(
const
SWalReader
*
pReader
);
int64_t
walReaderGetValidFirstVer
(
const
SWalReader
*
pReader
);
int64_t
walReaderGetValidFirstVer
(
const
SWalReader
*
pReader
);
int64_t
walReaderGetSkipToVersion
(
SWalReader
*
pReader
);
void
walReaderSetSkipToVersion
(
SWalReader
*
pReader
,
int64_t
ver
);
void
walReaderValidVersionRange
(
SWalReader
*
pReader
,
int64_t
*
sver
,
int64_t
*
ever
);
void
walReaderValidVersionRange
(
SWalReader
*
pReader
,
int64_t
*
sver
,
int64_t
*
ever
);
void
walReaderVerifyOffset
(
SWalReader
*
pWalReader
,
STqOffsetVal
*
pOffset
);
void
walReaderVerifyOffset
(
SWalReader
*
pWalReader
,
STqOffsetVal
*
pOffset
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
9d031f4d
...
@@ -1304,19 +1304,22 @@ int32_t tqProcessTaskPauseReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
...
@@ -1304,19 +1304,22 @@ int32_t tqProcessTaskPauseReq(STQ* pTq, int64_t sversion, char* msg, int32_t msg
int32_t
tqProcessTaskResumeReq
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
msg
,
int32_t
msgLen
)
{
int32_t
tqProcessTaskResumeReq
(
STQ
*
pTq
,
int64_t
sversion
,
char
*
msg
,
int32_t
msgLen
)
{
SVResumeStreamTaskReq
*
pReq
=
(
SVResumeStreamTaskReq
*
)
msg
;
SVResumeStreamTaskReq
*
pReq
=
(
SVResumeStreamTaskReq
*
)
msg
;
int32_t
vgId
=
pTq
->
pStreamMeta
->
vgId
;
SStreamTask
*
pTask
=
streamMetaAcquireTask
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
SStreamTask
*
pTask
=
streamMetaAcquireTask
(
pTq
->
pStreamMeta
,
pReq
->
taskId
);
if
(
pTask
)
{
if
(
pTask
)
{
atomic_store_8
(
&
pTask
->
status
.
taskStatus
,
pTask
->
status
.
keepTaskStatus
);
atomic_store_8
(
&
pTask
->
status
.
taskStatus
,
pTask
->
status
.
keepTaskStatus
);
// no lock needs to secure the access of the version
// no lock needs to secure the access of the version
if
(
pReq
->
igUntreated
&&
pTask
->
taskLevel
==
TASK_LEVEL__SOURCE
)
{
// discard all the data when the stream task is suspended.
if
(
pReq
->
igUntreated
&&
pTask
->
taskLevel
==
TASK_LEVEL__SOURCE
)
{
pTask
->
chkInfo
.
currentVer
=
sversion
;
// discard all the data when the stream task is suspended.
walReaderSeekVer
(
pTask
->
exec
.
pWalReader
,
sversion
);
walReaderSetSkipToVersion
(
pTask
->
exec
.
pWalReader
,
sversion
);
tqDebug
(
"vgId:%d s-task:%s resume to normal from the latest version:%"
PRId64
", vnode ver:%"
PRId64
", schedStatus:%d"
,
pTq
->
pStreamMeta
->
vgId
,
tqDebug
(
"vgId:%d s-task:%s resume to exec, prev paused version:%"
PRId64
", start from vnode ver:%"
PRId64
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
currentVer
,
sversion
,
pTask
->
status
.
schedStatus
);
", schedStatus:%d"
,
vgId
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
currentVer
,
sversion
,
pTask
->
status
.
schedStatus
);
}
else
{
// from the previous paused version and go on
}
else
{
// from the previous paused version and go on
tqDebug
(
"vgId:%d s-task:%s resume to
normal from paused ver:%"
PRId64
", vnode ver:%"
PRId64
", schedStatus:%d"
,
pTq
->
pStreamMeta
->
vgId
,
tqDebug
(
"vgId:%d s-task:%s resume to
exec, from paused ver:%"
PRId64
", vnode ver:%"
PRId64
", schedStatus:%d"
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
currentVer
,
sversion
,
pTask
->
status
.
schedStatus
);
vgId
,
pTask
->
id
.
idStr
,
pTask
->
chkInfo
.
currentVer
,
sversion
,
pTask
->
status
.
schedStatus
);
}
}
if
(
pTask
->
taskLevel
==
TASK_LEVEL__SOURCE
&&
taosQueueItemSize
(
pTask
->
inputQueue
->
queue
)
==
0
)
{
if
(
pTask
->
taskLevel
==
TASK_LEVEL__SOURCE
&&
taosQueueItemSize
(
pTask
->
inputQueue
->
queue
)
==
0
)
{
...
@@ -1325,6 +1328,8 @@ int32_t tqProcessTaskResumeReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms
...
@@ -1325,6 +1328,8 @@ int32_t tqProcessTaskResumeReq(STQ* pTq, int64_t sversion, char* msg, int32_t ms
streamSchedExec
(
pTask
);
streamSchedExec
(
pTask
);
}
}
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
streamMetaReleaseTask
(
pTq
->
pStreamMeta
,
pTask
);
}
else
{
tqError
(
"vgId:%d failed to find the s-task:0x%x for resume stream task"
,
vgId
,
pReq
->
taskId
);
}
}
return
0
;
return
0
;
...
@@ -1433,7 +1438,7 @@ int32_t tqStartStreamTasks(STQ* pTq) {
...
@@ -1433,7 +1438,7 @@ int32_t tqStartStreamTasks(STQ* pTq) {
int32_t
numOfTasks
=
taosArrayGetSize
(
pMeta
->
pTaskList
);
int32_t
numOfTasks
=
taosArrayGetSize
(
pMeta
->
pTaskList
);
if
(
numOfTasks
==
0
)
{
if
(
numOfTasks
==
0
)
{
tqInfo
(
"vgId:%d no stream tasks exist"
,
vgId
);
tqInfo
(
"vgId:%d no stream tasks exist"
,
vgId
);
taosWUnLockLatch
(
&
p
Tq
->
pStream
Meta
->
lock
);
taosWUnLockLatch
(
&
pMeta
->
lock
);
return
0
;
return
0
;
}
}
...
@@ -1441,7 +1446,7 @@ int32_t tqStartStreamTasks(STQ* pTq) {
...
@@ -1441,7 +1446,7 @@ int32_t tqStartStreamTasks(STQ* pTq) {
if
(
pMeta
->
walScanCounter
>
1
)
{
if
(
pMeta
->
walScanCounter
>
1
)
{
tqDebug
(
"vgId:%d wal read task has been launched, remain scan times:%d"
,
vgId
,
pMeta
->
walScanCounter
);
tqDebug
(
"vgId:%d wal read task has been launched, remain scan times:%d"
,
vgId
,
pMeta
->
walScanCounter
);
taosWUnLockLatch
(
&
p
Tq
->
pStream
Meta
->
lock
);
taosWUnLockLatch
(
&
pMeta
->
lock
);
return
0
;
return
0
;
}
}
...
@@ -1449,7 +1454,7 @@ int32_t tqStartStreamTasks(STQ* pTq) {
...
@@ -1449,7 +1454,7 @@ int32_t tqStartStreamTasks(STQ* pTq) {
if
(
pRunReq
==
NULL
)
{
if
(
pRunReq
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
tqError
(
"vgId:%d failed to create msg to start wal scanning to launch stream tasks, code:%s"
,
vgId
,
terrstr
());
tqError
(
"vgId:%d failed to create msg to start wal scanning to launch stream tasks, code:%s"
,
vgId
,
terrstr
());
taosWUnLockLatch
(
&
p
Tq
->
pStream
Meta
->
lock
);
taosWUnLockLatch
(
&
pMeta
->
lock
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1460,7 +1465,7 @@ int32_t tqStartStreamTasks(STQ* pTq) {
...
@@ -1460,7 +1465,7 @@ int32_t tqStartStreamTasks(STQ* pTq) {
SRpcMsg
msg
=
{.
msgType
=
TDMT_STREAM_TASK_RUN
,
.
pCont
=
pRunReq
,
.
contLen
=
sizeof
(
SStreamTaskRunReq
)};
SRpcMsg
msg
=
{.
msgType
=
TDMT_STREAM_TASK_RUN
,
.
pCont
=
pRunReq
,
.
contLen
=
sizeof
(
SStreamTaskRunReq
)};
tmsgPutToQueue
(
&
pTq
->
pVnode
->
msgCb
,
STREAM_QUEUE
,
&
msg
);
tmsgPutToQueue
(
&
pTq
->
pVnode
->
msgCb
,
STREAM_QUEUE
,
&
msg
);
taosWUnLockLatch
(
&
p
Tq
->
pStream
Meta
->
lock
);
taosWUnLockLatch
(
&
pMeta
->
lock
);
return
0
;
return
0
;
}
}
source/dnode/vnode/src/tq/tqRestore.c
浏览文件 @
9d031f4d
...
@@ -87,6 +87,16 @@ static int32_t doSetOffsetForWalReader(SStreamTask *pTask, int32_t vgId) {
...
@@ -87,6 +87,16 @@ static int32_t doSetOffsetForWalReader(SStreamTask *pTask, int32_t vgId) {
}
}
}
}
int64_t
skipToVer
=
walReaderGetSkipToVersion
(
pTask
->
exec
.
pWalReader
);
if
(
skipToVer
!=
0
&&
skipToVer
>
pTask
->
chkInfo
.
currentVer
)
{
int32_t
code
=
walReaderSeekVer
(
pTask
->
exec
.
pWalReader
,
skipToVer
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// no data in wal, quit
return
code
;
}
tqDebug
(
"vgId:%d s-task:%s wal reader jump to ver:%"
PRId64
,
vgId
,
pTask
->
id
.
idStr
,
skipToVer
);
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/libs/wal/src/walRead.c
浏览文件 @
9d031f4d
...
@@ -108,6 +108,14 @@ int32_t walNextValidMsg(SWalReader *pReader) {
...
@@ -108,6 +108,14 @@ int32_t walNextValidMsg(SWalReader *pReader) {
int64_t
walReaderGetCurrentVer
(
const
SWalReader
*
pReader
)
{
return
pReader
->
curVersion
;
}
int64_t
walReaderGetCurrentVer
(
const
SWalReader
*
pReader
)
{
return
pReader
->
curVersion
;
}
int64_t
walReaderGetValidFirstVer
(
const
SWalReader
*
pReader
)
{
return
walGetFirstVer
(
pReader
->
pWal
);
}
int64_t
walReaderGetValidFirstVer
(
const
SWalReader
*
pReader
)
{
return
walGetFirstVer
(
pReader
->
pWal
);
}
void
walReaderSetSkipToVersion
(
SWalReader
*
pReader
,
int64_t
ver
)
{
atomic_store_64
(
&
pReader
->
skipToVersion
,
ver
);
}
// this function is NOT multi-thread safe, and no need to be.
int64_t
walReaderGetSkipToVersion
(
SWalReader
*
pReader
)
{
int64_t
newVersion
=
pReader
->
skipToVersion
;
pReader
->
skipToVersion
=
0
;
return
newVersion
;
}
void
walReaderValidVersionRange
(
SWalReader
*
pReader
,
int64_t
*
sver
,
int64_t
*
ever
)
{
void
walReaderValidVersionRange
(
SWalReader
*
pReader
,
int64_t
*
sver
,
int64_t
*
ever
)
{
*
sver
=
walGetFirstVer
(
pReader
->
pWal
);
*
sver
=
walGetFirstVer
(
pReader
->
pWal
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录