Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cb37bb35
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看板
未验证
提交
cb37bb35
编写于
5月 18, 2022
作者:
dengyihao
提交者:
GitHub
5月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12647 from taosdata/fix/invalid_read
Fix/invalid read
上级
6f2cac1a
3de22159
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
15 deletion
+46
-15
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+11
-0
source/libs/index/test/jsonUT.cc
source/libs/index/test/jsonUT.cc
+34
-15
source/libs/transport/src/transSrv.c
source/libs/transport/src/transSrv.c
+1
-0
未找到文件。
source/libs/index/src/indexComm.c
浏览文件 @
cb37bb35
...
...
@@ -316,46 +316,57 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
case
TSDB_DATA_TYPE_TIMESTAMP
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
indexInt2str
(
*
(
int64_t
*
)
src
,
*
dst
,
-
1
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_UTINYINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
indexInt2str
(
*
(
uint8_t
*
)
src
,
*
dst
,
1
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
indexInt2str
(
*
(
int8_t
*
)
src
,
*
dst
,
1
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
indexInt2str
(
*
(
int16_t
*
)
src
,
*
dst
,
-
1
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
indexInt2str
(
*
(
uint16_t
*
)
src
,
*
dst
,
-
1
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_INT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
indexInt2str
(
*
(
int32_t
*
)
src
,
*
dst
,
-
1
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_UINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
indexInt2str
(
*
(
uint32_t
*
)
src
,
*
dst
,
1
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_BIGINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
sprintf
(
*
dst
,
"%"
PRIu64
,
*
(
uint64_t
*
)
src
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
indexInt2str
(
*
(
uint64_t
*
)
src
,
*
dst
,
1
);
tlen
=
strlen
(
*
dst
);
case
TSDB_DATA_TYPE_FLOAT
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
sprintf
(
*
dst
,
"%.9lf"
,
*
(
float
*
)
src
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
*
dst
=
taosMemoryCalloc
(
1
,
bufSize
+
1
);
sprintf
(
*
dst
,
"%.9lf"
,
*
(
double
*
)
src
);
tlen
=
strlen
(
*
dst
);
break
;
case
TSDB_DATA_TYPE_NCHAR
:
{
tlen
=
taosEncodeBinary
(
NULL
,
varDataVal
(
src
),
varDataLen
(
src
));
...
...
source/libs/index/test/jsonUT.cc
浏览文件 @
cb37bb35
...
...
@@ -66,6 +66,17 @@ static void WriteData(SIndexJson* index, const std::string& colName, int8_t dtyp
indexMultiTermDestroy
(
terms
);
}
static
void
delData
(
SIndexJson
*
index
,
const
std
::
string
&
colName
,
int8_t
dtype
,
void
*
data
,
int
dlen
,
int
tableId
,
int8_t
operType
=
DEL_VALUE
)
{
SIndexTerm
*
term
=
indexTermCreate
(
1
,
(
SIndexOperOnColumn
)
operType
,
dtype
,
colName
.
c_str
(),
colName
.
size
(),
(
const
char
*
)
data
,
dlen
);
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
tIndexJsonPut
(
index
,
terms
,
(
int64_t
)
tableId
);
indexMultiTermDestroy
(
terms
);
}
static
void
Search
(
SIndexJson
*
index
,
const
std
::
string
&
colNam
,
int8_t
dtype
,
void
*
data
,
int
dlen
,
int8_t
filterType
,
SArray
**
result
)
{
std
::
string
colName
(
colNam
);
...
...
@@ -580,38 +591,46 @@ TEST_F(JsonEnv, testWriteJsonTfileAndCache_FLOAT) {
}
TEST_F
(
JsonEnv
,
testWriteJsonTfileAndCache_DOUBLE
)
{
{
double
val
=
10.0
;
std
::
string
colName
(
"test1"
);
double
val
=
10.0
;
for
(
int
i
=
0
;
i
<
1000
;
i
++
)
{
WriteData
(
index
,
colName
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
i
);
WriteData
(
index
,
"test1"
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
i
);
}
}
{
double
val
=
2.0
;
std
::
string
colName
(
"test1"
);
double
val
=
2.0
;
for
(
int
i
=
0
;
i
<
1000
;
i
++
)
{
WriteData
(
index
,
colName
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
i
+
1000
);
WriteData
(
index
,
"test1"
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
i
+
1000
);
}
}
{
SArray
*
res
=
NULL
;
std
::
string
colName
(
"test1"
);
double
val
=
1.9
;
Search
(
index
,
colName
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
QUERY_GREATER_EQUAL
,
&
res
);
Search
(
index
,
"test1"
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
QUERY_GREATER_EQUAL
,
&
res
);
EXPECT_EQ
(
2000
,
taosArrayGetSize
(
res
));
}
{
SArray
*
res
=
NULL
;
std
::
string
colName
(
"test1"
);
double
val
=
2.1
;
Search
(
index
,
colName
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
QUERY_GREATER_EQUAL
,
&
res
);
SArray
*
res
=
NULL
;
double
val
=
2.1
;
Search
(
index
,
"test1"
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
QUERY_GREATER_EQUAL
,
&
res
);
EXPECT_EQ
(
1000
,
taosArrayGetSize
(
res
));
}
{
std
::
string
colName
(
"test1"
);
SArray
*
res
=
NULL
;
double
val
=
2.1
;
Search
(
index
,
colName
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
QUERY_GREATER_EQUAL
,
&
res
);
SArray
*
res
=
NULL
;
double
val
=
2.1
;
Search
(
index
,
"test1"
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
QUERY_GREATER_EQUAL
,
&
res
);
EXPECT_EQ
(
1000
,
taosArrayGetSize
(
res
));
}
{
SArray
*
res
=
NULL
;
double
val
=
10.0
;
Search
(
index
,
"test1"
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
QUERY_LESS_EQUAL
,
&
res
);
EXPECT_EQ
(
2000
,
taosArrayGetSize
(
res
));
}
{
SArray
*
res
=
NULL
;
double
val
=
10.0
;
Search
(
index
,
"test1"
,
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
sizeof
(
val
),
QUERY_LESS_THAN
,
&
res
);
EXPECT_EQ
(
1000
,
taosArrayGetSize
(
res
));
}
}
source/libs/transport/src/transSrv.c
浏览文件 @
cb37bb35
...
...
@@ -264,6 +264,7 @@ static void uvHandleReq(SSrvConn* pConn) {
CONN_SHOULD_RELEASE
(
pConn
,
pHead
);
STransMsg
transMsg
;
memset
(
&
transMsg
,
0
,
sizeof
(
transMsg
));
transMsg
.
contLen
=
transContLenFromMsg
(
pHead
->
msgLen
);
transMsg
.
pCont
=
pHead
->
content
;
transMsg
.
msgType
=
pHead
->
msgType
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录