Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
42fcb433
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
42fcb433
编写于
5月 23, 2022
作者:
5
54liuyao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream):adjust bloom filter
上级
75db94ce
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
8 deletion
+17
-8
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+1
-0
source/libs/stream/src/tstreamUpdate.c
source/libs/stream/src/tstreamUpdate.c
+13
-6
source/libs/stream/test/tstreamUpdateTest.cpp
source/libs/stream/test/tstreamUpdateTest.cpp
+3
-2
未找到文件。
source/libs/executor/src/timewindowoperator.c
浏览文件 @
42fcb433
...
...
@@ -1181,6 +1181,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
initExecTimeWindowInfo
(
&
pInfo
->
twAggSup
.
timeWindowData
,
&
pInfo
->
win
);
pInfo
->
invertible
=
allInvertible
(
pInfo
->
binfo
.
pCtx
,
numOfCols
);
pInfo
->
invertible
=
false
;
// Todo(liuyao): Dependent TSDB API
// pInfo->pTableQueryInfo = initTableQueryInfo(pTableGroupInfo);
if
(
code
!=
TSDB_CODE_SUCCESS
/* || pInfo->pTableQueryInfo == NULL*/
)
{
...
...
source/libs/stream/src/tstreamUpdate.c
浏览文件 @
42fcb433
...
...
@@ -19,18 +19,24 @@
#define DEFAULT_FALSE_POSITIVE 0.01
#define DEFAULT_BUCKET_SIZE 1024
#define ROWS_PER_MILLISECOND 1
#define MAX_NUM_SCALABLE_BF 1
2
0
#define MAX_NUM_SCALABLE_BF 1
0000
0
#define MIN_NUM_SCALABLE_BF 10
#define DEFAULT_PREADD_BUCKET 1
#define MAX_INTERVAL MILLISECOND_PER_MINUTE
#define MIN_INTERVAL (MILLISECOND_PER_SECOND * 10)
#define DEFAULT_EXPECTED_ENTRIES 10000
static
int64_t
adjustExpEntries
(
int64_t
entries
)
{
return
TMIN
(
DEFAULT_EXPECTED_ENTRIES
,
entries
);
}
static
void
windowSBfAdd
(
SUpdateInfo
*
pInfo
,
uint64_t
count
)
{
if
(
pInfo
->
numSBFs
<
count
)
{
count
=
pInfo
->
numSBFs
;
}
for
(
uint64_t
i
=
0
;
i
<
count
;
++
i
)
{
SScalableBf
*
tsSBF
=
tScalableBfInit
(
pInfo
->
interval
*
ROWS_PER_MILLISECOND
,
DEFAULT_FALSE_POSITIVE
);
int64_t
rows
=
adjustExpEntries
(
pInfo
->
interval
*
ROWS_PER_MILLISECOND
);
SScalableBf
*
tsSBF
=
tScalableBfInit
(
rows
,
DEFAULT_FALSE_POSITIVE
);
taosArrayPush
(
pInfo
->
pTsSBFs
,
&
tsSBF
);
}
}
...
...
@@ -38,9 +44,9 @@ static void windowSBfAdd(SUpdateInfo *pInfo, uint64_t count) {
static
void
windowSBfDelete
(
SUpdateInfo
*
pInfo
,
uint64_t
count
)
{
if
(
count
<
pInfo
->
numSBFs
-
1
)
{
for
(
uint64_t
i
=
0
;
i
<
count
;
++
i
)
{
SScalableBf
*
pTsSBFs
=
taosArrayGetP
(
pInfo
->
pTsSBFs
,
i
);
SScalableBf
*
pTsSBFs
=
taosArrayGetP
(
pInfo
->
pTsSBFs
,
0
);
tScalableBfDestroy
(
pTsSBFs
);
taosArrayRemove
(
pInfo
->
pTsSBFs
,
i
);
taosArrayRemove
(
pInfo
->
pTsSBFs
,
0
);
}
}
else
{
taosArrayClearP
(
pInfo
->
pTsSBFs
,
(
FDelete
)
tScalableBfDestroy
);
...
...
@@ -66,7 +72,7 @@ static int64_t adjustInterval(int64_t interval, int32_t precision) {
return
val
;
}
static
int64_t
adjustWatermark
(
int64_t
interval
,
int
32
_t
watermark
)
{
static
int64_t
adjustWatermark
(
int64_t
interval
,
int
64
_t
watermark
)
{
if
(
watermark
<=
0
||
watermark
>
MAX_NUM_SCALABLE_BF
*
interval
)
{
watermark
=
MAX_NUM_SCALABLE_BF
*
interval
;
}
else
if
(
watermark
<
MIN_NUM_SCALABLE_BF
*
interval
)
{
...
...
@@ -130,7 +136,8 @@ static SScalableBf *getSBf(SUpdateInfo *pInfo, TSKEY ts) {
}
SScalableBf
*
res
=
taosArrayGetP
(
pInfo
->
pTsSBFs
,
index
);
if
(
res
==
NULL
)
{
res
=
tScalableBfInit
(
pInfo
->
interval
*
ROWS_PER_MILLISECOND
,
DEFAULT_FALSE_POSITIVE
);
int64_t
rows
=
adjustExpEntries
(
pInfo
->
interval
*
ROWS_PER_MILLISECOND
);
res
=
tScalableBfInit
(
rows
,
DEFAULT_FALSE_POSITIVE
);
taosArrayPush
(
pInfo
->
pTsSBFs
,
&
res
);
}
return
res
;
...
...
source/libs/stream/test/tstreamUpdateTest.cpp
浏览文件 @
42fcb433
...
...
@@ -4,6 +4,7 @@
#include "ttime.h"
using
namespace
std
;
#define MAX_NUM_SCALABLE_BF 100000
TEST
(
TD_STREAM_UPDATE_TEST
,
update
)
{
int64_t
interval
=
20
*
1000
;
...
...
@@ -91,11 +92,11 @@ TEST(TD_STREAM_UPDATE_TEST, update) {
}
SUpdateInfo
*
pSU4
=
updateInfoInit
(
-
1
,
TSDB_TIME_PRECISION_MILLI
,
-
1
);
GTEST_ASSERT_EQ
(
pSU4
->
watermark
,
120
*
pSU4
->
interval
);
GTEST_ASSERT_EQ
(
pSU4
->
watermark
,
MAX_NUM_SCALABLE_BF
*
pSU4
->
interval
);
GTEST_ASSERT_EQ
(
pSU4
->
interval
,
MILLISECOND_PER_MINUTE
);
SUpdateInfo
*
pSU5
=
updateInfoInit
(
0
,
TSDB_TIME_PRECISION_MILLI
,
0
);
GTEST_ASSERT_EQ
(
pSU5
->
watermark
,
120
*
pSU4
->
interval
);
GTEST_ASSERT_EQ
(
pSU5
->
watermark
,
MAX_NUM_SCALABLE_BF
*
pSU4
->
interval
);
GTEST_ASSERT_EQ
(
pSU5
->
interval
,
MILLISECOND_PER_MINUTE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录