Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3e40fa34
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
3e40fa34
编写于
1月 11, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] fix error in fetch data.
上级
52457838
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
76 addition
and
70 deletion
+76
-70
include/libs/planner/planner.h
include/libs/planner/planner.h
+1
-1
include/libs/scheduler/scheduler.h
include/libs/scheduler/scheduler.h
+6
-4
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+4
-2
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+37
-21
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+1
-1
source/libs/planner/src/physicalPlan.c
source/libs/planner/src/physicalPlan.c
+1
-3
source/libs/planner/src/planner.c
source/libs/planner/src/planner.c
+1
-10
source/libs/planner/test/phyPlanTests.cpp
source/libs/planner/test/phyPlanTests.cpp
+1
-1
source/libs/scheduler/inc/schedulerInt.h
source/libs/scheduler/inc/schedulerInt.h
+0
-1
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+24
-26
未找到文件。
include/libs/planner/planner.h
浏览文件 @
3e40fa34
...
...
@@ -150,7 +150,7 @@ struct SQueryNode;
* @param requestId
* @return
*/
int32_t
qCreateQueryDag
(
const
struct
SQueryNode
*
pQueryInfo
,
struct
SQueryDag
**
pDag
,
SSchema
**
pSchema
,
uint32_t
*
numOfResCols
,
uint64_t
requestId
);
int32_t
qCreateQueryDag
(
const
struct
SQueryNode
*
pQueryInfo
,
struct
SQueryDag
**
pDag
,
uint64_t
requestId
);
// Set datasource of this subplan, multiple calls may be made to a subplan.
// @subplan subplan to be schedule
...
...
include/libs/scheduler/scheduler.h
浏览文件 @
3e40fa34
...
...
@@ -20,8 +20,10 @@
extern
"C"
{
#endif
#include "planner.h"
#include "catalog.h"
#include "planner.h"
struct
SSchJob
;
typedef
struct
SSchedulerCfg
{
uint32_t
maxJobNum
;
...
...
@@ -65,7 +67,7 @@ int32_t schedulerInit(SSchedulerCfg *cfg);
* @param nodeList Qnode/Vnode address list, element is SQueryNodeAddr
* @return
*/
int32_t
scheduleExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
void
**
pJob
,
SQueryResult
*
pRes
);
int32_t
scheduleExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
struct
SSchJob
**
pJob
,
SQueryResult
*
pRes
);
/**
* Process the query job, generated according to the query physical plan.
...
...
@@ -73,7 +75,7 @@ int32_t scheduleExecJob(void *transport, SArray *nodeList, SQueryDag* pDag, void
* @param nodeList Qnode/Vnode address list, element is SQueryNodeAddr
* @return
*/
int32_t
scheduleAsyncExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
void
**
pJob
);
int32_t
scheduleAsyncExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
struct
SSchJob
**
pJob
);
/**
* Fetch query result from the remote query executor
...
...
@@ -81,7 +83,7 @@ int32_t scheduleAsyncExecJob(void *transport, SArray *nodeList, SQueryDag* pDag,
* @param data
* @return
*/
int32_t
scheduleFetchRows
(
void
*
pJob
,
void
**
data
);
int32_t
scheduleFetchRows
(
struct
SSchJob
*
pJob
,
void
**
data
);
/**
...
...
source/client/inc/clientInt.h
浏览文件 @
3e40fa34
...
...
@@ -113,6 +113,7 @@ typedef struct SRequestSendRecvBody {
tsem_t
rspSem
;
// not used now
void
*
fp
;
SShowReqInfo
showInfo
;
// todo this attribute will be removed after the query framework being completed.
struct
SSchJob
*
pQueryJob
;
// query job, created according to sql query DAG.
SDataBuf
requestMsg
;
SReqResultInfo
resInfo
;
}
SRequestSendRecvBody
;
...
...
@@ -129,7 +130,7 @@ typedef struct SRequestObj {
char
*
msgBuf
;
void
*
pInfo
;
// sql parse info, generated by parser module
int32_t
code
;
uint64_t
affectedRows
;
uint64_t
affectedRows
;
// todo remove it
SQueryExecMetric
metric
;
SRequestSendRecvBody
body
;
}
SRequestObj
;
...
...
@@ -161,12 +162,13 @@ int taos_options_imp(TSDB_OPTION option, const char *str);
void
*
openTransporter
(
const
char
*
user
,
const
char
*
auth
,
int32_t
numOfThreads
);
void
processMsgFromServer
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
initMsgHandleFp
();
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
);
void
*
doFetchRow
(
SRequestObj
*
pRequest
);
void
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
);
#ifdef __cplusplus
...
...
source/client/src/clientImpl.c
浏览文件 @
3e40fa34
#include "../../libs/scheduler/inc/schedulerInt.h"
#include "clientInt.h"
#include "clientLog.h"
#include "parser.h"
#include "planner.h"
#include "scheduler.h"
#include "tdef.h"
#include "tep.h"
#include "tglobal.h"
...
...
@@ -8,9 +12,6 @@
#include "tnote.h"
#include "tpagedfile.h"
#include "tref.h"
#include "parser.h"
#include "planner.h"
#include "scheduler.h"
#define CHECK_CODE_GOTO(expr, lable) \
do { \
...
...
@@ -57,6 +58,7 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i
}
static
STscObj
*
taosConnectImpl
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
,
__taos_async_fn_t
fp
,
void
*
param
,
SAppInstInfo
*
pAppInfo
);
static
void
setResSchemaInfo
(
SReqResultInfo
*
pResInfo
,
const
SDataBlockSchema
*
pDataBlockSchema
);
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
)
{
if
(
taos_init
()
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -198,36 +200,48 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) {
int32_t
getPlan
(
SRequestObj
*
pRequest
,
SQueryNode
*
pQueryNode
,
SQueryDag
**
pDag
)
{
pRequest
->
type
=
pQueryNode
->
type
;
SSchema
*
pSchema
=
NULL
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
int32_t
code
=
qCreateQueryDag
(
pQueryNode
,
pDag
,
&
pSchema
,
&
pResInfo
->
numOfCols
,
pRequest
->
requestId
);
int32_t
code
=
qCreateQueryDag
(
pQueryNode
,
pDag
,
pRequest
->
requestId
);
if
(
code
!=
0
)
{
return
code
;
}
if
(
pQueryNode
->
type
==
TSDB_SQL_SELECT
)
{
pResInfo
->
fields
=
calloc
(
1
,
sizeof
(
TAOS_FIELD
)
);
for
(
int32_t
i
=
0
;
i
<
pResInfo
->
numOfCols
;
++
i
)
{
pResInfo
->
fields
[
i
].
bytes
=
pSchema
[
i
].
bytes
;
pResInfo
->
fields
[
i
].
type
=
pSchema
[
i
].
type
;
tstrncpy
(
pResInfo
->
fields
[
i
].
name
,
pSchema
[
i
].
name
,
tListLen
(
pResInfo
->
fields
[
i
].
name
)
);
}
SArray
*
pa
=
taosArrayGetP
((
*
pDag
)
->
pSubplans
,
0
);
SSubplan
*
pPlan
=
taosArrayGetP
(
pa
,
0
)
;
SDataBlockSchema
*
pDataBlockSchema
=
&
(
pPlan
->
pDataSink
->
schema
)
;
setResSchemaInfo
(
pResInfo
,
pDataBlockSchema
);
pRequest
->
type
=
TDMT_VND_QUERY
;
}
return
code
;
}
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryDag
*
pDag
,
void
**
pJob
)
{
void
setResSchemaInfo
(
SReqResultInfo
*
pResInfo
,
const
SDataBlockSchema
*
pDataBlockSchema
)
{
assert
(
pDataBlockSchema
!=
NULL
&&
pDataBlockSchema
->
numOfCols
>
0
);
pResInfo
->
numOfCols
=
pDataBlockSchema
->
numOfCols
;
pResInfo
->
fields
=
calloc
(
pDataBlockSchema
->
numOfCols
,
sizeof
(
pDataBlockSchema
->
pSchema
[
0
]));
for
(
int32_t
i
=
0
;
i
<
pResInfo
->
numOfCols
;
++
i
)
{
SSchema
*
pSchema
=
&
pDataBlockSchema
->
pSchema
[
i
];
pResInfo
->
fields
[
i
].
bytes
=
pSchema
->
bytes
;
pResInfo
->
fields
[
i
].
type
=
pSchema
->
type
;
tstrncpy
(
pResInfo
->
fields
[
i
].
name
,
pSchema
[
i
].
name
,
tListLen
(
pResInfo
->
fields
[
i
].
name
));
}
}
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryDag
*
pDag
)
{
if
(
TSDB_SQL_INSERT
==
pRequest
->
type
||
TSDB_SQL_CREATE_TABLE
==
pRequest
->
type
)
{
SQueryResult
res
=
{.
code
=
0
,
.
numOfRows
=
0
,
.
msgSize
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
msg
=
pRequest
->
msgBuf
};
int32_t
code
=
scheduleExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
,
pDag
,
p
Job
,
&
res
);
int32_t
code
=
scheduleExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
,
pDag
,
&
pRequest
->
body
.
pQuery
Job
,
&
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// handle error and retry
}
else
{
if
(
*
p
Job
!=
NULL
)
{
scheduleFreeJob
(
*
p
Job
);
if
(
pRequest
->
body
.
pQuery
Job
!=
NULL
)
{
scheduleFreeJob
(
pRequest
->
body
.
pQuery
Job
);
}
}
...
...
@@ -235,7 +249,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, void** pJob) {
return
res
.
code
;
}
return
scheduleAsyncExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
/*todo appInfo.xxx*/
,
pDag
,
p
Job
);
return
scheduleAsyncExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
,
pDag
,
&
pRequest
->
body
.
pQuery
Job
);
}
TAOS_RES
*
tmq_create_topic
(
TAOS
*
taos
,
const
char
*
name
,
const
char
*
sql
,
int
sqlLen
)
{
...
...
@@ -312,7 +326,6 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
SRequestObj
*
pRequest
=
NULL
;
SQueryNode
*
pQuery
=
NULL
;
SQueryDag
*
pDag
=
NULL
;
void
*
pJob
=
NULL
;
terrno
=
TSDB_CODE_SUCCESS
;
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
...
...
@@ -322,9 +335,8 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
CHECK_CODE_GOTO
(
execDdlQuery
(
pRequest
,
pQuery
),
_return
);
}
else
{
CHECK_CODE_GOTO
(
getPlan
(
pRequest
,
pQuery
,
&
pDag
),
_return
);
CHECK_CODE_GOTO
(
scheduleQuery
(
pRequest
,
pDag
,
&
pJob
),
_return
);
CHECK_CODE_GOTO
(
scheduleQuery
(
pRequest
,
pDag
),
_return
);
pRequest
->
code
=
terrno
;
return
pRequest
;
}
_return:
...
...
@@ -333,6 +345,7 @@ _return:
if
(
NULL
!=
pRequest
&&
TSDB_CODE_SUCCESS
!=
terrno
)
{
pRequest
->
code
=
terrno
;
}
return
pRequest
;
}
...
...
@@ -531,7 +544,10 @@ void* doFetchRow(SRequestObj* pRequest) {
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
if
(
pResultInfo
->
pData
==
NULL
||
pResultInfo
->
current
>=
pResultInfo
->
numOfRows
)
{
if
(
pRequest
->
type
==
TDMT_MND_SHOW
)
{
if
(
pRequest
->
type
==
TDMT_VND_QUERY
)
{
pRequest
->
type
=
TDMT_VND_FETCH
;
scheduleFetchRows
(
pRequest
->
body
.
pQueryJob
,
&
pRequest
->
body
.
resInfo
.
pData
);
}
else
if
(
pRequest
->
type
==
TDMT_MND_SHOW
)
{
pRequest
->
type
=
TDMT_MND_SHOW_RETRIEVE
;
}
else
if
(
pRequest
->
type
==
TDMT_VND_SHOW_TABLES
)
{
pRequest
->
type
=
TDMT_VND_SHOW_TABLES_FETCH
;
...
...
source/client/test/clientTests.cpp
浏览文件 @
3e40fa34
...
...
@@ -568,7 +568,7 @@ TEST(testCase, projection_query_tables) {
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
// pRes = taos_query(pConn, "create table m1 (ts timestamp, k int) tags(a int)");
//
taos_free_result(pRes);
taos_free_result
(
pRes
);
//
// pRes = taos_query(pConn, "create table tu using m1 tags(1)");
// taos_free_result(pRes);
...
...
source/libs/planner/src/physicalPlan.c
浏览文件 @
3e40fa34
...
...
@@ -89,7 +89,7 @@ static bool copySchema(SDataBlockSchema* dst, const SDataBlockSchema* src) {
static
bool
toDataBlockSchema
(
SQueryPlanNode
*
pPlanNode
,
SDataBlockSchema
*
dataBlockSchema
)
{
dataBlockSchema
->
numOfCols
=
pPlanNode
->
numOfExpr
;
dataBlockSchema
->
pSchema
=
malloc
(
sizeof
(
SSlotSchema
)
*
pPlanNode
->
numOf
Cols
);
dataBlockSchema
->
pSchema
=
malloc
(
sizeof
(
SSlotSchema
)
*
pPlanNode
->
numOf
Expr
);
if
(
NULL
==
dataBlockSchema
->
pSchema
)
{
return
false
;
}
...
...
@@ -306,8 +306,6 @@ static SPhyNode* createPhyNode(SPlanContext* pCxt, SQueryPlanNode* pPlanNode) {
case
QNODE_TABLESCAN
:
node
=
createTableScanNode
(
pCxt
,
pPlanNode
);
break
;
case
QNODE_PROJECT
:
// node = create
case
QNODE_MODIFY
:
// Insert is not an operator in a physical plan.
break
;
...
...
source/libs/planner/src/planner.c
浏览文件 @
3e40fa34
...
...
@@ -56,7 +56,7 @@ void qDestroyQueryDag(struct SQueryDag* pDag) {
tfree
(
pDag
);
}
int32_t
qCreateQueryDag
(
const
struct
SQueryNode
*
pNode
,
struct
SQueryDag
**
pDag
,
SSchema
**
pSchema
,
uint32_t
*
numOfResCols
,
uint64_t
requestId
)
{
int32_t
qCreateQueryDag
(
const
struct
SQueryNode
*
pNode
,
struct
SQueryDag
**
pDag
,
uint64_t
requestId
)
{
SQueryPlanNode
*
pLogicPlan
;
int32_t
code
=
createQueryPlan
(
pNode
,
&
pLogicPlan
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
...
...
@@ -70,15 +70,6 @@ int32_t qCreateQueryDag(const struct SQueryNode* pNode, struct SQueryDag** pDag,
printf
(
"%s
\n
"
,
str
);
}
int32_t
numOfOutput
=
pLogicPlan
->
numOfExpr
;
*
pSchema
=
calloc
(
numOfOutput
,
sizeof
(
SSchema
));
*
numOfResCols
=
numOfOutput
;
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SExprInfo
*
pExprInfo
=
taosArrayGetP
(
pLogicPlan
->
pExpr
,
i
);
memcpy
(
&
(
*
pSchema
)[
i
],
pExprInfo
->
pExpr
->
pSchema
,
sizeof
(
SSchema
));
}
code
=
optimizeQueryPlan
(
pLogicPlan
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
destroyQueryPlan
(
pLogicPlan
);
...
...
source/libs/planner/test/phyPlanTests.cpp
浏览文件 @
3e40fa34
...
...
@@ -65,7 +65,7 @@ protected:
SSchema
*
schema
=
NULL
;
uint32_t
numOfOutput
=
0
;
code
=
qCreateQueryDag
(
query
,
&
dag
,
&
schema
,
&
numOfOutput
,
requestId
);
code
=
qCreateQueryDag
(
query
,
&
dag
,
requestId
);
dag_
.
reset
(
dag
);
return
code
;
}
...
...
source/libs/scheduler/inc/schedulerInt.h
浏览文件 @
3e40fa34
...
...
@@ -58,7 +58,6 @@ typedef struct SSchLevel {
SArray
*
subTasks
;
// Element is SQueryTask
}
SSchLevel
;
typedef
struct
SSchTask
{
uint64_t
taskId
;
// task id
SSchLevel
*
level
;
// level
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
3e40fa34
...
...
@@ -606,8 +606,8 @@ int32_t schProcessRspMsg(SSchJob *job, SSchTask *task, int32_t msgType, char *ms
case
TDMT_VND_QUERY_RSP
:
{
SQueryTableRsp
*
rsp
=
(
SQueryTableRsp
*
)
msg
;
if
(
rsp
->
code
!=
TSDB_CODE_SUCCESS
||
NULL
==
msg
)
{
SCH_ERR_JRET
(
schProcessOnTaskFailure
(
job
,
task
,
rsp
->
c
ode
));
if
(
rsp
Code
!=
TSDB_CODE_SUCCESS
||
rsp
->
code
!=
TSDB_CODE_SUCCESS
||
NULL
==
msg
)
{
SCH_ERR_JRET
(
schProcessOnTaskFailure
(
job
,
task
,
rsp
C
ode
));
}
else
{
code
=
schBuildAndSendMsg
(
job
,
task
,
TDMT_VND_RES_READY
);
if
(
code
)
{
...
...
@@ -986,7 +986,7 @@ void schDropJobAllTasks(SSchJob *job) {
}
}
int32_t
schExecJobImpl
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
void
**
job
,
bool
syncSchedule
)
{
int32_t
schExecJobImpl
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
struct
SSchJob
**
job
,
bool
syncSchedule
)
{
if
(
nodeList
&&
taosArrayGetSize
(
nodeList
)
<=
0
)
{
qInfo
(
"QID:%"
PRIx64
" input nodeList is empty"
,
pDag
->
queryId
);
}
...
...
@@ -1092,7 +1092,7 @@ int32_t schedulerInit(SSchedulerCfg *cfg) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
scheduleExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
void
**
pJob
,
SQueryResult
*
pRes
)
{
int32_t
scheduleExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
struct
SSchJob
**
pJob
,
SQueryResult
*
pRes
)
{
if
(
NULL
==
transport
||
NULL
==
pDag
||
NULL
==
pDag
->
pSubplans
||
NULL
==
pJob
||
NULL
==
pRes
)
{
SCH_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
...
...
@@ -1107,7 +1107,7 @@ int32_t scheduleExecJob(void *transport, SArray *nodeList, SQueryDag* pDag, void
return
TSDB_CODE_SUCCESS
;
}
int32_t
scheduleAsyncExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
void
**
pJob
)
{
int32_t
scheduleAsyncExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
struct
SSchJob
**
pJob
)
{
if
(
NULL
==
transport
||
NULL
==
pDag
||
NULL
==
pDag
->
pSubplans
||
NULL
==
pJob
)
{
SCH_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
...
...
@@ -1116,53 +1116,51 @@ int32_t scheduleAsyncExecJob(void *transport, SArray *nodeList, SQueryDag* pDag,
}
int32_t
scheduleFetchRows
(
void
*
pJob
,
void
**
d
ata
)
{
if
(
NULL
==
pJob
||
NULL
==
d
ata
)
{
int32_t
scheduleFetchRows
(
SSchJob
*
pJob
,
void
**
pD
ata
)
{
if
(
NULL
==
pJob
||
NULL
==
pD
ata
)
{
SCH_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
SSchJob
*
job
=
pJob
;
int32_t
code
=
0
;
if
(
!
SCH_JOB_NEED_FETCH
(
&
job
->
attr
))
{
if
(
!
SCH_JOB_NEED_FETCH
(
&
pJob
->
attr
))
{
qError
(
"no need to fetch data"
);
SCH_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
if
(
j
ob
->
status
==
JOB_TASK_STATUS_FAILED
)
{
j
ob
->
res
=
NULL
;
SCH_RET
(
atomic_load_32
(
&
j
ob
->
errCode
));
if
(
pJ
ob
->
status
==
JOB_TASK_STATUS_FAILED
)
{
pJ
ob
->
res
=
NULL
;
SCH_RET
(
atomic_load_32
(
&
pJ
ob
->
errCode
));
}
if
(
j
ob
->
status
==
JOB_TASK_STATUS_SUCCEED
)
{
j
ob
->
res
=
NULL
;
if
(
pJ
ob
->
status
==
JOB_TASK_STATUS_SUCCEED
)
{
pJ
ob
->
res
=
NULL
;
return
TSDB_CODE_SUCCESS
;
}
if
(
atomic_val_compare_exchange_32
(
&
j
ob
->
userFetch
,
0
,
1
)
!=
0
)
{
if
(
atomic_val_compare_exchange_32
(
&
pJ
ob
->
userFetch
,
0
,
1
)
!=
0
)
{
qError
(
"prior fetching not finished"
);
SCH_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
if
(
j
ob
->
status
==
JOB_TASK_STATUS_PARTIAL_SUCCEED
)
{
SCH_ERR_JRET
(
schFetchFromRemote
(
j
ob
));
if
(
pJ
ob
->
status
==
JOB_TASK_STATUS_PARTIAL_SUCCEED
)
{
SCH_ERR_JRET
(
schFetchFromRemote
(
pJ
ob
));
}
tsem_wait
(
&
j
ob
->
rspSem
);
tsem_wait
(
&
pJ
ob
->
rspSem
);
if
(
j
ob
->
status
==
JOB_TASK_STATUS_FAILED
)
{
code
=
atomic_load_32
(
&
j
ob
->
errCode
);
if
(
pJ
ob
->
status
==
JOB_TASK_STATUS_FAILED
)
{
code
=
atomic_load_32
(
&
pJ
ob
->
errCode
);
}
if
(
job
->
res
&&
((
SRetrieveTableRsp
*
)
j
ob
->
res
)
->
completed
)
{
j
ob
->
status
=
JOB_TASK_STATUS_SUCCEED
;
if
(
pJob
->
res
&&
((
SRetrieveTableRsp
*
)
pJ
ob
->
res
)
->
completed
)
{
pJ
ob
->
status
=
JOB_TASK_STATUS_SUCCEED
;
}
*
data
=
j
ob
->
res
;
j
ob
->
res
=
NULL
;
*
pData
=
pJ
ob
->
res
;
pJ
ob
->
res
=
NULL
;
_return:
atomic_val_compare_exchange_32
(
&
j
ob
->
userFetch
,
1
,
0
);
atomic_val_compare_exchange_32
(
&
pJ
ob
->
userFetch
,
1
,
0
);
SCH_RET
(
code
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录