Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d43ad3be
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看板
提交
d43ad3be
编写于
12月 19, 2021
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update cache search
上级
2375f6c9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
26 deletion
+31
-26
include/libs/index/index.h
include/libs/index/index.h
+1
-1
source/libs/index/inc/index_cache.h
source/libs/index/inc/index_cache.h
+5
-5
source/libs/index/src/index.c
source/libs/index/src/index.c
+10
-4
source/libs/index/src/index_cache.c
source/libs/index/src/index_cache.c
+15
-16
未找到文件。
include/libs/index/index.h
浏览文件 @
d43ad3be
...
...
@@ -53,7 +53,7 @@ int indexMultiTermQueryAdd(SIndexMultiTermQuery *pQuery, SIndexTerm
*/
int
indexOpen
(
SIndexOpts
*
opt
,
const
char
*
path
,
SIndex
**
index
);
void
indexClose
(
SIndex
*
index
);
int
indexPut
(
SIndex
*
index
,
SIndexMultiTerm
*
terms
,
in
t
uid
);
int
indexPut
(
SIndex
*
index
,
SIndexMultiTerm
*
terms
,
uint64_
t
uid
);
int
indexDelete
(
SIndex
*
index
,
SIndexMultiTermQuery
*
query
);
int
indexSearch
(
SIndex
*
index
,
SIndexMultiTermQuery
*
query
,
SArray
*
result
);
int
indexRebuild
(
SIndex
*
index
,
SIndexOpts
*
opt
);
...
...
source/libs/index/inc/index_cache.h
浏览文件 @
d43ad3be
...
...
@@ -16,13 +16,14 @@
#define __INDEX_CACHE_H__
#include "index.h"
#include "indexInt.h"
#include "tlockfree.h"
#include "tskiplist.h"
// ----------------- row structure in skiplist ---------------------
/* A data row, the format is like below:
* content: |<--totalLen-->|<-- fieldid-->|<--field type -->|<-- value len--->|<-- value -->|<-- uid -->|<--version--->|<-- itermType -->|
* len : |<--int32_t -->|<-- int16_t-->|<-- int
16
_t --->|<--- int32_t --->|<--valuelen->|<--uint64_t->|<-- int32_t-->|<-- int8_t --->|
* len : |<--int32_t -->|<-- int16_t-->|<-- int
8
_t --->|<--- int32_t --->|<--valuelen->|<--uint64_t->|<-- int32_t-->|<-- int8_t --->|
*/
#ifdef __cplusplus
...
...
@@ -40,11 +41,10 @@ IndexCache *indexCacheCreate();
void
indexCacheDestroy
(
void
*
cache
);
int
indexCachePut
(
void
*
cache
,
int16_t
fieldId
,
int16_t
fieldType
,
const
char
*
fieldValue
,
int32_t
fvLen
,
uint32_t
version
,
uint64_t
uid
,
int8_t
operType
);
int
indexCachePut
(
void
*
cache
,
SIndexTerm
*
term
,
int16_t
colId
,
int32_t
version
,
uint64_t
uid
);
int
indexCacheGet
(
void
*
cache
,
uint64_t
*
rst
);
int
indexCacheSearch
(
void
*
cache
,
SIndex
MultiTermQuery
*
query
,
SArray
*
result
);
//
int indexCacheGet(void *cache, uint64_t *rst);
int
indexCacheSearch
(
void
*
cache
,
SIndex
TermQuery
*
query
,
int16_t
colId
,
int32_t
version
,
SArray
*
result
);
#ifdef __cplusplus
}
...
...
source/libs/index/src/index.c
浏览文件 @
d43ad3be
...
...
@@ -74,7 +74,7 @@ void indexClose(SIndex *sIdx) {
return
;
}
int
indexPut
(
SIndex
*
index
,
SIndexMultiTerm
*
fVals
,
in
t
uid
)
{
int
indexPut
(
SIndex
*
index
,
SIndexMultiTerm
*
fVals
,
uint64_
t
uid
)
{
#ifdef USE_LUCENE
index_document_t
*
doc
=
index_document_create
();
...
...
@@ -116,7 +116,7 @@ int indexPut(SIndex *index, SIndexMultiTerm * fVals, int uid) {
assert
(
fi
!=
NULL
);
int32_t
colId
=
fi
->
colId
;
int32_t
version
=
index
->
cVersion
;
int
ret
=
indexCachePut
(
index
->
cache
,
colId
,
p
->
colType
,
p
->
colVal
,
p
->
nColVal
,
version
,
uid
,
p
->
operType
);
int
ret
=
indexCachePut
(
index
->
cache
,
p
,
colId
,
version
,
uid
);
if
(
ret
!=
0
)
{
return
ret
;
}
...
...
@@ -275,6 +275,7 @@ void indexInit() {
}
static
int
indexTermSearch
(
SIndex
*
sIdx
,
SIndexTermQuery
*
term
,
SArray
**
result
)
{
return
0
;
}
static
void
indexInterResultsDestroy
(
SArray
*
results
)
{
if
(
results
==
NULL
)
{
return
;
}
...
...
@@ -288,12 +289,17 @@ static void indexInterResultsDestroy(SArray *results) {
}
static
int
indexMergeFinalResults
(
SArray
*
interResults
,
EIndexOperatorType
oType
,
SArray
*
fResults
)
{
//refactor, merge interResults into fResults by oType
SArray
*
first
=
taosArrayGetP
(
interResults
,
0
);
//taosArraySort(first, getCom)
if
(
oType
==
MUST
)
{
// tag1 condition && tag2 condition
}
else
if
(
oType
==
SHOULD
)
{
// tag1 condistion || tag2 condition
}
else
if
(
oType
==
NOT
)
{
// not use currently
}
return
0
;
...
...
source/libs/index/src/index_cache.c
浏览文件 @
d43ad3be
...
...
@@ -103,14 +103,13 @@ void indexCacheDestroy(void *cache) {
free
(
pCache
);
}
int
indexCachePut
(
void
*
cache
,
int16_t
fieldId
,
int16_t
fieldType
,
const
char
*
fieldValue
,
int32_t
fvLen
,
uint32_t
version
,
uint64_t
uid
,
int8_t
operType
)
{
int
indexCachePut
(
void
*
cache
,
SIndexTerm
*
term
,
int16_t
colId
,
int32_t
version
,
uint64_t
uid
)
{
if
(
cache
==
NULL
)
{
return
-
1
;}
IndexCache
*
pCache
=
cache
;
// encode data
int32_t
total
=
sizeof
(
int32_t
)
+
sizeof
(
fieldId
)
+
sizeof
(
fieldType
)
+
sizeof
(
fvLen
)
+
fvLen
+
sizeof
(
version
)
+
sizeof
(
uid
)
+
sizeof
(
operType
);
int32_t
total
=
sizeof
(
int32_t
)
+
sizeof
(
colId
)
+
sizeof
(
term
->
colType
)
+
sizeof
(
term
->
nColVal
)
+
term
->
nColVal
+
sizeof
(
version
)
+
sizeof
(
uid
)
+
sizeof
(
term
->
operType
);
char
*
buf
=
calloc
(
1
,
total
);
char
*
p
=
buf
;
...
...
@@ -118,16 +117,16 @@ int indexCachePut(void *cache, int16_t fieldId, int16_t fieldType, const char *f
memcpy
(
p
,
&
total
,
sizeof
(
total
));
p
+=
sizeof
(
total
);
memcpy
(
p
,
&
fieldId
,
sizeof
(
field
Id
));
p
+=
sizeof
(
field
Id
);
memcpy
(
p
,
&
colId
,
sizeof
(
col
Id
));
p
+=
sizeof
(
col
Id
);
memcpy
(
p
,
&
fieldType
,
sizeof
(
field
Type
));
p
+=
sizeof
(
field
Type
);
memcpy
(
p
,
&
term
->
colType
,
sizeof
(
term
->
col
Type
));
p
+=
sizeof
(
term
->
col
Type
);
memcpy
(
p
,
&
fvLen
,
sizeof
(
fvLen
));
p
+=
sizeof
(
fvLen
);
memcpy
(
p
,
fieldValue
,
fvLen
);
p
+=
fvLen
;
memcpy
(
p
,
&
term
->
nColVal
,
sizeof
(
term
->
nColVal
));
p
+=
sizeof
(
term
->
nColVal
);
memcpy
(
p
,
term
->
colVal
,
term
->
nColVal
);
p
+=
term
->
nColVal
;
memcpy
(
p
,
&
version
,
sizeof
(
version
));
p
+=
sizeof
(
version
);
...
...
@@ -135,8 +134,8 @@ int indexCachePut(void *cache, int16_t fieldId, int16_t fieldType, const char *f
memcpy
(
p
,
&
uid
,
sizeof
(
uid
));
p
+=
sizeof
(
uid
);
memcpy
(
p
,
&
operType
,
sizeof
(
operType
));
p
+=
sizeof
(
operType
);
memcpy
(
p
,
&
term
->
operType
,
sizeof
(
term
->
operType
));
p
+=
sizeof
(
term
->
operType
);
tSkipListPut
(
pCache
->
skiplist
,
(
void
*
)
buf
);
// encode end
...
...
@@ -146,7 +145,7 @@ int indexCacheDel(void *cache, int32_t fieldId, const char *fieldValue, int32_t
IndexCache
*
pCache
=
cache
;
return
0
;
}
int
indexCacheSearch
(
void
*
cache
,
SIndexMultiTermQuery
*
query
,
SArray
*
result
)
{
return
0
;
int
indexCacheSearch
(
void
*
cache
,
SIndexTermQuery
*
query
,
int16_t
colId
,
int32_t
version
,
SArray
*
result
)
{
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录