Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
59cc5e42
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看板
提交
59cc5e42
编写于
11月 21, 2021
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update fst struct
上级
3322eb5f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
16 addition
and
19 deletion
+16
-19
source/libs/index/inc/index_fst.h
source/libs/index/inc/index_fst.h
+1
-6
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+0
-2
source/libs/index/src/index_fst_node.c
source/libs/index/src/index_fst_node.c
+6
-5
source/libs/index/src/index_fst_registry.c
source/libs/index/src/index_fst_registry.c
+9
-6
未找到文件。
source/libs/index/inc/index_fst.h
浏览文件 @
59cc5e42
...
...
@@ -20,6 +20,7 @@
#include "tarray.h"
#include "index_fst_util.h"
#include "index_fst_registry.h"
#include "index_fst_counting_writer.h"
typedef
struct
FstNode
FstNode
;
...
...
@@ -35,7 +36,6 @@ typedef struct FstRange {
typedef
enum
{
OneTransNext
,
OneTrans
,
AnyTrans
,
EmptyFinal
}
State
;
typedef
enum
{
Included
,
Excluded
,
Unbounded
}
FstBound
;
typedef
uint32_t
CheckSummer
;
/*
...
...
@@ -60,11 +60,6 @@ void fstUnFinishedNodesAddSuffix(FstUnFinishedNodes *node, FstSlice bs, Output o
uint64_t
fstUnFinishedNodesFindCommPrefix
(
FstUnFinishedNodes
*
node
,
FstSlice
bs
);
uint64_t
FstUnFinishedNodesFindCommPreifxAndSetOutput
(
FstUnFinishedNodes
*
node
,
FstSlice
bs
,
Output
in
,
Output
*
out
);
typedef
struct
FstCountingWriter
{
void
*
wtr
;
// wrap any writer that counts and checksum bytes written
uint64_t
count
;
CheckSummer
summer
;
}
FstCountingWriter
;
typedef
struct
FstBuilder
{
FstCountingWriter
wtr
;
// The FST raw data is written directly to `wtr`.
...
...
source/libs/index/src/index_fst.c
浏览文件 @
59cc5e42
...
...
@@ -275,8 +275,6 @@ bool fstNodeCompile(FstNode *node, void *w, CompiledAddr lastAddr, CompiledAddr
}
FstBuilder
*
fstBuilderCreate
(
void
*
w
,
FstType
ty
)
{
FstBuilder
*
b
=
malloc
(
sizeof
(
FstBuilder
));
if
(
NULL
==
b
)
{
return
b
;
}
...
...
source/libs/index/src/index_fst_node.c
浏览文件 @
59cc5e42
...
...
@@ -26,14 +26,13 @@ FstBuilderNode *fstBuilderNodeClone(FstBuilderNode *src) {
FstBuilderNode
*
node
=
malloc
(
sizeof
(
FstBuilderNode
));
if
(
node
==
NULL
)
{
return
NULL
;
}
//
size_t
sz
=
taosArrayGetSize
(
src
->
trans
);
SArray
*
trans
=
taosArrayInit
(
sz
,
sizeof
(
FstTransition
));
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
FstTransition
*
tran
=
taosArrayGet
(
src
->
trans
,
i
);
FstTransition
t
=
*
tran
;
taosArrayPush
(
trans
,
&
t
);
taosArrayPush
(
trans
,
tran
);
}
node
->
trans
=
trans
;
...
...
@@ -47,9 +46,11 @@ void fstBuilderNodeCloneFrom(FstBuilderNode *dst, FstBuilderNode *src) {
if
(
dst
==
NULL
||
src
==
NULL
)
{
return
;
}
dst
->
isFinal
=
src
->
isFinal
;
dst
->
finalOutput
=
src
->
finalOutput
;
dst
->
trans
=
src
->
trans
;
dst
->
finalOutput
=
src
->
finalOutput
;
// avoid mem leak
taosArrayDestroy
(
dst
->
trans
);
dst
->
trans
=
src
->
trans
;
src
->
trans
=
NULL
;
}
source/libs/index/src/index_fst_registry.c
浏览文件 @
59cc5e42
...
...
@@ -32,6 +32,7 @@ uint64_t fstRegistryHash(FstRegistry *registry, FstBuilderNode *bNode) {
h
=
(
h
^
(
uint64_t
)(
trn
->
addr
))
*
FNV_PRIME
;
}
return
h
%
(
registry
->
tableSize
);
}
static
void
fstRegistryCellSwap
(
SArray
*
arr
,
uint32_t
a
,
uint32_t
b
)
{
size_t
sz
=
taosArrayGetSize
(
arr
);
...
...
@@ -72,10 +73,14 @@ FstRegistry* fstRegistryCreate(uint64_t tableSize, uint64_t mruSize) {
uint64_t
nCells
=
tableSize
*
mruSize
;
SArray
*
tb
=
(
SArray
*
)
taosArrayInit
(
nCells
,
sizeof
(
FstRegistryCell
));
if
(
NULL
==
tb
)
{
free
(
registry
);
return
NULL
;
}
for
(
uint64_t
i
=
0
;
i
<
nCells
;
i
++
)
{
FstRegistryCell
*
cell
=
taosArrayGet
(
tb
,
i
);
cell
->
addr
=
NONE_ADDRESS
;
cell
->
node
=
fstBuilderNodeDefault
();
FstRegistryCell
cell
=
{.
addr
=
NONE_ADDRESS
,
.
node
=
fstBuilderNodeDefault
()};
taosArrayPush
(
tb
,
&
cell
);
}
registry
->
table
=
tb
;
...
...
@@ -101,8 +106,6 @@ FstRegistryEntry *fstRegistryGetEntry(FstRegistry *registry, FstBuilderNode *bNo
entry
->
addr
=
cell
->
addr
;
return
entry
;
}
else
{
// clone from bNode, refactor later
//
fstBuilderNodeCloneFrom
(
cell
->
node
,
bNode
);
entry
->
state
=
NOTFOUND
;
entry
->
cell
=
cell
;
// copy or not
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录