Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d50054c7
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看板
提交
d50054c7
编写于
1月 21, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2790]<fix>: fix the bug that tableMeta is not updated if parse error occurs.
上级
18f70372
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
26 addition
and
22 deletion
+26
-22
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+2
-2
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+1
-1
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+5
-8
src/client/src/tscSql.c
src/client/src/tscSql.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+15
-8
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
d50054c7
...
...
@@ -99,14 +99,14 @@ static FORCE_INLINE SQueryInfo* tscGetQueryInfoDetail(SSqlCmd* pCmd, int32_t sub
}
int32_t
tscCreateDataBlock
(
size_t
initialSize
,
int32_t
rowSize
,
int32_t
startOffset
,
SName
*
name
,
STableMeta
*
pTableMeta
,
STableDataBlocks
**
dataBlocks
);
void
tscDestroyDataBlock
(
STableDataBlocks
*
pDataBlock
);
void
tscDestroyDataBlock
(
STableDataBlocks
*
pDataBlock
,
bool
removeMeta
);
void
tscSortRemoveDataBlockDupRows
(
STableDataBlocks
*
dataBuf
);
SParamInfo
*
tscAddParamToDataBlock
(
STableDataBlocks
*
pDataBlock
,
char
type
,
uint8_t
timePrec
,
int16_t
bytes
,
uint32_t
offset
);
void
*
tscDestroyBlockArrayList
(
SArray
*
pDataBlockList
);
void
*
tscDestroyBlockHashTable
(
SHashObj
*
pBlockHashTable
);
void
*
tscDestroyBlockHashTable
(
SHashObj
*
pBlockHashTable
,
bool
removeMeta
);
int32_t
tscCopyDataBlockToPayload
(
SSqlObj
*
pSql
,
STableDataBlocks
*
pDataBlock
);
int32_t
tscMergeTableDataBlocks
(
SSqlObj
*
pSql
,
bool
freeBlockMap
);
...
...
src/client/inc/tsclient.h
浏览文件 @
d50054c7
...
...
@@ -411,7 +411,7 @@ void tscRestoreSQLFuncForSTableQuery(SQueryInfo *pQueryInfo);
int32_t
tscCreateResPointerInfo
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
);
void
tscSetResRawPtr
(
SSqlRes
*
pRes
,
SQueryInfo
*
pQueryInfo
);
void
tscResetSqlCmd
Obj
(
SSqlCmd
*
pCmd
);
void
tscResetSqlCmd
(
SSqlCmd
*
pCmd
,
bool
removeMeta
);
/**
* free query result of the sql object
...
...
src/client/src/tscAsync.c
浏览文件 @
d50054c7
...
...
@@ -351,7 +351,7 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
)
{
tscDebug
(
"%p redo parse sql string and proceed"
,
pSql
);
pCmd
->
parseFinished
=
false
;
tscResetSqlCmd
Obj
(
pCmd
);
tscResetSqlCmd
(
pCmd
,
true
);
code
=
tsParseSql
(
pSql
,
true
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
...
...
src/client/src/tscParseInsert.c
浏览文件 @
d50054c7
...
...
@@ -1036,11 +1036,7 @@ static int32_t validateDataSource(SSqlCmd *pCmd, int8_t type, const char *sql) {
}
/**
* usage: insert into table1 values() () table2 values()()
*
* @param str
* @param acct
* @param db
* parse insert sql
* @param pSql
* @return
*/
...
...
@@ -1343,10 +1339,11 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
// make a backup as tsParseInsertSql may modify the string
char
*
sqlstr
=
strdup
(
pSql
->
sqlstr
);
ret
=
tsParseInsertSql
(
pSql
);
if
(
sqlstr
==
NULL
||
pSql
->
parseRetry
>=
1
||
ret
!=
TSDB_CODE_TSC_INVALID_SQL
)
{
if
((
sqlstr
==
NULL
)
||
(
pSql
->
parseRetry
>=
1
)
||
(
ret
!=
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
&&
ret
!=
TSDB_CODE_TSC_INVALID_SQL
))
{
free
(
sqlstr
);
}
else
{
tscResetSqlCmd
Obj
(
pCmd
);
tscResetSqlCmd
(
pCmd
,
true
);
free
(
pSql
->
sqlstr
);
pSql
->
sqlstr
=
sqlstr
;
pSql
->
parseRetry
++
;
...
...
@@ -1358,7 +1355,7 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
SSqlInfo
SQLInfo
=
qSQLParse
(
pSql
->
sqlstr
);
ret
=
tscToSQLCmd
(
pSql
,
&
SQLInfo
);
if
(
ret
==
TSDB_CODE_TSC_INVALID_SQL
&&
pSql
->
parseRetry
==
0
&&
SQLInfo
.
type
==
TSDB_SQL_NULL
)
{
tscResetSqlCmd
Obj
(
pCmd
);
tscResetSqlCmd
(
pCmd
,
true
);
pSql
->
parseRetry
++
;
ret
=
tscToSQLCmd
(
pSql
,
&
SQLInfo
);
}
...
...
src/client/src/tscSql.c
浏览文件 @
d50054c7
...
...
@@ -936,7 +936,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
static
int
tscParseTblNameList
(
SSqlObj
*
pSql
,
const
char
*
tblNameList
,
int32_t
tblListLen
)
{
// must before clean the sqlcmd object
tscResetSqlCmd
Obj
(
&
pSql
->
cmd
);
tscResetSqlCmd
(
&
pSql
->
cmd
,
false
);
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
d50054c7
...
...
@@ -2441,7 +2441,7 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
pParentObj
->
cmd
.
parseFinished
=
false
;
tscResetSqlCmd
Obj
(
&
pParentObj
->
cmd
);
tscResetSqlCmd
(
&
pParentObj
->
cmd
,
false
);
// in case of insert, redo parsing the sql string and build new submit data block for two reasons:
// 1. the table Id(tid & uid) may have been update, the submit block needs to be updated accordingly.
...
...
src/client/src/tscUtil.c
浏览文件 @
d50054c7
...
...
@@ -381,7 +381,7 @@ void tscFreeQueryInfo(SSqlCmd* pCmd) {
tfree
(
pCmd
->
pQueryInfo
);
}
void
tscResetSqlCmd
Obj
(
SSqlCmd
*
pCmd
)
{
void
tscResetSqlCmd
(
SSqlCmd
*
pCmd
,
bool
removeMeta
)
{
pCmd
->
command
=
0
;
pCmd
->
numOfCols
=
0
;
pCmd
->
count
=
0
;
...
...
@@ -399,7 +399,7 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd) {
pCmd
->
numOfTables
=
0
;
tfree
(
pCmd
->
pTableNameList
);
pCmd
->
pTableBlockHashList
=
tscDestroyBlockHashTable
(
pCmd
->
pTableBlockHashList
);
pCmd
->
pTableBlockHashList
=
tscDestroyBlockHashTable
(
pCmd
->
pTableBlockHashList
,
removeMeta
);
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
tscFreeQueryInfo
(
pCmd
);
}
...
...
@@ -501,7 +501,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
pSql
->
self
=
0
;
tscFreeSqlResult
(
pSql
);
tscResetSqlCmd
Obj
(
pCmd
);
tscResetSqlCmd
(
pCmd
,
false
);
tfree
(
pCmd
->
tagData
.
data
);
pCmd
->
tagData
.
dataLen
=
0
;
...
...
@@ -515,7 +515,7 @@ void tscFreeSqlObj(SSqlObj* pSql) {
free
(
pSql
);
}
void
tscDestroyDataBlock
(
STableDataBlocks
*
pDataBlock
)
{
void
tscDestroyDataBlock
(
STableDataBlocks
*
pDataBlock
,
bool
removeMeta
)
{
if
(
pDataBlock
==
NULL
)
{
return
;
}
...
...
@@ -528,6 +528,13 @@ void tscDestroyDataBlock(STableDataBlocks* pDataBlock) {
tfree
(
pDataBlock
->
pTableMeta
);
}
if
(
removeMeta
)
{
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tNameExtractFullName
(
&
pDataBlock
->
tableName
,
name
);
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
}
tfree
(
pDataBlock
);
}
...
...
@@ -563,21 +570,21 @@ void* tscDestroyBlockArrayList(SArray* pDataBlockList) {
size_t
size
=
taosArrayGetSize
(
pDataBlockList
);
for
(
int32_t
i
=
0
;
i
<
size
;
i
++
)
{
void
*
d
=
taosArrayGetP
(
pDataBlockList
,
i
);
tscDestroyDataBlock
(
d
);
tscDestroyDataBlock
(
d
,
false
);
}
taosArrayDestroy
(
pDataBlockList
);
return
NULL
;
}
void
*
tscDestroyBlockHashTable
(
SHashObj
*
pBlockHashTable
)
{
void
*
tscDestroyBlockHashTable
(
SHashObj
*
pBlockHashTable
,
bool
removeMeta
)
{
if
(
pBlockHashTable
==
NULL
)
{
return
NULL
;
}
STableDataBlocks
**
p
=
taosHashIterate
(
pBlockHashTable
,
NULL
);
while
(
p
)
{
tscDestroyDataBlock
(
*
p
);
tscDestroyDataBlock
(
*
p
,
removeMeta
);
p
=
taosHashIterate
(
pBlockHashTable
,
p
);
}
...
...
@@ -791,7 +798,7 @@ static void extractTableNameList(SSqlCmd* pCmd, bool freeBlockMap) {
}
if
(
freeBlockMap
)
{
pCmd
->
pTableBlockHashList
=
tscDestroyBlockHashTable
(
pCmd
->
pTableBlockHashList
);
pCmd
->
pTableBlockHashList
=
tscDestroyBlockHashTable
(
pCmd
->
pTableBlockHashList
,
false
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录