Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b8ac811f
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看板
提交
b8ac811f
编写于
4月 14, 2023
作者:
L
liuyao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug
上级
5850a3ab
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
77 addition
and
20 deletion
+77
-20
include/libs/stream/streamState.h
include/libs/stream/streamState.h
+2
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+10
-7
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+1
-0
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+27
-1
source/libs/stream/src/streamUpdate.c
source/libs/stream/src/streamUpdate.c
+4
-1
tests/script/tsim/stream/basic2.sim
tests/script/tsim/stream/basic2.sim
+33
-11
未找到文件。
include/libs/stream/streamState.h
浏览文件 @
b8ac811f
...
...
@@ -88,6 +88,8 @@ int32_t streamStateGetByPos(SStreamState* pState, void* pos, void** pVal);
int32_t
streamStateDel
(
SStreamState
*
pState
,
const
SWinKey
*
key
);
int32_t
streamStateClear
(
SStreamState
*
pState
);
void
streamStateSetNumber
(
SStreamState
*
pState
,
int32_t
number
);
int32_t
streamStateSaveInfo
(
SStreamState
*
pState
,
void
*
pKey
,
int32_t
keyLen
,
void
*
pVal
,
int32_t
vLen
);
int32_t
streamStateGetInfo
(
SStreamState
*
pState
,
void
*
pKey
,
int32_t
keyLen
,
void
**
pVal
,
int32_t
*
pLen
);
int32_t
streamStateSessionAddIfNotExist
(
SStreamState
*
pState
,
SSessionKey
*
key
,
TSKEY
gap
,
void
**
pVal
,
int32_t
*
pVLen
);
int32_t
streamStateSessionPut
(
SStreamState
*
pState
,
const
SSessionKey
*
key
,
const
void
*
value
,
int32_t
vLen
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
b8ac811f
...
...
@@ -36,6 +36,7 @@ int32_t scanDebug = 0;
#define MULTI_READER_MAX_TABLE_NUM 5000
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
#define STREAM_SCAN_OP_NAME "StreamScanOperator"
typedef
struct
STableMergeScanExecInfo
{
SFileBlockLoadRecorder
blockRecorder
;
...
...
@@ -1771,7 +1772,7 @@ int32_t streamScanOperatorEncode(SStreamScanInfo* pInfo, void** pBuff) {
// other properties are recovered from the execution plan
void
streamScanOperatorDeocde
(
void
*
pBuff
,
int32_t
len
,
SStreamScanInfo
*
pInfo
)
{
if
(
!
pBuff
)
{
if
(
!
pBuff
||
len
==
0
)
{
return
;
}
...
...
@@ -2054,10 +2055,12 @@ FETCH_NEXT_BLOCK:
updateInfoDestoryColseWinSBF
(
pInfo
->
pUpdateInfo
);
doClearBufferedBlocks
(
pInfo
);
qDebug
(
"stream scan return empty, consume block %d"
,
totBlockNum
);
// void* buff = NULL;
// int32_t len = streamScanOperatorEncode(pInfo, &buff);
// todo(liuyao) save buff
// taosMemoryFreeClear(buff);
void
*
buff
=
NULL
;
int32_t
len
=
streamScanOperatorEncode
(
pInfo
,
&
buff
);
if
(
len
>
0
)
{
streamStateSaveInfo
(
pInfo
->
pState
,
STREAM_SCAN_OP_NAME
,
strlen
(
STREAM_SCAN_OP_NAME
),
buff
,
len
);
}
taosMemoryFreeClear
(
buff
);
return
NULL
;
}
...
...
@@ -2484,12 +2487,12 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pInfo
->
twAggSup
.
maxTs
=
INT64_MIN
;
pInfo
->
pState
=
NULL
;
// todo(liuyao) get buff from rocks db;
void
*
buff
=
NULL
;
int32_t
len
=
0
;
streamStateGetInfo
(
pTaskInfo
->
streamInfo
.
pState
,
STREAM_SCAN_OP_NAME
,
strlen
(
STREAM_SCAN_OP_NAME
),
&
buff
,
&
len
);
streamScanOperatorDeocde
(
buff
,
len
,
pInfo
);
setOperatorInfo
(
pOperator
,
"StreamScanOperator"
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
,
false
,
OP_NOT_OPENED
,
pInfo
,
setOperatorInfo
(
pOperator
,
STREAM_SCAN_OP_NAME
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
,
false
,
OP_NOT_OPENED
,
pInfo
,
pTaskInfo
);
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pRes
->
pDataBlock
);
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
b8ac811f
...
...
@@ -2846,6 +2846,7 @@ void initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup, uin
}
SStreamScanInfo
*
pScanInfo
=
downstream
->
info
;
pScanInfo
->
windowSup
=
(
SWindowSupporter
){.
pStreamAggSup
=
pAggSup
,
.
gap
=
pAggSup
->
gap
,
.
parentType
=
type
};
pScanInfo
->
pState
=
pAggSup
->
pState
;
if
(
!
pScanInfo
->
igCheckUpdate
&&
!
pScanInfo
->
pUpdateInfo
)
{
pScanInfo
->
pUpdateInfo
=
updateInfoInit
(
60000
,
TSDB_TIME_PRECISION_MILLI
,
pTwSup
->
waterMark
);
}
...
...
source/libs/stream/src/streamState.c
浏览文件 @
b8ac811f
...
...
@@ -395,6 +395,32 @@ int32_t streamStateClear(SStreamState* pState) {
void
streamStateSetNumber
(
SStreamState
*
pState
,
int32_t
number
)
{
pState
->
number
=
number
;
}
int32_t
streamStateSaveInfo
(
SStreamState
*
pState
,
void
*
pKey
,
int32_t
keyLen
,
void
*
pVal
,
int32_t
vLen
)
{
#ifdef USE_ROCKSDB
int32_t
code
=
0
;
void
*
batch
=
streamStateCreateBatch
();
code
=
streamStatePutBatch
(
pState
,
"default"
,
batch
,
pKey
,
pVal
,
vLen
);
if
(
code
!=
0
)
{
return
code
;
}
code
=
streamStatePutBatch_rocksdb
(
pState
,
batch
);
streamStateDestroyBatch
(
batch
);
return
code
;
#else
return
0
;
#endif
}
int32_t
streamStateGetInfo
(
SStreamState
*
pState
,
void
*
pKey
,
int32_t
keyLen
,
void
**
pVal
,
int32_t
*
pLen
)
{
#ifdef USE_ROCKSDB
int32_t
code
=
0
;
code
=
streamDefaultGet_rocksdb
(
pState
,
pKey
,
pVal
,
pLen
);
return
code
;
#else
return
0
;
#endif
}
int32_t
streamStateAddIfNotExist
(
SStreamState
*
pState
,
const
SWinKey
*
key
,
void
**
pVal
,
int32_t
*
pVLen
)
{
#ifdef USE_ROCKSDB
return
streamStateGet
(
pState
,
key
,
pVal
,
pVLen
);
...
...
@@ -1066,7 +1092,7 @@ void streamStateDestroy(SStreamState* pState) {
#ifdef USE_ROCKSDB
streamFileStateDestroy
(
pState
->
pFileState
);
streamStateDestroy_rocksdb
(
pState
);
t
aosMemoryFreeClear
(
pState
->
parNameMap
);
t
SimpleHashCleanup
(
pState
->
parNameMap
);
// do nothong
#endif
taosMemoryFreeClear
(
pState
->
pTdbState
);
...
...
source/libs/stream/src/streamUpdate.c
浏览文件 @
b8ac811f
...
...
@@ -274,7 +274,10 @@ void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo) {
}
int32_t
updateInfoSerialize
(
void
*
buf
,
int32_t
bufLen
,
const
SUpdateInfo
*
pInfo
)
{
ASSERT
(
pInfo
);
if
(
!
pInfo
)
{
return
0
;
}
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
...
...
tests/script/tsim/stream/basic2.sim
浏览文件 @
b8ac811f
...
...
@@ -48,23 +48,34 @@ sleep 100
#===================================================================
print =============== query data from child table
$loop_count = 0
loop0:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
print rows: $rows
print $data00 $data01 $data02 $data03
if $rows != 1 then
return -1
goto loop0
endi
if $data01 != 234 then
return -1
goto loop0
endi
if $data02 != 234 then
return -1
goto loop0
endi
if $data03 != 234 then
return -1
goto loop0
endi
#===================================================================
...
...
@@ -77,36 +88,47 @@ sleep 100
#===================================================================
print =============== query data from child table
$loop_count = 0
loop1:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
print rows: $rows
print $data00 $data01 $data02 $data03
print $data10 $data11 $data12 $data13
if $rows != 2 then
return -
1
goto loop
1
endi
if $data01 != 234 then
return -
1
goto loop
1
endi
if $data02 != 234 then
return -
1
goto loop
1
endi
if $data03 != 234 then
return -
1
goto loop
1
endi
if $data11 != -111 then
return -
1
goto loop
1
endi
if $data12 != -111 then
return -
1
goto loop
1
endi
if $data13 != -111 then
return -
1
goto loop
1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录