Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8303603a
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看板
提交
8303603a
编写于
2月 05, 2021
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/taosdata/TDengine
into develop
上级
9dd7afa8
33db41f4
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
54 addition
and
12 deletion
+54
-12
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+12
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+37
-8
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+4
-2
未找到文件。
src/client/src/tscAsync.c
浏览文件 @
8303603a
...
@@ -273,7 +273,8 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
...
@@ -273,7 +273,8 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
taosScheduleTask
(
tscQhandle
,
&
schedMsg
);
taosScheduleTask
(
tscQhandle
,
&
schedMsg
);
}
}
void
tscAsyncResultOnError
(
SSqlObj
*
pSql
)
{
static
void
tscAsyncResultCallback
(
SSchedMsg
*
pMsg
)
{
SSqlObj
*
pSql
=
pMsg
->
ahandle
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
tscDebug
(
"%p SqlObj is freed, not add into queue async res"
,
pSql
);
tscDebug
(
"%p SqlObj is freed, not add into queue async res"
,
pSql
);
return
;
return
;
...
@@ -291,6 +292,16 @@ void tscAsyncResultOnError(SSqlObj *pSql) {
...
@@ -291,6 +292,16 @@ void tscAsyncResultOnError(SSqlObj *pSql) {
(
*
pSql
->
fp
)(
pSql
->
param
,
pSql
,
pRes
->
code
);
(
*
pSql
->
fp
)(
pSql
->
param
,
pSql
,
pRes
->
code
);
}
}
void
tscAsyncResultOnError
(
SSqlObj
*
pSql
)
{
SSchedMsg
schedMsg
=
{
0
};
schedMsg
.
fp
=
tscAsyncResultCallback
;
schedMsg
.
ahandle
=
pSql
;
schedMsg
.
thandle
=
(
void
*
)
1
;
schedMsg
.
msg
=
0
;
taosScheduleTask
(
tscQhandle
,
&
schedMsg
);
}
int
tscSendMsgToServer
(
SSqlObj
*
pSql
);
int
tscSendMsgToServer
(
SSqlObj
*
pSql
);
void
tscTableMetaCallBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
)
{
void
tscTableMetaCallBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
)
{
...
...
src/client/src/tscServer.c
浏览文件 @
8303603a
...
@@ -609,7 +609,7 @@ static int32_t tscEstimateQueryMsgSize(SSqlObj *pSql, int32_t clauseIndex) {
...
@@ -609,7 +609,7 @@ static int32_t tscEstimateQueryMsgSize(SSqlObj *pSql, int32_t clauseIndex) {
}
}
return
MIN_QUERY_MSG_PKT_SIZE
+
minMsgSize
()
+
sizeof
(
SQueryTableMsg
)
+
srcColListSize
+
exprSize
+
tsBufSize
+
return
MIN_QUERY_MSG_PKT_SIZE
+
minMsgSize
()
+
sizeof
(
SQueryTableMsg
)
+
srcColListSize
+
exprSize
+
tsBufSize
+
tableSerialize
+
sqlLen
+
4096
;
tableSerialize
+
sqlLen
+
4096
+
pQueryInfo
->
bufLen
;
}
}
static
char
*
doSerializeTableInfo
(
SQueryTableMsg
*
pQueryMsg
,
SSqlObj
*
pSql
,
char
*
pMsg
)
{
static
char
*
doSerializeTableInfo
(
SQueryTableMsg
*
pQueryMsg
,
SSqlObj
*
pSql
,
char
*
pMsg
)
{
...
...
src/client/src/tscSubquery.c
浏览文件 @
8303603a
...
@@ -95,11 +95,21 @@ static bool subAndCheckDone(SSqlObj *pSql, SSqlObj *pParentSql, int idx) {
...
@@ -95,11 +95,21 @@ static bool subAndCheckDone(SSqlObj *pSql, SSqlObj *pParentSql, int idx) {
pthread_mutex_lock
(
&
subState
->
mutex
);
pthread_mutex_lock
(
&
subState
->
mutex
);
bool
done
=
allSubqueryDone
(
pParentSql
);
if
(
done
)
{
tscDebug
(
"%p subquery:%p,%d all subs already done"
,
pParentSql
,
pSql
,
idx
);
pthread_mutex_unlock
(
&
subState
->
mutex
);
return
false
;
}
tscDebug
(
"%p subquery:%p,%d state set to 1"
,
pParentSql
,
pSql
,
idx
);
tscDebug
(
"%p subquery:%p,%d state set to 1"
,
pParentSql
,
pSql
,
idx
);
subState
->
states
[
idx
]
=
1
;
subState
->
states
[
idx
]
=
1
;
bool
done
=
allSubqueryDone
(
pParentSql
);
done
=
allSubqueryDone
(
pParentSql
);
pthread_mutex_unlock
(
&
subState
->
mutex
);
pthread_mutex_unlock
(
&
subState
->
mutex
);
...
@@ -2245,7 +2255,9 @@ static void tscAbortFurtherRetryRetrieval(SRetrieveSupport *trsupport, TAOS_RES
...
@@ -2245,7 +2255,9 @@ static void tscAbortFurtherRetryRetrieval(SRetrieveSupport *trsupport, TAOS_RES
* current query failed, and the retry count is less than the available
* current query failed, and the retry count is less than the available
* count, retry query clear previous retrieved data, then launch a new sub query
* count, retry query clear previous retrieved data, then launch a new sub query
*/
*/
static
int32_t
tscReissueSubquery
(
SRetrieveSupport
*
oriTrs
,
SSqlObj
*
pSql
,
int32_t
code
)
{
static
int32_t
tscReissueSubquery
(
SRetrieveSupport
*
oriTrs
,
SSqlObj
*
pSql
,
int32_t
code
,
int32_t
*
sent
)
{
*
sent
=
0
;
SRetrieveSupport
*
trsupport
=
malloc
(
sizeof
(
SRetrieveSupport
));
SRetrieveSupport
*
trsupport
=
malloc
(
sizeof
(
SRetrieveSupport
));
if
(
trsupport
==
NULL
)
{
if
(
trsupport
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
@@ -2277,21 +2289,28 @@ static int32_t tscReissueSubquery(SRetrieveSupport *oriTrs, SSqlObj *pSql, int32
...
@@ -2277,21 +2289,28 @@ static int32_t tscReissueSubquery(SRetrieveSupport *oriTrs, SSqlObj *pSql, int32
SSqlObj
*
pNew
=
tscCreateSTableSubquery
(
trsupport
->
pParentSql
,
trsupport
,
pSql
);
SSqlObj
*
pNew
=
tscCreateSTableSubquery
(
trsupport
->
pParentSql
,
trsupport
,
pSql
);
if
(
pNew
==
NULL
)
{
if
(
pNew
==
NULL
)
{
tscError
(
"%p sub:%p failed to create new subquery due to error:%s, abort retry, vgId:%d, orderOfSub:%d"
,
tscError
(
"%p sub:%p failed to create new subquery due to error:%s, abort retry, vgId:%d, orderOfSub:%d"
,
trsupport
->
pParentSql
,
pSql
,
tstrerror
(
terrno
),
pVgroup
->
vgId
,
trsupport
->
subqueryIndex
);
oriTrs
->
pParentSql
,
pSql
,
tstrerror
(
terrno
),
pVgroup
->
vgId
,
oriTrs
->
subqueryIndex
);
pParentSql
->
res
.
code
=
terrno
;
pParentSql
->
res
.
code
=
terrno
;
trsupport
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
oriTrs
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
tfree
(
trsupport
);
return
pParentSql
->
res
.
code
;
return
pParentSql
->
res
.
code
;
}
}
int32_t
ret
=
tscProcessSql
(
pNew
);
int32_t
ret
=
tscProcessSql
(
pNew
);
*
sent
=
1
;
// if failed to process sql, let following code handle the pSql
// if failed to process sql, let following code handle the pSql
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
tscFreeRetrieveSup
(
pSql
);
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
return
ret
;
return
ret
;
}
else
{
}
else
{
pSql
->
pSubs
[
trsupport
->
subqueryIndex
]
=
pSql
;
tscFreeRetrieveSup
(
pNew
);
taos_free_result
(
pNew
);
return
ret
;
return
ret
;
}
}
}
}
...
@@ -2328,7 +2347,10 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
...
@@ -2328,7 +2347,10 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
subqueryIndex
,
tstrerror
(
pParentSql
->
res
.
code
));
subqueryIndex
,
tstrerror
(
pParentSql
->
res
.
code
));
}
else
{
}
else
{
if
(
trsupport
->
numOfRetry
++
<
MAX_NUM_OF_SUBQUERY_RETRY
&&
pParentSql
->
res
.
code
==
TSDB_CODE_SUCCESS
)
{
if
(
trsupport
->
numOfRetry
++
<
MAX_NUM_OF_SUBQUERY_RETRY
&&
pParentSql
->
res
.
code
==
TSDB_CODE_SUCCESS
)
{
if
(
tscReissueSubquery
(
trsupport
,
pSql
,
numOfRows
)
==
TSDB_CODE_SUCCESS
)
{
int32_t
sent
=
0
;
tscReissueSubquery
(
trsupport
,
pSql
,
numOfRows
,
&
sent
);
if
(
sent
)
{
return
;
return
;
}
}
}
else
{
// reach the maximum retry count, abort
}
else
{
// reach the maximum retry count, abort
...
@@ -2482,7 +2504,10 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
...
@@ -2482,7 +2504,10 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
if
(
trsupport
->
numOfRetry
++
<
MAX_NUM_OF_SUBQUERY_RETRY
)
{
if
(
trsupport
->
numOfRetry
++
<
MAX_NUM_OF_SUBQUERY_RETRY
)
{
tscError
(
"%p sub:%p failed code:%s, retry:%d"
,
pParentSql
,
pSql
,
tstrerror
(
numOfRows
),
trsupport
->
numOfRetry
);
tscError
(
"%p sub:%p failed code:%s, retry:%d"
,
pParentSql
,
pSql
,
tstrerror
(
numOfRows
),
trsupport
->
numOfRetry
);
if
(
tscReissueSubquery
(
trsupport
,
pSql
,
numOfRows
)
==
TSDB_CODE_SUCCESS
)
{
int32_t
sent
=
0
;
tscReissueSubquery
(
trsupport
,
pSql
,
numOfRows
,
&
sent
);
if
(
sent
)
{
return
;
return
;
}
}
}
else
{
}
else
{
...
@@ -2604,7 +2629,11 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
...
@@ -2604,7 +2629,11 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
if
(
trsupport
->
numOfRetry
++
<
MAX_NUM_OF_SUBQUERY_RETRY
)
{
if
(
trsupport
->
numOfRetry
++
<
MAX_NUM_OF_SUBQUERY_RETRY
)
{
tscError
(
"%p sub:%p failed code:%s, retry:%d"
,
pParentSql
,
pSql
,
tstrerror
(
code
),
trsupport
->
numOfRetry
);
tscError
(
"%p sub:%p failed code:%s, retry:%d"
,
pParentSql
,
pSql
,
tstrerror
(
code
),
trsupport
->
numOfRetry
);
if
(
tscReissueSubquery
(
trsupport
,
pSql
,
code
)
==
TSDB_CODE_SUCCESS
)
{
int32_t
sent
=
0
;
tscReissueSubquery
(
trsupport
,
pSql
,
code
,
&
sent
);
if
(
sent
)
{
return
;
return
;
}
}
}
else
{
}
else
{
...
...
src/query/src/qAggMain.c
浏览文件 @
8303603a
...
@@ -1569,7 +1569,9 @@ static void stddev_dst_function(SQLFunctionCtx *pCtx) {
...
@@ -1569,7 +1569,9 @@ static void stddev_dst_function(SQLFunctionCtx *pCtx) {
avg
=
p
->
avg
;
avg
=
p
->
avg
;
}
else
{
// todo opt performance by using iterator since the timestamp lsit is matched with the output result
}
else
{
// todo opt performance by using iterator since the timestamp lsit is matched with the output result
SResPair
*
p
=
bsearch
(
&
pCtx
->
startTs
,
resList
->
pData
,
len
,
sizeof
(
SResPair
),
tsCompare
);
SResPair
*
p
=
bsearch
(
&
pCtx
->
startTs
,
resList
->
pData
,
len
,
sizeof
(
SResPair
),
tsCompare
);
assert
(
p
!=
NULL
);
if
(
p
==
NULL
)
{
return
;
}
avg
=
p
->
avg
;
avg
=
p
->
avg
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录