Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Rattenking
TDengine
提交
db726123
T
TDengine
项目概览
Rattenking
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
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 {
char
freed
:
4
;
char
listed
:
4
;
tsem_t
rspSem
;
pthread_mutex_t
inUse
;
// make sure that one connection can only be utilized by one thread/process
SSqlCmd
cmd
;
SSqlRes
res
;
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
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
->
pDnodeConn
=
pDnodeConn
;
...
...
@@ -291,23 +284,11 @@ int taos_query(TAOS *taos, const char *sqlstr) {
}
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
);
// wait for the callback function to post the semaphore
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
;
}
...
...
@@ -565,7 +546,6 @@ void taos_free_result(TAOS_RES *res) {
tscFreeSqlObj
(
pSql
);
}
else
{
tscPartiallyFreeSqlObj
(
pSql
);
pthread_mutex_unlock
(
&
pSql
->
inUse
);
// now this TAOS_CONN can be used by other threads
}
return
;
...
...
@@ -596,9 +576,8 @@ void taos_free_result(TAOS_RES *res) {
if
((
pCmd
->
command
==
TSDB_SQL_SELECT
||
pCmd
->
command
==
TSDB_SQL_SHOW
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_FETCH
)
&&
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
((
pCmd
->
command
<
TSDB_SQL_LOCAL
&&
pRes
->
completed
==
false
)
||
(
pCmd
->
command
==
TSDB_SQL_SELECT
&&
pSql
->
pStream
==
NULL
&&
pTableMetaInfo
->
pTableMeta
!=
NULL
)))
{
pCmd
->
command
==
TSDB_SQL_FETCH
)
&&
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
pRes
->
completed
==
false
&&
(
pCmd
->
command
==
TSDB_SQL_SELECT
&&
pSql
->
pStream
==
NULL
&&
pTableMetaInfo
->
pTableMeta
!=
NULL
))
{
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
,
...
...
src/query/inc/qfill.h
浏览文件 @
db726123
...
...
@@ -45,12 +45,13 @@ typedef struct SFillInfo {
int32_t
numOfCols
;
// number of columns, including the tags columns
int32_t
rowSize
;
// size of each row
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
*
nextValues
;
// next row of 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
char
**
pData
;
// original result data block involved in filling data
}
SFillInfo
;
typedef
struct
SPoint
{
...
...
src/query/src/qfill.c
浏览文件 @
db726123
...
...
@@ -79,7 +79,7 @@ SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_
int32_t
rowsize
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
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
;
}
...
...
@@ -89,6 +89,8 @@ SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_
}
pFillInfo
->
rowSize
=
rowsize
;
pFillInfo
->
capacityInRows
=
capacity
;
return
pFillInfo
;
}
...
...
@@ -119,6 +121,17 @@ void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey)
pFillInfo
->
rowIdx
=
0
;
pFillInfo
->
endKey
=
endKey
;
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
)
{
...
...
@@ -474,11 +487,11 @@ int32_t generateDataBlockImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t nu
}
int64_t
taosGenerateDataBlock
(
SFillInfo
*
pFillInfo
,
tFilePage
**
output
,
int32_t
capacity
)
{
int32_t
remain
=
taosNumOfRemainRows
(
pFillInfo
);
// todo use iterator?
int32_t
rows
=
taosGetNumOfResultWithFill
(
pFillInfo
,
remain
,
pFillInfo
->
endKey
,
capacity
);
int32_t
remain
=
taosNumOfRemainRows
(
pFillInfo
);
// todo use iterator?
int32_t
rows
=
taosGetNumOfResultWithFill
(
pFillInfo
,
remain
,
pFillInfo
->
endKey
,
capacity
);
int32_t
numOfRes
=
generateDataBlockImpl
(
pFillInfo
,
output
,
remain
,
rows
,
pFillInfo
->
pData
);
assert
(
numOfRes
==
rows
);
int32_t
numOfRes
=
generateDataBlockImpl
(
pFillInfo
,
output
,
remain
,
rows
,
pFillInfo
->
pData
);
assert
(
numOfRes
==
rows
);
return
numOfRes
;
return
numOfRes
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录