Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
daa2e868
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
daa2e868
编写于
6月 09, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: refactor index code
上级
eab330c0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
19 deletion
+19
-19
source/libs/index/inc/indexComm.h
source/libs/index/inc/indexComm.h
+2
-2
source/libs/index/src/index.c
source/libs/index/src/index.c
+4
-4
source/libs/index/src/indexCache.c
source/libs/index/src/indexCache.c
+2
-2
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+8
-8
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+1
-1
source/libs/index/src/indexTfile.c
source/libs/index/src/indexTfile.c
+2
-2
未找到文件。
source/libs/index/inc/indexComm.h
浏览文件 @
daa2e868
...
...
@@ -34,11 +34,11 @@ typedef enum { MATCH, CONTINUE, BREAK } TExeCond;
typedef
TExeCond
(
*
_cache_range_compare
)(
void
*
a
,
void
*
b
,
int8_t
type
);
__compar_fn_t
i
nde
xGetCompar
(
int8_t
type
);
__compar_fn_t
i
d
xGetCompar
(
int8_t
type
);
TExeCond
tCompare
(
__compar_fn_t
func
,
int8_t
cmpType
,
void
*
a
,
void
*
b
,
int8_t
dType
);
TExeCond
tDoCompare
(
__compar_fn_t
func
,
int8_t
cmpType
,
void
*
a
,
void
*
b
);
_cache_range_compare
i
nde
xGetCompare
(
RangeType
ty
);
_cache_range_compare
i
d
xGetCompare
(
RangeType
ty
);
int32_t
idxConvertData
(
void
*
src
,
int8_t
type
,
void
**
dst
);
int32_t
idxConvertDataToStr
(
void
*
src
,
int8_t
type
,
void
**
dst
);
...
...
source/libs/index/src/index.c
浏览文件 @
daa2e868
...
...
@@ -465,8 +465,8 @@ int idxFlushCacheToTFile(SIndex* sIdx, void* cache, bool quit) {
IndexCache
*
pCache
=
(
IndexCache
*
)
cache
;
while
(
quit
&&
atomic_load_32
(
&
pCache
->
merging
)
==
1
)
{
}
while
(
quit
&&
atomic_load_32
(
&
pCache
->
merging
)
==
1
)
;
TFileReader
*
pReader
=
tfileGetReaderByCol
(
sIdx
->
tindex
,
pCache
->
suid
,
pCache
->
colName
);
if
(
pReader
==
NULL
)
{
indexWarn
(
"empty tfile reader found"
);
...
...
@@ -561,7 +561,7 @@ void iterateValueDestroy(IterateValue* value, bool destroy) {
value
->
colVal
=
NULL
;
}
static
int64_t
i
ndexGetAvaial
bleVer
(
SIndex
*
sIdx
,
IndexCache
*
cache
)
{
static
int64_t
i
dxGetAvaila
bleVer
(
SIndex
*
sIdx
,
IndexCache
*
cache
)
{
ICacheKey
key
=
{.
suid
=
cache
->
suid
,
.
colName
=
cache
->
colName
,
.
nColName
=
strlen
(
cache
->
colName
)};
int64_t
ver
=
CACHE_VERSION
(
cache
);
...
...
@@ -579,7 +579,7 @@ static int64_t indexGetAvaialbleVer(SIndex* sIdx, IndexCache* cache) {
return
ver
;
}
static
int
idxGenTFile
(
SIndex
*
sIdx
,
IndexCache
*
cache
,
SArray
*
batch
)
{
int64_t
version
=
i
ndexGetAvaial
bleVer
(
sIdx
,
cache
);
int64_t
version
=
i
dxGetAvaila
bleVer
(
sIdx
,
cache
);
indexInfo
(
"file name version: %"
PRId64
""
,
version
);
uint8_t
colType
=
cache
->
type
;
...
...
source/libs/index/src/indexCache.c
浏览文件 @
daa2e868
...
...
@@ -127,7 +127,7 @@ static int32_t cacheSearchCompareFunc(void* cache, SIndexTerm* term, SIdxTRslt*
MemTable
*
mem
=
cache
;
IndexCache
*
pCache
=
mem
->
pCache
;
_cache_range_compare
cmpFn
=
i
nde
xGetCompare
(
type
);
_cache_range_compare
cmpFn
=
i
d
xGetCompare
(
type
);
CacheTerm
*
pCt
=
taosMemoryCalloc
(
1
,
sizeof
(
CacheTerm
));
pCt
->
colVal
=
term
->
colVal
;
...
...
@@ -257,7 +257,7 @@ static int32_t cacheSearchCompareFunc_JSON(void* cache, SIndexTerm* term, SIdxTR
if
(
cache
==
NULL
)
{
return
0
;
}
_cache_range_compare
cmpFn
=
i
nde
xGetCompare
(
type
);
_cache_range_compare
cmpFn
=
i
d
xGetCompare
(
type
);
MemTable
*
mem
=
cache
;
IndexCache
*
pCache
=
mem
->
pCache
;
...
...
source/libs/index/src/indexComm.c
浏览文件 @
daa2e868
...
...
@@ -75,35 +75,35 @@ char* idxInt2str(int64_t val, char* dst, int radix) {
;
return
dst
-
1
;
}
__compar_fn_t
i
nde
xGetCompar
(
int8_t
type
)
{
__compar_fn_t
i
d
xGetCompar
(
int8_t
type
)
{
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
return
(
__compar_fn_t
)
strcmp
;
}
return
getComparFunc
(
type
,
0
);
}
static
TExeCond
tCompareLessThan
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
i
nde
xGetCompar
(
type
);
__compar_fn_t
func
=
i
d
xGetCompar
(
type
);
return
tCompare
(
func
,
QUERY_LESS_THAN
,
a
,
b
,
type
);
}
static
TExeCond
tCompareLessEqual
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
i
nde
xGetCompar
(
type
);
__compar_fn_t
func
=
i
d
xGetCompar
(
type
);
return
tCompare
(
func
,
QUERY_LESS_EQUAL
,
a
,
b
,
type
);
}
static
TExeCond
tCompareGreaterThan
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
i
nde
xGetCompar
(
type
);
__compar_fn_t
func
=
i
d
xGetCompar
(
type
);
return
tCompare
(
func
,
QUERY_GREATER_THAN
,
a
,
b
,
type
);
}
static
TExeCond
tCompareGreaterEqual
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
i
nde
xGetCompar
(
type
);
__compar_fn_t
func
=
i
d
xGetCompar
(
type
);
return
tCompare
(
func
,
QUERY_GREATER_EQUAL
,
a
,
b
,
type
);
}
static
TExeCond
tCompareContains
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
i
nde
xGetCompar
(
type
);
__compar_fn_t
func
=
i
d
xGetCompar
(
type
);
return
tCompare
(
func
,
QUERY_TERM
,
a
,
b
,
type
);
}
static
TExeCond
tCompareEqual
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
i
nde
xGetCompar
(
type
);
__compar_fn_t
func
=
i
d
xGetCompar
(
type
);
return
tCompare
(
func
,
QUERY_TERM
,
a
,
b
,
type
);
}
TExeCond
tCompare
(
__compar_fn_t
func
,
int8_t
cmptype
,
void
*
a
,
void
*
b
,
int8_t
dtype
)
{
...
...
@@ -205,7 +205,7 @@ TExeCond tDoCompare(__compar_fn_t func, int8_t comparType, void* a, void* b) {
static
TExeCond
(
*
rangeCompare
[])(
void
*
a
,
void
*
b
,
int8_t
type
)
=
{
tCompareLessThan
,
tCompareLessEqual
,
tCompareGreaterThan
,
tCompareGreaterEqual
,
tCompareContains
,
tCompareEqual
};
_cache_range_compare
i
nde
xGetCompare
(
RangeType
ty
)
{
return
rangeCompare
[
ty
];
}
_cache_range_compare
i
d
xGetCompare
(
RangeType
ty
)
{
return
rangeCompare
[
ty
];
}
char
*
idxPackJsonData
(
SIndexTerm
*
itm
)
{
/*
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
daa2e868
...
...
@@ -318,7 +318,7 @@ int sifLessThan(void *a, void *b, int16_t dtype) {
}
int
sifEqual
(
void
*
a
,
void
*
b
,
int16_t
dtype
)
{
__compar_fn_t
func
=
getComparFunc
(
dtype
,
0
);
//__compar_fn_t func = i
nde
xGetCompar(dtype);
//__compar_fn_t func = i
d
xGetCompar(dtype);
return
(
int
)
tDoCompare
(
func
,
QUERY_TERM
,
a
,
b
);
}
static
Filter
sifGetFilterFunc
(
EIndexQueryType
type
,
bool
*
reverse
)
{
...
...
source/libs/index/src/indexTfile.c
浏览文件 @
daa2e868
...
...
@@ -305,7 +305,7 @@ static int32_t tfSearchCompareFunc(void* reader, SIndexTerm* tem, SIdxTRslt* tr,
int
ret
=
0
;
char
*
p
=
tem
->
colVal
;
int
skip
=
0
;
_cache_range_compare
cmpFn
=
i
nde
xGetCompare
(
type
);
_cache_range_compare
cmpFn
=
i
d
xGetCompare
(
type
);
SArray
*
offsets
=
taosArrayInit
(
16
,
sizeof
(
uint64_t
));
...
...
@@ -431,7 +431,7 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTRslt
p
=
idxPackJsonDataPrefix
(
tem
,
&
skip
);
}
_cache_range_compare
cmpFn
=
i
nde
xGetCompare
(
ctype
);
_cache_range_compare
cmpFn
=
i
d
xGetCompare
(
ctype
);
SArray
*
offsets
=
taosArrayInit
(
16
,
sizeof
(
uint64_t
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录