Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Tonvia
TDengine
提交
e589dc24
T
TDengine
项目概览
Tonvia
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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,发现更多精彩内容 >>
未验证
提交
e589dc24
编写于
9月 21, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
9月 21, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3594 from taosdata/bugfix/stream
[TD-1529]<fix>: CQ create db connection async
上级
fad472bc
1f73c106
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
7 deletion
+28
-7
src/client/src/tscSql.c
src/client/src/tscSql.c
+9
-1
src/client/src/tscStream.c
src/client/src/tscStream.c
+5
-0
src/cq/CMakeLists.txt
src/cq/CMakeLists.txt
+2
-0
src/cq/src/cqMain.c
src/cq/src/cqMain.c
+12
-6
未找到文件。
src/client/src/tscSql.c
浏览文件 @
e589dc24
...
...
@@ -236,13 +236,21 @@ TAOS *taos_connect_c(const char *ip, uint8_t ipLen, const char *user, uint8_t us
return
taos_connect
(
ipBuf
,
userBuf
,
passBuf
,
dbBuf
,
port
);
}
static
void
asyncConnCallback
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
tres
;
assert
(
pSql
!=
NULL
);
pSql
->
fetchFp
(
pSql
->
param
,
tres
,
code
);
}
TAOS
*
taos_connect_a
(
char
*
ip
,
char
*
user
,
char
*
pass
,
char
*
db
,
uint16_t
port
,
void
(
*
fp
)(
void
*
,
TAOS_RES
*
,
int
),
void
*
param
,
void
**
taos
)
{
SSqlObj
*
pSql
=
taosConnectImpl
(
ip
,
user
,
pass
,
NULL
,
db
,
port
,
fp
,
param
,
taos
);
SSqlObj
*
pSql
=
taosConnectImpl
(
ip
,
user
,
pass
,
NULL
,
db
,
port
,
asyncConnCallback
,
param
,
taos
);
if
(
pSql
==
NULL
)
{
return
NULL
;
}
pSql
->
fetchFp
=
fp
;
pSql
->
res
.
code
=
tscProcessSql
(
pSql
);
tscDebug
(
"%p DB async connection is opening"
,
taos
);
return
taos
;
...
...
src/client/src/tscStream.c
浏览文件 @
e589dc24
...
...
@@ -515,6 +515,10 @@ static void tscCreateStream(void *param, TAOS_RES *res, int code) {
return
;
}
uint64_t
handle
=
(
uint64_t
)
pSql
;
pSql
->
self
=
taosCachePut
(
tscObjCache
,
&
handle
,
sizeof
(
uint64_t
),
&
pSql
,
sizeof
(
uint64_t
),
2
*
3600
*
1000
);
T_REF_INC
(
pSql
->
pTscObj
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
...
...
@@ -608,6 +612,7 @@ void taos_close_stream(TAOS_STREAM *handle) {
* Here, we need a check before release memory
*/
if
(
pSql
->
signature
==
pSql
)
{
T_REF_DEC
(
pSql
->
pTscObj
);
tscRemoveFromStreamList
(
pStream
,
pSql
);
taosTmrStopA
(
&
(
pStream
->
pTimer
));
...
...
src/cq/CMakeLists.txt
浏览文件 @
e589dc24
...
...
@@ -2,6 +2,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/client/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/src SRC
)
IF
(
TD_LINUX
)
...
...
src/cq/src/cqMain.c
浏览文件 @
e589dc24
...
...
@@ -21,6 +21,7 @@
#include <string.h>
#include "taos.h"
#include "tsclient.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "ttimer.h"
...
...
@@ -238,18 +239,23 @@ void cqDrop(void *handle) {
pthread_mutex_unlock
(
&
pContext
->
mutex
);
}
static
void
doCreateStream
(
void
*
param
,
TAOS_RES
*
result
,
int
code
)
{
SCqObj
*
pObj
=
(
SCqObj
*
)
param
;
SCqContext
*
pContext
=
pObj
->
pContext
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
result
;
pContext
->
dbConn
=
pSql
->
pTscObj
;
cqCreateStream
(
pContext
,
pObj
);
}
static
void
cqProcessCreateTimer
(
void
*
param
,
void
*
tmrId
)
{
SCqObj
*
pObj
=
(
SCqObj
*
)
param
;
SCqContext
*
pContext
=
pObj
->
pContext
;
if
(
pContext
->
dbConn
==
NULL
)
{
pContext
->
dbConn
=
taos_connect
(
"localhost"
,
pContext
->
user
,
pContext
->
pass
,
pContext
->
db
,
0
);
if
(
pContext
->
dbConn
==
NULL
)
{
cError
(
"vgId:%d, failed to connect to TDengine(%s)"
,
pContext
->
vgId
,
tstrerror
(
terrno
));
}
taos_connect_a
(
NULL
,
pContext
->
user
,
pContext
->
pass
,
pContext
->
db
,
0
,
doCreateStream
,
param
,
NULL
);
}
else
{
cqCreateStream
(
pContext
,
pObj
);
}
cqCreateStream
(
pContext
,
pObj
);
}
static
void
cqCreateStream
(
SCqContext
*
pContext
,
SCqObj
*
pObj
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录