Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
db726123
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
db726123
编写于
5月 31, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] fix bugs found in script
上级
2b7cca80
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
27 addition
and
35 deletion
+27
-35
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+0
-1
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-24
src/query/inc/qfill.h
src/query/inc/qfill.h
+4
-3
src/query/src/qfill.c
src/query/src/qfill.c
+20
-7
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
db726123
...
@@ -318,7 +318,6 @@ typedef struct SSqlObj {
...
@@ -318,7 +318,6 @@ typedef struct SSqlObj {
char
freed
:
4
;
char
freed
:
4
;
char
listed
:
4
;
char
listed
:
4
;
tsem_t
rspSem
;
tsem_t
rspSem
;
pthread_mutex_t
inUse
;
// make sure that one connection can only be utilized by one thread/process
SSqlCmd
cmd
;
SSqlCmd
cmd
;
SSqlRes
res
;
SSqlRes
res
;
uint16_t
numOfSubs
;
uint16_t
numOfSubs
;
...
...
src/client/src/tscSql.c
浏览文件 @
db726123
...
@@ -123,13 +123,6 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
...
@@ -123,13 +123,6 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
tsem_init
(
&
pSql
->
rspSem
,
0
,
0
);
tsem_init
(
&
pSql
->
rspSem
,
0
,
0
);
pthread_mutexattr_t
mutexattr
;
memset
(
&
mutexattr
,
0
,
sizeof
(
pthread_mutexattr_t
));
pthread_mutexattr_settype
(
&
mutexattr
,
PTHREAD_MUTEX_RECURSIVE_NP
);
pthread_mutex_init
(
&
pSql
->
inUse
,
&
mutexattr
);
pthread_mutexattr_destroy
(
&
mutexattr
);
pObj
->
pSql
=
pSql
;
pObj
->
pSql
=
pSql
;
pObj
->
pDnodeConn
=
pDnodeConn
;
pObj
->
pDnodeConn
=
pDnodeConn
;
...
@@ -291,23 +284,11 @@ int taos_query(TAOS *taos, const char *sqlstr) {
...
@@ -291,23 +284,11 @@ int taos_query(TAOS *taos, const char *sqlstr) {
}
}
SSqlObj
*
pSql
=
pObj
->
pSql
;
SSqlObj
*
pSql
=
pObj
->
pSql
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
// now this TAOS_CONN object is in use by one thread
pthread_mutex_lock
(
&
pSql
->
inUse
);
size_t
sqlLen
=
strlen
(
sqlstr
);
size_t
sqlLen
=
strlen
(
sqlstr
);
doAsyncQuery
(
pObj
,
pSql
,
waitForQueryRsp
,
taos
,
sqlstr
,
sqlLen
);
doAsyncQuery
(
pObj
,
pSql
,
waitForQueryRsp
,
taos
,
sqlstr
,
sqlLen
);
// wait for the callback function to post the semaphore
// wait for the callback function to post the semaphore
tsem_wait
(
&
pSql
->
rspSem
);
tsem_wait
(
&
pSql
->
rspSem
);
if
(
pCmd
->
command
!=
TSDB_SQL_SELECT
&&
pCmd
->
command
!=
TSDB_SQL_SHOW
&&
pCmd
->
command
!=
TSDB_SQL_DESCRIBE_TABLE
)
{
pthread_mutex_unlock
(
&
pSql
->
inUse
);
}
return
pSql
->
res
.
code
;
return
pSql
->
res
.
code
;
}
}
...
@@ -565,7 +546,6 @@ void taos_free_result(TAOS_RES *res) {
...
@@ -565,7 +546,6 @@ void taos_free_result(TAOS_RES *res) {
tscFreeSqlObj
(
pSql
);
tscFreeSqlObj
(
pSql
);
}
else
{
}
else
{
tscPartiallyFreeSqlObj
(
pSql
);
tscPartiallyFreeSqlObj
(
pSql
);
pthread_mutex_unlock
(
&
pSql
->
inUse
);
// now this TAOS_CONN can be used by other threads
}
}
return
;
return
;
...
@@ -596,9 +576,8 @@ void taos_free_result(TAOS_RES *res) {
...
@@ -596,9 +576,8 @@ void taos_free_result(TAOS_RES *res) {
if
((
pCmd
->
command
==
TSDB_SQL_SELECT
||
if
((
pCmd
->
command
==
TSDB_SQL_SELECT
||
pCmd
->
command
==
TSDB_SQL_SHOW
||
pCmd
->
command
==
TSDB_SQL_SHOW
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_FETCH
)
&&
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
pCmd
->
command
==
TSDB_SQL_FETCH
)
&&
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
pRes
->
completed
==
false
&&
((
pCmd
->
command
<
TSDB_SQL_LOCAL
&&
pRes
->
completed
==
false
)
||
(
pCmd
->
command
==
TSDB_SQL_SELECT
&&
pSql
->
pStream
==
NULL
&&
pTableMetaInfo
->
pTableMeta
!=
NULL
))
{
(
pCmd
->
command
==
TSDB_SQL_SELECT
&&
pSql
->
pStream
==
NULL
&&
pTableMetaInfo
->
pTableMeta
!=
NULL
)))
{
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
tscTrace
(
"%p send msg to free qhandle in vnode, code:%d, numOfRows:%d, command:%s"
,
pSql
,
pRes
->
code
,
pRes
->
numOfRows
,
tscTrace
(
"%p send msg to free qhandle in vnode, code:%d, numOfRows:%d, command:%s"
,
pSql
,
pRes
->
code
,
pRes
->
numOfRows
,
...
...
src/query/inc/qfill.h
浏览文件 @
db726123
...
@@ -45,12 +45,13 @@ typedef struct SFillInfo {
...
@@ -45,12 +45,13 @@ typedef struct SFillInfo {
int32_t
numOfCols
;
// number of columns, including the tags columns
int32_t
numOfCols
;
// number of columns, including the tags columns
int32_t
rowSize
;
// size of each row
int32_t
rowSize
;
// size of each row
char
**
pTags
;
// tags value for current interpolation
char
**
pTags
;
// tags value for current interpolation
int64_t
slidingTime
;
// sliding value to determine the number of result for a given time window
int64_t
slidingTime
;
// sliding value to determine the number of result for a given time window
char
*
prevValues
;
// previous row of data, to generate the interpolation results
char
*
prevValues
;
// previous row of data, to generate the interpolation results
char
*
nextValues
;
// next row of data
char
*
nextValues
;
// next row of data
SFillColInfo
*
pFillCol
;
// column info for fill operations
char
**
pData
;
// original result data block involved in filling data
char
**
pData
;
// original result data block involved in filling data
int32_t
capacityInRows
;
// data buffer size in rows
SFillColInfo
*
pFillCol
;
// column info for fill operations
}
SFillInfo
;
}
SFillInfo
;
typedef
struct
SPoint
{
typedef
struct
SPoint
{
...
...
src/query/src/qfill.c
浏览文件 @
db726123
...
@@ -79,7 +79,7 @@ SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_
...
@@ -79,7 +79,7 @@ SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_
int32_t
rowsize
=
0
;
int32_t
rowsize
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
int32_t
bytes
=
pFillInfo
->
pFillCol
[
i
].
col
.
bytes
;
int32_t
bytes
=
pFillInfo
->
pFillCol
[
i
].
col
.
bytes
;
pFillInfo
->
pData
[
i
]
=
calloc
(
1
,
sizeof
(
tFilePage
)
+
bytes
*
capacity
);
pFillInfo
->
pData
[
i
]
=
calloc
(
1
,
bytes
*
capacity
);
rowsize
+=
bytes
;
rowsize
+=
bytes
;
}
}
...
@@ -89,6 +89,8 @@ SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_
...
@@ -89,6 +89,8 @@ SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_
}
}
pFillInfo
->
rowSize
=
rowsize
;
pFillInfo
->
rowSize
=
rowsize
;
pFillInfo
->
capacityInRows
=
capacity
;
return
pFillInfo
;
return
pFillInfo
;
}
}
...
@@ -119,6 +121,17 @@ void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey)
...
@@ -119,6 +121,17 @@ void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey)
pFillInfo
->
rowIdx
=
0
;
pFillInfo
->
rowIdx
=
0
;
pFillInfo
->
endKey
=
endKey
;
pFillInfo
->
endKey
=
endKey
;
pFillInfo
->
numOfRows
=
numOfRows
;
pFillInfo
->
numOfRows
=
numOfRows
;
// ensure the space
if
(
pFillInfo
->
capacityInRows
<
numOfRows
)
{
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
char
*
tmp
=
realloc
(
pFillInfo
->
pData
[
i
],
numOfRows
*
pFillInfo
->
pFillCol
[
i
].
col
.
bytes
);
assert
(
tmp
!=
NULL
);
// todo handle error
memset
(
tmp
,
0
,
numOfRows
*
pFillInfo
->
pFillCol
[
i
].
col
.
bytes
);
pFillInfo
->
pData
[
i
]
=
tmp
;
}
}
}
}
void
taosFillCopyInputDataFromFilePage
(
SFillInfo
*
pFillInfo
,
tFilePage
**
pInput
)
{
void
taosFillCopyInputDataFromFilePage
(
SFillInfo
*
pFillInfo
,
tFilePage
**
pInput
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录