Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bee37f49
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bee37f49
编写于
5月 14, 2022
作者:
haoranc
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of github.com:taosdata/TDengine into test/chr/TD-14699
上级
001f273b
9dc392d3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
73 addition
and
67 deletion
+73
-67
source/libs/executor/test/index_executor_tests.cpp
source/libs/executor/test/index_executor_tests.cpp
+26
-0
source/libs/index/src/index.c
source/libs/index/src/index.c
+28
-61
source/libs/index/test/jsonUT.cc
source/libs/index/test/jsonUT.cc
+13
-0
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+6
-6
未找到文件。
source/libs/executor/test/index_executor_tests.cpp
浏览文件 @
bee37f49
...
...
@@ -200,11 +200,37 @@ TEST(testCase, index_filter) {
doFilterTag
(
opNode
,
result
);
EXPECT_EQ
(
1
,
taosArrayGetSize
(
result
));
taosArrayDestroy
(
result
);
nodesDestroyNode
(
res
);
}
{
SNode
*
pLeft
=
NULL
,
*
pRight
=
NULL
,
*
opNode
=
NULL
,
*
res
=
NULL
;
sifMakeColumnNode
(
&
pLeft
,
"test"
,
"col"
,
COLUMN_TYPE_TAG
,
TSDB_DATA_TYPE_INT
);
sifMakeValueNode
(
&
pRight
,
TSDB_DATA_TYPE_INT
,
&
sifRightV
);
sifMakeOpNode
(
&
opNode
,
OP_TYPE_GREATER_THAN
,
TSDB_DATA_TYPE_INT
,
pLeft
,
pRight
);
SArray
*
result
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
doFilterTag
(
opNode
,
result
);
EXPECT_EQ
(
0
,
taosArrayGetSize
(
result
));
taosArrayDestroy
(
result
);
nodesDestroyNode
(
res
);
}
{
SNode
*
pLeft
=
NULL
,
*
pRight
=
NULL
,
*
opNode
=
NULL
,
*
res
=
NULL
;
sifMakeColumnNode
(
&
pLeft
,
"test"
,
"col"
,
COLUMN_TYPE_TAG
,
TSDB_DATA_TYPE_INT
);
sifMakeValueNode
(
&
pRight
,
TSDB_DATA_TYPE_INT
,
&
sifRightV
);
sifMakeOpNode
(
&
opNode
,
OP_TYPE_GREATER_EQUAL
,
TSDB_DATA_TYPE_DOUBLE
,
pLeft
,
pRight
);
SArray
*
result
=
taosArrayInit
(
4
,
sizeof
(
uint64_t
));
doFilterTag
(
opNode
,
result
);
EXPECT_EQ
(
0
,
taosArrayGetSize
(
result
));
taosArrayDestroy
(
result
);
nodesDestroyNode
(
res
);
}
}
// add other greater/lower/equal/in compare func test
TEST
(
testCase
,
index_filter_varify
)
{
{
SNode
*
pLeft
=
NULL
,
*
pRight
=
NULL
,
*
opNode
=
NULL
,
*
res
=
NULL
;
...
...
source/libs/index/src/index.c
浏览文件 @
bee37f49
...
...
@@ -27,10 +27,33 @@
#endif
#define INDEX_NUM_OF_THREADS 4
#define INDEX_QUEUE_SIZE
200
#define INDEX_QUEUE_SIZE 200
void
*
indexQhandle
=
NULL
;
#define INDEX_DATA_BOOL_NULL 0x02
#define INDEX_DATA_TINYINT_NULL 0x80
#define INDEX_DATA_SMALLINT_NULL 0x8000
#define INDEX_DATA_INT_NULL 0x80000000L
#define INDEX_DATA_BIGINT_NULL 0x8000000000000000L
#define INDEX_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL
#define INDEX_DATA_FLOAT_NULL 0x7FF00000 // it is an NAN
#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000L // an NAN
#define INDEX_DATA_NCHAR_NULL 0xFFFFFFFF
#define INDEX_DATA_BINARY_NULL 0xFF
#define INDEX_DATA_JSON_NULL 0xFFFFFFFF
#define INDEX_DATA_JSON_null 0xFFFFFFFE
#define INDEX_DATA_JSON_NOT_NULL 0x01
#define INDEX_DATA_UTINYINT_NULL 0xFF
#define INDEX_DATA_USMALLINT_NULL 0xFFFF
#define INDEX_DATA_UINT_NULL 0xFFFFFFFF
#define INDEX_DATA_UBIGINT_NULL 0xFFFFFFFFFFFFFFFFL
#define INDEX_DATA_NULL_STR "NULL"
#define INDEX_DATA_NULL_STR_L "null"
void
indexInit
()
{
// refactor later
indexQhandle
=
taosInitScheduler
(
INDEX_QUEUE_SIZE
,
INDEX_NUM_OF_THREADS
,
"index"
);
...
...
@@ -67,12 +90,6 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
return
-
1
;
}
#ifdef USE_LUCENE
index_t
*
index
=
index_open
(
path
);
sIdx
->
index
=
index
;
#endif
#ifdef USE_INVERTED_INDEX
// sIdx->cache = (void*)indexCacheCreate(sIdx);
sIdx
->
tindex
=
indexTFileCreate
(
path
);
if
(
sIdx
->
tindex
==
NULL
)
{
...
...
@@ -85,7 +102,6 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
taosThreadMutexInit
(
&
sIdx
->
mtx
,
NULL
);
*
index
=
sIdx
;
return
0
;
#endif
END:
if
(
sIdx
!=
NULL
)
{
...
...
@@ -97,12 +113,6 @@ END:
}
void
indexClose
(
SIndex
*
sIdx
)
{
#ifdef USE_LUCENE
index_close
(
sIdex
->
index
);
sIdx
->
index
=
NULL
;
#endif
#ifdef USE_INVERTED_INDEX
void
*
iter
=
taosHashIterate
(
sIdx
->
colObj
,
NULL
);
while
(
iter
)
{
IndexCache
**
pCache
=
iter
;
...
...
@@ -114,31 +124,12 @@ void indexClose(SIndex* sIdx) {
taosHashCleanup
(
sIdx
->
colObj
);
taosThreadMutexDestroy
(
&
sIdx
->
mtx
);
indexTFileDestroy
(
sIdx
->
tindex
);
#endif
taosMemoryFree
(
sIdx
->
path
);
taosMemoryFree
(
sIdx
);
return
;
}
int
indexPut
(
SIndex
*
index
,
SIndexMultiTerm
*
fVals
,
uint64_t
uid
)
{
#ifdef USE_LUCENE
index_document_t
*
doc
=
index_document_create
();
char
buf
[
16
]
=
{
0
};
sprintf
(
buf
,
"%d"
,
uid
);
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
fVals
);
i
++
)
{
SIndexTerm
*
p
=
taosArrayGetP
(
fVals
,
i
);
index_document_add
(
doc
,
(
const
char
*
)(
p
->
key
),
p
->
nKey
,
(
const
char
*
)(
p
->
val
),
p
->
nVal
,
1
);
}
index_document_add
(
doc
,
NULL
,
0
,
buf
,
strlen
(
buf
),
0
);
index_put
(
index
->
index
,
doc
);
index_document_destroy
(
doc
);
#endif
#ifdef USE_INVERTED_INDEX
// TODO(yihao): reduce the lock range
taosThreadMutexLock
(
&
index
->
mtx
);
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
fVals
);
i
++
)
{
...
...
@@ -170,12 +161,9 @@ int indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) {
return
ret
;
}
}
#endif
return
0
;
}
int
indexSearch
(
SIndex
*
index
,
SIndexMultiTermQuery
*
multiQuerys
,
SArray
*
result
)
{
#ifdef USE_INVERTED_INDEX
EIndexOperatorType
opera
=
multiQuerys
->
opera
;
// relation of querys
SArray
*
iRslts
=
taosArrayInit
(
4
,
POINTER_BYTES
);
...
...
@@ -188,35 +176,14 @@ int indexSearch(SIndex* index, SIndexMultiTermQuery* multiQuerys, SArray* result
}
indexMergeFinalResults
(
iRslts
,
opera
,
result
);
indexInterResultsDestroy
(
iRslts
);
#endif
return
0
;
}
int
indexDelete
(
SIndex
*
index
,
SIndexMultiTermQuery
*
query
)
{
#ifdef USE_INVERTED_INDEX
#endif
int
indexDelete
(
SIndex
*
index
,
SIndexMultiTermQuery
*
query
)
{
return
1
;
}
int
indexRebuild
(
SIndex
*
index
,
SIndexOpts
*
opts
)
{
return
0
;
}
return
1
;
}
int
indexRebuild
(
SIndex
*
index
,
SIndexOpts
*
opts
)
{
#ifdef USE_INVERTED_INDEX
#endif
return
0
;
}
SIndexOpts
*
indexOptsCreate
()
{
#ifdef USE_LUCENE
#endif
return
NULL
;
}
void
indexOptsDestroy
(
SIndexOpts
*
opts
)
{
#ifdef USE_LUCENE
#endif
return
;
}
SIndexOpts
*
indexOptsCreate
()
{
return
NULL
;
}
void
indexOptsDestroy
(
SIndexOpts
*
opts
)
{
return
;
}
/*
* @param: oper
*
...
...
source/libs/index/test/jsonUT.cc
浏览文件 @
bee37f49
...
...
@@ -403,6 +403,19 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache) {
EXPECT_EQ
(
1000
,
taosArrayGetSize
(
result
));
indexMultiTermQueryDestroy
(
mq
);
}
{
std
::
string
colName
(
"other_column"
);
std
::
string
colVal
(
"100"
);
SIndexTerm
*
term
=
indexTermCreate
(
1
,
ADD_VALUE
,
TSDB_DATA_TYPE_INT
,
colName
.
c_str
(),
colName
.
size
(),
colVal
.
c_str
(),
colVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
for
(
size_t
i
=
0
;
i
<
1000
;
i
++
)
{
tIndexJsonPut
(
index
,
terms
,
i
);
}
indexMultiTermDestroy
(
terms
);
}
{
std
::
string
colName
(
"test1"
);
std
::
string
colVal
(
"10"
);
...
...
source/libs/transport/src/transCli.c
浏览文件 @
bee37f49
...
...
@@ -145,9 +145,9 @@ static void cliWalkCb(uv_handle_t* handle, void* arg);
} while (0)
#define CONN_HOST_THREAD_INDEX(conn) (conn ? ((SCliConn*)conn)->hThrdIdx : -1)
#define CONN_PERSIST_TIME(para)
(para * 1000 * 10)
#define CONN_GET_HOST_THREAD(conn)
(conn ? ((SCliConn*)conn)->hostThrd : NULL)
#define CONN_GET_INST_LABEL(conn)
(((STrans*)(((SCliThrdObj*)(conn)->hostThrd)->pTransInst))->label)
#define CONN_PERSIST_TIME(para) (para * 1000 * 10)
#define CONN_GET_HOST_THREAD(conn) (conn ? ((SCliConn*)conn)->hostThrd : NULL)
#define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrdObj*)(conn)->hostThrd)->pTransInst))->label)
#define CONN_SHOULD_RELEASE(conn, head) \
do { \
if ((head)->release == 1 && (head->msgLen) == sizeof(*head)) { \
...
...
@@ -223,11 +223,11 @@ static void cliWalkCb(uv_handle_t* handle, void* arg);
#define CONN_RELEASE_BY_SERVER(conn) \
(((conn)->status == ConnRelease || (conn)->status == ConnInPool) && T_REF_VAL_GET(conn) == 1)
#define REQUEST_NO_RESP(msg)
((msg)->noResp == 1)
#define REQUEST_PERSIS_HANDLE(msg)
((msg)->persistHandle == 1)
#define REQUEST_NO_RESP(msg) ((msg)->noResp == 1)
#define REQUEST_PERSIS_HANDLE(msg) ((msg)->persistHandle == 1)
#define REQUEST_RELEASE_HANDLE(cmsg) ((cmsg)->type == Release)
#define EPSET_GET_INUSE_IP(epSet)
((epSet)->eps[(epSet)->inUse].fqdn)
#define EPSET_GET_INUSE_IP(epSet) ((epSet)->eps[(epSet)->inUse].fqdn)
#define EPSET_GET_INUSE_PORT(epSet) ((epSet)->eps[(epSet)->inUse].port)
static
void
*
cliWorkThread
(
void
*
arg
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录