Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c64a7d3e
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c64a7d3e
编写于
4月 25, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ttl to stream state key
上级
05df0f6e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
39 addition
and
20 deletion
+39
-20
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+1
-1
source/libs/stream/src/streamStateRocksdb.c
source/libs/stream/src/streamStateRocksdb.c
+38
-19
未找到文件。
contrib/CMakeLists.txt
浏览文件 @
c64a7d3e
...
@@ -236,7 +236,7 @@ if(${BUILD_WITH_ROCKSDB})
...
@@ -236,7 +236,7 @@ if(${BUILD_WITH_ROCKSDB})
endif
(
${
TD_WINDOWS
}
)
endif
(
${
TD_WINDOWS
}
)
if
(
${
TD_DARWIN
}
OR
${
TD_WINDOWS
}
)
if
(
${
TD_DARWIN
}
)
option
(
HAVE_THREAD_LOCAL
""
OFF
)
option
(
HAVE_THREAD_LOCAL
""
OFF
)
option
(
WITH_IOSTATS_CONTEXT
""
OFF
)
option
(
WITH_IOSTATS_CONTEXT
""
OFF
)
option
(
WITH_PERF_CONTEXT
""
OFF
)
option
(
WITH_PERF_CONTEXT
""
OFF
)
...
...
source/libs/stream/src/streamStateRocksdb.c
浏览文件 @
c64a7d3e
...
@@ -362,7 +362,10 @@ const char* compareFuncKeyName(void* name);
...
@@ -362,7 +362,10 @@ const char* compareFuncKeyName(void* name);
const
char
*
compareParKeyName
(
void
*
name
);
const
char
*
compareParKeyName
(
void
*
name
);
const
char
*
comparePartagKeyName
(
void
*
name
);
const
char
*
comparePartagKeyName
(
void
*
name
);
void
destroyFunc
(
void
*
stata
)
{
return
;
}
void
destroyFunc
(
void
*
arg
)
{
(
void
)
arg
;
return
;
}
typedef
struct
{
typedef
struct
{
const
char
*
key
;
const
char
*
key
;
...
@@ -434,13 +437,34 @@ SCfInit ginitDict[] = {
...
@@ -434,13 +437,34 @@ SCfInit ginitDict[] = {
encodeValueFunc
,
decodeValueFunc
},
encodeValueFunc
,
decodeValueFunc
},
};
};
const
char
*
compareDefaultName
(
void
*
name
)
{
return
ginitDict
[
0
].
key
;
}
const
char
*
compareDefaultName
(
void
*
arg
)
{
const
char
*
compareStateName
(
void
*
name
)
{
return
ginitDict
[
1
].
key
;
}
(
void
)
arg
;
const
char
*
compareWinKeyName
(
void
*
name
)
{
return
ginitDict
[
2
].
key
;
}
return
ginitDict
[
0
].
key
;
const
char
*
compareSessionKeyName
(
void
*
name
)
{
return
ginitDict
[
3
].
key
;
}
}
const
char
*
compareFuncKeyName
(
void
*
name
)
{
return
ginitDict
[
4
].
key
;
}
const
char
*
compareStateName
(
void
*
arg
)
{
const
char
*
compareParKeyName
(
void
*
name
)
{
return
ginitDict
[
5
].
key
;
}
(
void
)
arg
;
const
char
*
comparePartagKeyName
(
void
*
name
)
{
return
ginitDict
[
6
].
key
;
}
return
ginitDict
[
1
].
key
;
}
const
char
*
compareWinKeyName
(
void
*
arg
)
{
(
void
)
arg
;
return
ginitDict
[
2
].
key
;
}
const
char
*
compareSessionKeyName
(
void
*
arg
)
{
(
void
)
arg
;
return
ginitDict
[
3
].
key
;
}
const
char
*
compareFuncKeyName
(
void
*
arg
)
{
(
void
)
arg
;
return
ginitDict
[
4
].
key
;
}
const
char
*
compareParKeyName
(
void
*
arg
)
{
(
void
)
arg
;
return
ginitDict
[
5
].
key
;
}
const
char
*
comparePartagKeyName
(
void
*
arg
)
{
(
void
)
arg
;
return
ginitDict
[
6
].
key
;
}
typedef
struct
SCompactFilteFactory
{
typedef
struct
SCompactFilteFactory
{
void
*
status
;
void
*
status
;
...
@@ -454,9 +478,7 @@ const char* compactFilteFactoryName(void* arg) {
...
@@ -454,9 +478,7 @@ const char* compactFilteFactoryName(void* arg) {
return
"stream_compact_filter"
;
return
"stream_compact_filter"
;
}
}
void
destroyCompactFilte
(
void
*
arg
)
{
void
destroyCompactFilte
(
void
*
arg
)
{
(
void
)
arg
;
}
if
(
arg
==
NULL
)
return
;
}
unsigned
char
compactFilte
(
void
*
arg
,
int
level
,
const
char
*
key
,
size_t
klen
,
const
char
*
val
,
size_t
vlen
,
unsigned
char
compactFilte
(
void
*
arg
,
int
level
,
const
char
*
key
,
size_t
klen
,
const
char
*
val
,
size_t
vlen
,
char
**
newval
,
size_t
*
newvlen
,
unsigned
char
*
value_changed
)
{
char
**
newval
,
size_t
*
newvlen
,
unsigned
char
*
value_changed
)
{
int64_t
unixTime
=
taosGetTimestampMs
();
int64_t
unixTime
=
taosGetTimestampMs
();
...
@@ -494,6 +516,7 @@ int streamInitBackend(SStreamState* pState, char* path) {
...
@@ -494,6 +516,7 @@ int streamInitBackend(SStreamState* pState, char* path) {
rocksdb_compactionfilterfactory_t
*
factory
=
rocksdb_compactionfilterfactory_create
(
rocksdb_compactionfilterfactory_t
*
factory
=
rocksdb_compactionfilterfactory_create
(
NULL
,
destroyCompactFilteFactory
,
compactFilteFactoryCreateFilter
,
compactFilteFactoryName
);
NULL
,
destroyCompactFilteFactory
,
compactFilteFactoryCreateFilter
,
compactFilteFactoryName
);
rocksdb_options_set_compaction_filter_factory
(
opts
,
factory
);
rocksdb_options_set_compaction_filter_factory
(
opts
,
factory
);
rocksdb_cache_t
*
cache
=
rocksdb_cache_create_lru
(
128
<<
20
);
rocksdb_cache_t
*
cache
=
rocksdb_cache_create_lru
(
128
<<
20
);
char
*
err
=
NULL
;
char
*
err
=
NULL
;
...
@@ -570,15 +593,12 @@ void streamCleanBackend(SStreamState* pState) {
...
@@ -570,15 +593,12 @@ void streamCleanBackend(SStreamState* pState) {
rocksdb_comparator_destroy
(
pState
->
pTdbState
->
pCompare
[
i
]);
rocksdb_comparator_destroy
(
pState
->
pTdbState
->
pCompare
[
i
]);
rocksdb_block_based_options_destroy
(
param
[
i
].
tableOpt
);
rocksdb_block_based_options_destroy
(
param
[
i
].
tableOpt
);
// rocksdb_compactionfilterfactory_destroy(param[i].filteFactory);
}
}
rocksdb_cache_destroy
(
pState
->
pTdbState
->
cache
);
rocksdb_cache_destroy
(
pState
->
pTdbState
->
cache
);
taosMemoryFreeClear
(
pState
->
pTdbState
->
cfOpts
);
taosMemoryFreeClear
(
pState
->
pTdbState
->
cfOpts
);
taosMemoryFree
(
pState
->
pTdbState
->
pCompare
);
taosMemoryFree
(
pState
->
pTdbState
->
pCompare
);
taosMemoryFree
(
pState
->
pTdbState
->
param
);
taosMemoryFree
(
pState
->
pTdbState
->
param
);
rocksdb_env_destroy
(
pState
->
pTdbState
->
env
);
rocksdb_env_destroy
(
pState
->
pTdbState
->
env
);
rocksdb_compactionfilterfactory_destroy
(
pState
->
pTdbState
->
compactFactory
);
pState
->
pTdbState
->
rocksdb
=
NULL
;
pState
->
pTdbState
->
rocksdb
=
NULL
;
}
}
...
@@ -612,12 +632,10 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
...
@@ -612,12 +632,10 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
if
(
snapshot
!=
NULL
)
{
if
(
snapshot
!=
NULL
)
{
*
snapshot
=
(
rocksdb_snapshot_t
*
)
rocksdb_create_snapshot
(
pState
->
pTdbState
->
rocksdb
);
*
snapshot
=
(
rocksdb_snapshot_t
*
)
rocksdb_create_snapshot
(
pState
->
pTdbState
->
rocksdb
);
}
}
rocksdb_readoptions_t
*
rOpt
=
rocksdb_readoptions_create
();
rocksdb_readoptions_t
*
rOpt
=
rocksdb_readoptions_create
();
*
readOpt
=
rOpt
;
*
readOpt
=
rOpt
;
// rocksdb_readoptions_set_snapshot(rOpt, *snapshot);
rocksdb_readoptions_set_snapshot
(
rOpt
,
*
snapshot
);
rocksdb_readoptions_set_fill_cache
(
rOpt
,
0
);
rocksdb_readoptions_set_fill_cache
(
rOpt
,
0
);
return
rocksdb_create_iterator_cf
(
pState
->
pTdbState
->
rocksdb
,
rOpt
,
pState
->
pTdbState
->
pHandle
[
idx
]);
return
rocksdb_create_iterator_cf
(
pState
->
pTdbState
->
rocksdb
,
rOpt
,
pState
->
pTdbState
->
pHandle
[
idx
]);
...
@@ -690,6 +708,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
...
@@ -690,6 +708,7 @@ rocksdb_iterator_t* streamStateIterCreate(SStreamState* pState, const char* cfNa
} else { \
} else { \
taosMemoryFree(p); \
taosMemoryFree(p); \
} \
} \
taosMemoryFree(val); \
if (vLen != NULL) *vLen = len; \
if (vLen != NULL) *vLen = len; \
} \
} \
if (err != NULL) { \
if (err != NULL) { \
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录