Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e05a8fc8
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e05a8fc8
编写于
12月 08, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225] refactor codes.
上级
40016c5e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
25 addition
and
22 deletion
+25
-22
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+7
-4
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+6
-6
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+1
-1
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-3
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+7
-7
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
e05a8fc8
...
@@ -110,11 +110,12 @@ SParamInfo* tscAddParamToDataBlock(STableDataBlocks* pDataBlock, char type, uint
...
@@ -110,11 +110,12 @@ SParamInfo* tscAddParamToDataBlock(STableDataBlocks* pDataBlock, char type, uint
uint32_t
offset
);
uint32_t
offset
);
void
*
tscDestroyBlockArrayList
(
SArray
*
pDataBlockList
);
void
*
tscDestroyBlockArrayList
(
SArray
*
pDataBlockList
);
void
*
tscDestroyBlockHashTable
(
SHashObj
*
pBlockHashTable
);
int32_t
tscCopyDataBlockToPayload
(
SSqlObj
*
pSql
,
STableDataBlocks
*
pDataBlock
);
int32_t
tscCopyDataBlockToPayload
(
SSqlObj
*
pSql
,
STableDataBlocks
*
pDataBlock
);
int32_t
tscMergeTableDataBlocks
(
SSqlObj
*
pSql
,
SArray
*
pDataList
);
int32_t
tscMergeTableDataBlocks
(
SSqlObj
*
pSql
);
int32_t
tscGetDataBlockFromList
(
void
*
pHashList
,
SArray
*
pDataBlockList
,
int64_t
id
,
int32_t
size
,
int32_t
tscGetDataBlockFromList
(
SHashObj
*
pHashList
,
int64_t
id
,
int32_t
size
,
int32_t
startOffset
,
int32_t
rowSize
,
const
char
*
tableId
,
STableMeta
*
pTableMeta
,
int32_t
startOffset
,
int32_t
rowSize
,
const
char
*
tableId
,
STableMeta
*
pTableMeta
,
STableDataBlocks
**
dataBlocks
,
SArray
*
pBlockList
);
STableDataBlocks
**
dataBlocks
);
/**
/**
* for the projection query on metric or point interpolation query on metric,
* for the projection query on metric or point interpolation query on metric,
...
@@ -275,6 +276,8 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex);
...
@@ -275,6 +276,8 @@ void tscPrintSelectClause(SSqlObj* pSql, int32_t subClauseIndex);
bool
hasMoreVnodesToTry
(
SSqlObj
*
pSql
);
bool
hasMoreVnodesToTry
(
SSqlObj
*
pSql
);
bool
hasMoreClauseToTry
(
SSqlObj
*
pSql
);
bool
hasMoreClauseToTry
(
SSqlObj
*
pSql
);
void
tscFreeQueryInfo
(
SSqlCmd
*
pCmd
,
bool
removeFromCache
);
void
tscTryQueryNextVnode
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
);
void
tscTryQueryNextVnode
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
);
void
tscAsyncQuerySingleRowForNextVnode
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
void
tscAsyncQuerySingleRowForNextVnode
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
);
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
);
...
...
src/client/inc/tsclient.h
浏览文件 @
e05a8fc8
...
@@ -251,7 +251,7 @@ typedef struct {
...
@@ -251,7 +251,7 @@ typedef struct {
STableMeta
**
pTableMetaList
;
// all involved tableMeta list of current insert sql statement.
STableMeta
**
pTableMetaList
;
// all involved tableMeta list of current insert sql statement.
int32_t
numOfTables
;
int32_t
numOfTables
;
SHashObj
*
pTableList
;
// data block for each table
SHashObj
*
pTable
BlockHash
List
;
// data block for each table
SArray
*
pDataBlocks
;
// SArray<STableDataBlocks*>. Merged submit block for each vgroup
SArray
*
pDataBlocks
;
// SArray<STableDataBlocks*>. Merged submit block for each vgroup
}
SSqlCmd
;
}
SSqlCmd
;
...
...
src/client/src/tscParseInsert.c
浏览文件 @
e05a8fc8
...
@@ -692,7 +692,7 @@ static int32_t doParseInsertStatement(SSqlCmd* pCmd, char **str, SParsedDataColI
...
@@ -692,7 +692,7 @@ static int32_t doParseInsertStatement(SSqlCmd* pCmd, char **str, SParsedDataColI
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMeta
);
STableComInfo
tinfo
=
tscGetTableInfo
(
pTableMeta
);
STableDataBlocks
*
dataBuf
=
NULL
;
STableDataBlocks
*
dataBuf
=
NULL
;
int32_t
ret
=
tscGetDataBlockFromList
(
pCmd
->
pTableList
,
pTableMeta
->
id
.
uid
,
TSDB_DEFAULT_PAYLOAD_SIZE
,
int32_t
ret
=
tscGetDataBlockFromList
(
pCmd
->
pTable
BlockHash
List
,
pTableMeta
->
id
.
uid
,
TSDB_DEFAULT_PAYLOAD_SIZE
,
sizeof
(
SSubmitBlk
),
tinfo
.
rowSize
,
pTableMetaInfo
->
name
,
pTableMeta
,
&
dataBuf
,
NULL
);
sizeof
(
SSubmitBlk
),
tinfo
.
rowSize
,
pTableMetaInfo
->
name
,
pTableMeta
,
&
dataBuf
,
NULL
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
return
ret
;
return
ret
;
...
@@ -1055,9 +1055,9 @@ int tsParseInsertSql(SSqlObj *pSql) {
...
@@ -1055,9 +1055,9 @@ int tsParseInsertSql(SSqlObj *pSql) {
return
code
;
return
code
;
}
}
if
(
NULL
==
pCmd
->
pTableList
)
{
if
(
NULL
==
pCmd
->
pTable
BlockHash
List
)
{
pCmd
->
pTableList
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
false
);
pCmd
->
pTable
BlockHash
List
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
false
);
if
(
NULL
==
pCmd
->
pTableList
)
{
if
(
NULL
==
pCmd
->
pTable
BlockHash
List
)
{
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_clean
;
goto
_clean
;
}
}
...
@@ -1065,7 +1065,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
...
@@ -1065,7 +1065,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
str
=
pCmd
->
curSql
;
str
=
pCmd
->
curSql
;
}
}
tscDebug
(
"%p create data block list hashList:%p"
,
pSql
,
pCmd
->
pTableList
);
tscDebug
(
"%p create data block list hashList:%p"
,
pSql
,
pCmd
->
pTable
BlockHash
List
);
while
(
1
)
{
while
(
1
)
{
int32_t
index
=
0
;
int32_t
index
=
0
;
...
@@ -1270,7 +1270,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
...
@@ -1270,7 +1270,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
goto
_clean
;
goto
_clean
;
}
}
if
(
taosHashGetSize
(
pCmd
->
pTableList
)
>
0
)
{
// merge according to vgId
if
(
taosHashGetSize
(
pCmd
->
pTable
BlockHash
List
)
>
0
)
{
// merge according to vgId
if
((
code
=
tscMergeTableDataBlocks
(
pSql
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
tscMergeTableDataBlocks
(
pSql
))
!=
TSDB_CODE_SUCCESS
)
{
goto
_clean
;
goto
_clean
;
}
}
...
...
src/client/src/tscPrepare.c
浏览文件 @
e05a8fc8
...
@@ -800,7 +800,7 @@ static int insertStmtExecute(STscStmt* stmt) {
...
@@ -800,7 +800,7 @@ static int insertStmtExecute(STscStmt* stmt) {
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
assert
(
pCmd
->
numOfClause
==
1
);
assert
(
pCmd
->
numOfClause
==
1
);
if
(
taosHashGetSize
(
pCmd
->
pTableList
)
>
0
)
{
if
(
taosHashGetSize
(
pCmd
->
pTable
BlockHash
List
)
>
0
)
{
// merge according to vgid
// merge according to vgid
int
code
=
tscMergeTableDataBlocks
(
stmt
->
pSql
);
int
code
=
tscMergeTableDataBlocks
(
stmt
->
pSql
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscSql.c
浏览文件 @
e05a8fc8
...
@@ -900,9 +900,9 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
...
@@ -900,9 +900,9 @@ int taos_validate_sql(TAOS *taos, const char *sql) {
strtolower
(
pSql
->
sqlstr
,
sql
);
strtolower
(
pSql
->
sqlstr
,
sql
);
pCmd
->
curSql
=
NULL
;
pCmd
->
curSql
=
NULL
;
if
(
NULL
!=
pCmd
->
pTableList
)
{
if
(
NULL
!=
pCmd
->
pTable
BlockHash
List
)
{
taosHashCleanup
(
pCmd
->
pTableList
);
taosHashCleanup
(
pCmd
->
pTable
BlockHash
List
);
pCmd
->
pTableList
=
NULL
;
pCmd
->
pTable
BlockHash
List
=
NULL
;
}
}
pSql
->
fp
=
asyncCallback
;
pSql
->
fp
=
asyncCallback
;
...
...
src/client/src/tscUtil.c
浏览文件 @
e05a8fc8
...
@@ -409,7 +409,7 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd, bool removeFromCache) {
...
@@ -409,7 +409,7 @@ void tscResetSqlCmdObj(SSqlCmd* pCmd, bool removeFromCache) {
tfree
(
pCmd
->
pTableMetaList
);
tfree
(
pCmd
->
pTableMetaList
);
pCmd
->
pTable
List
=
tscDestroyBlockHashTable
(
pCmd
->
pTable
List
);
pCmd
->
pTable
BlockHashList
=
tscDestroyBlockHashTable
(
pCmd
->
pTableBlockHash
List
);
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
pCmd
->
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
pDataBlocks
);
tscFreeQueryInfo
(
pCmd
,
removeFromCache
);
tscFreeQueryInfo
(
pCmd
,
removeFromCache
);
}
}
...
@@ -788,18 +788,18 @@ static int32_t getRowExpandSize(STableMeta* pTableMeta) {
...
@@ -788,18 +788,18 @@ static int32_t getRowExpandSize(STableMeta* pTableMeta) {
}
}
static
void
extractTableMeta
(
SSqlCmd
*
pCmd
)
{
static
void
extractTableMeta
(
SSqlCmd
*
pCmd
)
{
pCmd
->
numOfTables
=
taosHashGetSize
(
pCmd
->
pTableList
);
pCmd
->
numOfTables
=
taosHashGetSize
(
pCmd
->
pTable
BlockHash
List
);
pCmd
->
pTableMetaList
=
calloc
(
pCmd
->
numOfTables
,
POINTER_BYTES
);
pCmd
->
pTableMetaList
=
calloc
(
pCmd
->
numOfTables
,
POINTER_BYTES
);
STableDataBlocks
**
p1
=
taosHashIterate
(
pCmd
->
pTableList
,
NULL
);
STableDataBlocks
**
p1
=
taosHashIterate
(
pCmd
->
pTable
BlockHash
List
,
NULL
);
int32_t
i
=
0
;
int32_t
i
=
0
;
while
(
p1
)
{
while
(
p1
)
{
STableDataBlocks
*
pBlocks
=
*
p1
;
STableDataBlocks
*
pBlocks
=
*
p1
;
pCmd
->
pTableMetaList
[
i
++
]
=
taosCacheTransfer
(
tscMetaCache
,
(
void
**
)
&
pBlocks
->
pTableMeta
);
pCmd
->
pTableMetaList
[
i
++
]
=
taosCacheTransfer
(
tscMetaCache
,
(
void
**
)
&
pBlocks
->
pTableMeta
);
p1
=
taosHashIterate
(
pCmd
->
pTableList
,
p1
);
p1
=
taosHashIterate
(
pCmd
->
pTable
BlockHash
List
,
p1
);
}
}
pCmd
->
pTable
List
=
tscDestroyBlockHashTable
(
pCmd
->
pTable
List
);
pCmd
->
pTable
BlockHashList
=
tscDestroyBlockHashTable
(
pCmd
->
pTableBlockHash
List
);
}
}
int32_t
tscMergeTableDataBlocks
(
SSqlObj
*
pSql
)
{
int32_t
tscMergeTableDataBlocks
(
SSqlObj
*
pSql
)
{
...
@@ -808,7 +808,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
...
@@ -808,7 +808,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
void
*
pVnodeDataBlockHashList
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
false
);
void
*
pVnodeDataBlockHashList
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
false
);
SArray
*
pVnodeDataBlockList
=
taosArrayInit
(
8
,
POINTER_BYTES
);
SArray
*
pVnodeDataBlockList
=
taosArrayInit
(
8
,
POINTER_BYTES
);
STableDataBlocks
**
p
=
taosHashIterate
(
pCmd
->
pTableList
,
NULL
);
STableDataBlocks
**
p
=
taosHashIterate
(
pCmd
->
pTable
BlockHash
List
,
NULL
);
STableDataBlocks
*
pOneTableBlock
=
*
p
;
STableDataBlocks
*
pOneTableBlock
=
*
p
;
while
(
pOneTableBlock
)
{
while
(
pOneTableBlock
)
{
...
@@ -873,7 +873,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
...
@@ -873,7 +873,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
pBlocks
->
dataLen
=
htonl
(
finalLen
);
pBlocks
->
dataLen
=
htonl
(
finalLen
);
dataBuf
->
numOfTables
+=
1
;
dataBuf
->
numOfTables
+=
1
;
p
=
taosHashIterate
(
pCmd
->
pTableList
,
p
);
p
=
taosHashIterate
(
pCmd
->
pTable
BlockHash
List
,
p
);
if
(
p
==
NULL
)
{
if
(
p
==
NULL
)
{
break
;
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录