Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
46dd88a9
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
46dd88a9
编写于
12月 20, 2019
作者:
S
slguan
提交者:
GitHub
12月 20, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #973 from taosdata/master-lihui
[TBASE-1360]
上级
3f19b394
14349874
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
11 deletion
+41
-11
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-0
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+24
-8
src/client/src/tscServer.c
src/client/src/tscServer.c
+3
-3
src/client/src/tscSql.c
src/client/src/tscSql.c
+12
-0
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
46dd88a9
...
@@ -386,6 +386,8 @@ typedef struct _sql_obj {
...
@@ -386,6 +386,8 @@ typedef struct _sql_obj {
SSqlRes
res
;
SSqlRes
res
;
char
numOfSubs
;
char
numOfSubs
;
char
*
asyncTblPos
;
void
*
pTableHashList
;
struct
_sql_obj
**
pSubs
;
struct
_sql_obj
**
pSubs
;
struct
_sql_obj
*
prev
,
*
next
;
struct
_sql_obj
*
prev
,
*
next
;
}
SSqlObj
;
}
SSqlObj
;
...
...
src/client/src/tscParseInsert.c
浏览文件 @
46dd88a9
...
@@ -840,9 +840,17 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
...
@@ -840,9 +840,17 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
return
code
;
return
code
;
}
}
void
*
pTableHashList
=
taosInitIntHash
(
128
,
POINTER_BYTES
,
taosHashInt
);
if
((
NULL
==
pSql
->
asyncTblPos
)
&&
(
NULL
==
pSql
->
pTableHashList
))
{
pSql
->
pTableHashList
=
taosInitIntHash
(
128
,
POINTER_BYTES
,
taosHashInt
);
pSql
->
cmd
.
pDataBlocks
=
tscCreateBlockArrayList
();
pSql
->
cmd
.
pDataBlocks
=
tscCreateBlockArrayList
();
if
(
NULL
==
pSql
->
pTableHashList
||
NULL
==
pSql
->
cmd
.
pDataBlocks
)
{
code
=
TSDB_CODE_CLI_OUT_OF_MEMORY
;
goto
_error_clean
;
}
}
else
{
str
=
pSql
->
asyncTblPos
;
}
tscTrace
(
"%p create data block list for submit data, %p"
,
pSql
,
pSql
->
cmd
.
pDataBlocks
);
tscTrace
(
"%p create data block list for submit data, %p"
,
pSql
,
pSql
->
cmd
.
pDataBlocks
);
while
(
1
)
{
while
(
1
)
{
...
@@ -861,6 +869,8 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
...
@@ -861,6 +869,8 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
}
}
}
}
pSql
->
asyncTblPos
=
sToken
.
z
;
// Check if the table name available or not
// Check if the table name available or not
if
(
validateTableName
(
sToken
.
z
,
sToken
.
n
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
validateTableName
(
sToken
.
z
,
sToken
.
n
)
!=
TSDB_CODE_SUCCESS
)
{
code
=
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"table name invalid"
,
sToken
.
z
);
code
=
tscInvalidSQLErrMsg
(
pCmd
->
payload
,
"table name invalid"
,
sToken
.
z
);
...
@@ -875,7 +885,8 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
...
@@ -875,7 +885,8 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
void
*
fp
=
pSql
->
fp
;
void
*
fp
=
pSql
->
fp
;
if
((
code
=
tscParseSqlForCreateTableOnDemand
(
&
str
,
pSql
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
tscParseSqlForCreateTableOnDemand
(
&
str
,
pSql
))
!=
TSDB_CODE_SUCCESS
)
{
if
(
fp
!=
NULL
)
{
if
(
fp
!=
NULL
)
{
goto
_clean
;
//goto _clean;
return
code
;
}
else
{
}
else
{
/*
/*
* for async insert, the free data block operations, which is tscDestroyBlockArrayList,
* for async insert, the free data block operations, which is tscDestroyBlockArrayList,
...
@@ -918,7 +929,7 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
...
@@ -918,7 +929,7 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
* app here insert data in different vnodes, so we need to set the following
* app here insert data in different vnodes, so we need to set the following
* data in another submit procedure using async insert routines
* data in another submit procedure using async insert routines
*/
*/
code
=
doParseInsertStatement
(
pSql
,
pTableHashList
,
&
str
,
&
spd
,
&
totalNum
);
code
=
doParseInsertStatement
(
pSql
,
p
Sql
->
p
TableHashList
,
&
str
,
&
spd
,
&
totalNum
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error_clean
;
goto
_error_clean
;
}
}
...
@@ -1033,7 +1044,7 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
...
@@ -1033,7 +1044,7 @@ int doParserInsertSql(SSqlObj *pSql, char *str) {
goto
_error_clean
;
goto
_error_clean
;
}
}
code
=
doParseInsertStatement
(
pSql
,
pTableHashList
,
&
str
,
&
spd
,
&
totalNum
);
code
=
doParseInsertStatement
(
pSql
,
p
Sql
->
p
TableHashList
,
&
str
,
&
spd
,
&
totalNum
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error_clean
;
goto
_error_clean
;
}
}
...
@@ -1073,7 +1084,8 @@ _error_clean:
...
@@ -1073,7 +1084,8 @@ _error_clean:
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
_clean:
_clean:
taosCleanUpIntHash
(
pTableHashList
);
taosCleanUpIntHash
(
pSql
->
pTableHashList
);
pSql
->
pTableHashList
=
NULL
;
return
code
;
return
code
;
}
}
...
@@ -1108,7 +1120,11 @@ int tsParseSql(SSqlObj *pSql, char *acct, char *db, bool multiVnodeInsertion) {
...
@@ -1108,7 +1120,11 @@ int tsParseSql(SSqlObj *pSql, char *acct, char *db, bool multiVnodeInsertion) {
// must before clean the sqlcmd object
// must before clean the sqlcmd object
tscRemoveAllMeterMetaInfo
(
&
pSql
->
cmd
,
false
);
tscRemoveAllMeterMetaInfo
(
&
pSql
->
cmd
,
false
);
tscCleanSqlCmd
(
&
pSql
->
cmd
);
if
(
NULL
==
pSql
->
asyncTblPos
)
{
tscTrace
(
"continue parse sql: %s"
,
pSql
->
asyncTblPos
);
tscCleanSqlCmd
(
&
pSql
->
cmd
);
}
if
(
tscIsInsertOrImportData
(
pSql
->
sqlstr
))
{
if
(
tscIsInsertOrImportData
(
pSql
->
sqlstr
))
{
/*
/*
...
...
src/client/src/tscServer.c
浏览文件 @
46dd88a9
...
@@ -3581,9 +3581,9 @@ int tscGetMeterMeta(SSqlObj *pSql, char *meterId, int32_t index) {
...
@@ -3581,9 +3581,9 @@ int tscGetMeterMeta(SSqlObj *pSql, char *meterId, int32_t index) {
* for async insert operation, release data block buffer before issue new object to get metermeta
* for async insert operation, release data block buffer before issue new object to get metermeta
* because in metermeta callback function, the tscParse function will generate the submit data blocks
* because in metermeta callback function, the tscParse function will generate the submit data blocks
*/
*/
if
(
pSql
->
fp
!=
NULL
&&
pSql
->
pStream
==
NULL
)
{
//
if (pSql->fp != NULL && pSql->pStream == NULL) {
tscFreeSqlCmdData
(
pCmd
);
//
tscFreeSqlCmdData(pCmd);
}
//
}
return
tscDoGetMeterMeta
(
pSql
,
meterId
,
index
);
return
tscDoGetMeterMeta
(
pSql
,
meterId
,
index
);
}
}
...
...
src/client/src/tscSql.c
浏览文件 @
46dd88a9
...
@@ -230,6 +230,12 @@ int taos_query_imp(STscObj* pObj, SSqlObj* pSql) {
...
@@ -230,6 +230,12 @@ int taos_query_imp(STscObj* pObj, SSqlObj* pSql) {
pRes
->
numOfRows
=
1
;
pRes
->
numOfRows
=
1
;
pRes
->
numOfTotal
=
0
;
pRes
->
numOfTotal
=
0
;
pSql
->
asyncTblPos
=
NULL
;
if
(
NULL
!=
pSql
->
pTableHashList
)
{
taosCleanUpIntHash
(
pSql
->
pTableHashList
);
pSql
->
pTableHashList
=
NULL
;
}
tscTrace
(
"%p SQL: %s pObj:%p"
,
pSql
,
pSql
->
sqlstr
,
pObj
);
tscTrace
(
"%p SQL: %s pObj:%p"
,
pSql
,
pSql
->
sqlstr
,
pObj
);
pRes
->
code
=
(
uint8_t
)
tsParseSql
(
pSql
,
pObj
->
acctId
,
pObj
->
db
,
false
);
pRes
->
code
=
(
uint8_t
)
tsParseSql
(
pSql
,
pObj
->
acctId
,
pObj
->
db
,
false
);
...
@@ -940,6 +946,12 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
...
@@ -940,6 +946,12 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
strtolower
(
pSql
->
sqlstr
,
sql
);
strtolower
(
pSql
->
sqlstr
,
sql
);
pSql
->
asyncTblPos
=
NULL
;
if
(
NULL
!=
pSql
->
pTableHashList
)
{
taosCleanUpIntHash
(
pSql
->
pTableHashList
);
pSql
->
pTableHashList
=
NULL
;
}
pRes
->
code
=
(
uint8_t
)
tsParseSql
(
pSql
,
pObj
->
acctId
,
pObj
->
db
,
false
);
pRes
->
code
=
(
uint8_t
)
tsParseSql
(
pSql
,
pObj
->
acctId
,
pObj
->
db
,
false
);
int
code
=
pRes
->
code
;
int
code
=
pRes
->
code
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录