Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
795690cd
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看板
提交
795690cd
编写于
1月 17, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-1600]refactor codes.
上级
710d41da
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
26 deletion
+19
-26
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+17
-24
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+1
-1
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
795690cd
...
...
@@ -435,7 +435,7 @@ void waitForQueryRsp(void *param, TAOS_RES *tres, int code);
void
doAsyncQuery
(
STscObj
*
pObj
,
SSqlObj
*
pSql
,
__async_cb_func_t
fp
,
void
*
param
,
const
char
*
sqlstr
,
size_t
sqlLen
);
void
tsc
ProcessMultiVnodesImport
FromFile
(
SSqlObj
*
pSql
);
void
tsc
ImportData
FromFile
(
SSqlObj
*
pSql
);
void
tscInitResObjForLocalQuery
(
SSqlObj
*
pObj
,
int32_t
numOfRes
,
int32_t
rowLen
);
bool
tscIsUpdateQuery
(
SSqlObj
*
pSql
);
bool
tscHasReachLimitation
(
SQueryInfo
*
pQueryInfo
,
SSqlRes
*
pRes
);
...
...
src/client/src/tscParseInsert.c
浏览文件 @
795690cd
...
...
@@ -1406,7 +1406,7 @@ typedef struct SImportFileSupport {
FILE
*
fp
;
}
SImportFileSupport
;
static
void
parseFileSendDataBlock
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
)
{
static
void
parseFileSendDataBlock
(
void
*
param
,
TAOS_RES
*
tres
,
int
32_t
numOfRows
)
{
assert
(
param
!=
NULL
&&
tres
!=
NULL
);
char
*
tokenBuf
=
NULL
;
...
...
@@ -1425,21 +1425,19 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
SSqlObj
*
pParentSql
=
pSupporter
->
pSql
;
fp
=
pSupporter
->
fp
;
if
(
taos_errno
(
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
// handle error
assert
(
taos_errno
(
pSql
)
==
code
);
int32_t
code
=
pSql
->
res
.
code
;
if
(
code
==
TSDB_CODE_TDB_TABLE_RECONFIGURE
)
{
assert
(
pSql
->
res
.
numOfRows
==
0
);
int32_t
ret
=
fseek
(
fp
,
0
,
SEEK_SET
);
if
(
ret
<
0
)
{
tscError
(
"%p failed to seek SEEK_SET since:%s"
,
pSql
,
tstrerror
(
errno
));
pParentSql
->
res
.
code
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_error
;
}
}
else
{
pParentSql
->
res
.
code
=
code
;
// retry parse data from file and import data from the begining again
if
(
code
==
TSDB_CODE_TDB_TABLE_RECONFIGURE
)
{
assert
(
pSql
->
res
.
numOfRows
==
0
);
int32_t
ret
=
fseek
(
fp
,
0
,
SEEK_SET
);
if
(
ret
<
0
)
{
tscError
(
"%p failed to seek SEEK_SET since:%s"
,
pSql
,
tstrerror
(
errno
));
code
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_error
;
}
}
else
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
// accumulate the total submit records
...
...
@@ -1459,7 +1457,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
if
(
pCmd
->
pTableBlockHashList
==
NULL
)
{
pCmd
->
pTableBlockHashList
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
false
);
if
(
pCmd
->
pTableBlockHashList
==
NULL
)
{
pParentSql
->
res
.
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_error
;
}
}
...
...
@@ -1476,7 +1474,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
tscAllocateMemIfNeed
(
pTableDataBlock
,
tinfo
.
rowSize
,
&
maxRows
);
tokenBuf
=
calloc
(
1
,
TSDB_MAX_BYTES_PER_ROW
);
if
(
tokenBuf
==
NULL
)
{
pParentSql
->
res
.
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
code
=
TSDB_CODE_TSC_OUT_OF_MEMORY
;
goto
_error
;
}
...
...
@@ -1509,18 +1507,15 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
tfree
(
line
);
pParentSql
->
res
.
code
=
code
;
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
count
>
0
)
{
code
=
doPackSendDataBlock
(
pSql
,
count
,
pTableDataBlock
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
return
;
}
else
{
pParentSql
->
res
.
code
=
code
;
goto
_error
;
}
}
else
{
pParentSql
->
res
.
code
=
code
;
taos_free_result
(
pSql
);
tfree
(
pSupporter
);
fclose
(
fp
);
...
...
@@ -1528,8 +1523,7 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int code) {
pParentSql
->
fp
=
pParentSql
->
fetchFp
;
// all data has been sent to vnode, call user function
int32_t
v
=
(
pParentSql
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
?
pParentSql
->
res
.
code
:
(
int32_t
)
pParentSql
->
res
.
numOfRows
;
int32_t
v
=
(
code
!=
TSDB_CODE_SUCCESS
)
?
code
:
(
int32_t
)
pParentSql
->
res
.
numOfRows
;
(
*
pParentSql
->
fp
)(
pParentSql
->
param
,
pParentSql
,
v
);
return
;
}
...
...
@@ -1545,7 +1539,7 @@ _error:
tscAsyncResultOnError
(
pParentSql
);
}
void
tsc
ProcessMultiVnodesImport
FromFile
(
SSqlObj
*
pSql
)
{
void
tsc
ImportData
FromFile
(
SSqlObj
*
pSql
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
if
(
pCmd
->
command
!=
TSDB_SQL_INSERT
)
{
return
;
...
...
@@ -1564,12 +1558,11 @@ void tscProcessMultiVnodesImportFromFile(SSqlObj *pSql) {
tfree
(
pSupporter
);
tscAsyncResultOnError
(
pSql
);
return
;
}
pSupporter
->
pSql
=
pSql
;
pSupporter
->
fp
=
fp
;
pSupporter
->
fp
=
fp
;
parseFileSendDataBlock
(
pSupporter
,
pNew
,
0
);
parseFileSendDataBlock
(
pSupporter
,
pNew
,
TSDB_CODE_SUCCESS
);
}
src/client/src/tscUtil.c
浏览文件 @
795690cd
...
...
@@ -2197,7 +2197,7 @@ void tscDoQuery(SSqlObj* pSql) {
}
if
(
pCmd
->
dataSourceType
==
DATA_FROM_DATA_FILE
)
{
tsc
ProcessMultiVnodesImport
FromFile
(
pSql
);
tsc
ImportData
FromFile
(
pSql
);
}
else
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
uint16_t
type
=
pQueryInfo
->
type
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录