Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
70bd0cdc
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看板
未验证
提交
70bd0cdc
编写于
1月 06, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
1月 06, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #9630 from taosdata/feature/index_complete
refactor code
上级
c8de167e
1facebba
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
12 deletion
+16
-12
source/libs/index/src/index_cache.c
source/libs/index/src/index_cache.c
+13
-10
source/libs/index/src/index_fst_counting_writer.c
source/libs/index/src/index_fst_counting_writer.c
+1
-0
source/libs/index/test/fstTest.cc
source/libs/index/test/fstTest.cc
+2
-2
未找到文件。
source/libs/index/src/index_cache.c
浏览文件 @
70bd0cdc
...
...
@@ -27,9 +27,9 @@
static
void
indexMemRef
(
MemTable
*
tbl
);
static
void
indexMemUnRef
(
MemTable
*
tbl
);
static
void
c
acheTermDestroy
(
CacheTerm
*
ct
);
static
char
*
getIndexKey
(
const
void
*
pData
);
static
int32_t
compareKey
(
const
void
*
l
,
const
void
*
r
);
static
void
indexC
acheTermDestroy
(
CacheTerm
*
ct
);
static
int32_t
indexCacheTermCompare
(
const
void
*
l
,
const
void
*
r
);
static
char
*
indexCacheTermGet
(
const
void
*
pData
);
static
MemTable
*
indexInternalCacheCreate
(
int8_t
type
);
...
...
@@ -243,7 +243,7 @@ int indexCacheDel(void* cache, const char* fieldValue, int32_t fvlen, uint64_t u
static
int
indexQueryMem
(
MemTable
*
mem
,
CacheTerm
*
ct
,
EIndexQueryType
qtype
,
SArray
*
result
,
STermValueType
*
s
)
{
if
(
mem
==
NULL
)
{
return
0
;
}
char
*
key
=
getIndexKey
(
ct
);
char
*
key
=
indexCacheTermGet
(
ct
);
SSkipListIterator
*
iter
=
tSkipListCreateIterFromVal
(
mem
->
mem
,
key
,
TSDB_DATA_TYPE_BINARY
,
TSDB_ORDER_ASC
);
while
(
tSkipListIterNext
(
iter
))
{
...
...
@@ -321,17 +321,16 @@ void indexMemUnRef(MemTable* tbl) {
}
}
static
void
c
acheTermDestroy
(
CacheTerm
*
ct
)
{
static
void
indexC
acheTermDestroy
(
CacheTerm
*
ct
)
{
if
(
ct
==
NULL
)
{
return
;
}
free
(
ct
->
colVal
);
free
(
ct
);
}
static
char
*
getIndexKey
(
const
void
*
pData
)
{
static
char
*
indexCacheTermGet
(
const
void
*
pData
)
{
CacheTerm
*
p
=
(
CacheTerm
*
)
pData
;
return
(
char
*
)
p
;
}
static
int32_t
compareKey
(
const
void
*
l
,
const
void
*
r
)
{
static
int32_t
indexCacheTermCompare
(
const
void
*
l
,
const
void
*
r
)
{
CacheTerm
*
lt
=
(
CacheTerm
*
)
l
;
CacheTerm
*
rt
=
(
CacheTerm
*
)
r
;
...
...
@@ -345,7 +344,8 @@ static MemTable* indexInternalCacheCreate(int8_t type) {
MemTable
*
tbl
=
calloc
(
1
,
sizeof
(
MemTable
));
indexMemRef
(
tbl
);
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
tbl
->
mem
=
tSkipListCreate
(
MAX_SKIP_LIST_LEVEL
,
type
,
MAX_INDEX_KEY_LEN
,
compareKey
,
SL_ALLOW_DUP_KEY
,
getIndexKey
);
tbl
->
mem
=
tSkipListCreate
(
MAX_SKIP_LIST_LEVEL
,
type
,
MAX_INDEX_KEY_LEN
,
indexCacheTermCompare
,
SL_ALLOW_DUP_KEY
,
indexCacheTermGet
);
}
return
tbl
;
}
...
...
@@ -375,4 +375,7 @@ static bool indexCacheIteratorNext(Iterate* itera) {
return
next
;
}
static
IterateValue
*
indexCacheIteratorGetValue
(
Iterate
*
iter
)
{
return
&
iter
->
val
;
}
static
IterateValue
*
indexCacheIteratorGetValue
(
Iterate
*
iter
)
{
// opt later
return
&
iter
->
val
;
}
source/libs/index/src/index_fst_counting_writer.c
浏览文件 @
70bd0cdc
...
...
@@ -125,6 +125,7 @@ void writerCtxDestroy(WriterCtx* ctx, bool remove) {
if
(
ctx
->
type
==
TMemory
)
{
free
(
ctx
->
mem
.
buf
);
}
else
{
ctx
->
flush
(
ctx
);
tfClose
(
ctx
->
file
.
fd
);
if
(
ctx
->
file
.
readOnly
)
{
#ifdef USE_MMAP
...
...
source/libs/index/test/fstTest.cc
浏览文件 @
70bd0cdc
...
...
@@ -48,7 +48,7 @@ class FstWriter {
class
FstReadMemory
{
public:
FstReadMemory
(
size_t
size
,
const
std
::
string
&
fileName
=
fileName
)
{
FstReadMemory
(
size_t
size
,
const
std
::
string
&
fileName
=
"/tmp/tindex.tindex"
)
{
tfInit
();
_wc
=
writerCtxCreate
(
TFile
,
fileName
.
c_str
(),
true
,
64
*
1024
);
_w
=
fstCountingWriterCreate
(
_wc
);
...
...
@@ -307,7 +307,7 @@ void validateTFile(char* arg) {
tfCleanup
();
}
int
main
(
int
argc
,
char
*
argv
[])
{
// tool to check all kind of fst test
// tool to check all kind of fst test
// if (argc > 1) { validateTFile(argv[1]); }
// checkFstCheckIterator();
// checkFstLongTerm();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录