Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
74be3572
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看板
提交
74be3572
编写于
10月 14, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: add query response policy
上级
b7e897ab
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
41 addition
and
24 deletion
+41
-24
include/common/tglobal.h
include/common/tglobal.h
+1
-0
include/libs/qcom/query.h
include/libs/qcom/query.h
+3
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+3
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+2
-0
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+32
-24
未找到文件。
include/common/tglobal.h
浏览文件 @
74be3572
...
@@ -93,6 +93,7 @@ extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in
...
@@ -93,6 +93,7 @@ extern int64_t tsQueryBufferSizeBytes; // maximum allowed usage buffer size in
// query client
// query client
extern
int32_t
tsQueryPolicy
;
extern
int32_t
tsQueryPolicy
;
extern
int32_t
tsQueryRspPolicy
;
extern
int32_t
tsQuerySmaOptimize
;
extern
int32_t
tsQuerySmaOptimize
;
extern
int32_t
tsQueryRsmaTolerance
;
extern
int32_t
tsQueryRsmaTolerance
;
extern
bool
tsQueryPlannerTrace
;
extern
bool
tsQueryPlannerTrace
;
...
...
include/libs/qcom/query.h
浏览文件 @
74be3572
...
@@ -54,6 +54,9 @@ typedef enum {
...
@@ -54,6 +54,9 @@ typedef enum {
#define QUERY_POLICY_QNODE 3
#define QUERY_POLICY_QNODE 3
#define QUERY_POLICY_CLIENT 4
#define QUERY_POLICY_CLIENT 4
#define QUERY_RSP_POLICY_DELAY 0
#define QUERY_RSP_POLICY_QUICK 1
typedef
struct
STableComInfo
{
typedef
struct
STableComInfo
{
uint8_t
numOfTags
;
// the number of tags in schema
uint8_t
numOfTags
;
// the number of tags in schema
uint8_t
precision
;
// the number of precision
uint8_t
precision
;
// the number of precision
...
...
source/common/src/tglobal.c
浏览文件 @
74be3572
...
@@ -89,6 +89,7 @@ bool tsSmlDataFormat = false; // true means that the name and order of cols in
...
@@ -89,6 +89,7 @@ bool tsSmlDataFormat = false; // true means that the name and order of cols in
// query
// query
int32_t
tsQueryPolicy
=
1
;
int32_t
tsQueryPolicy
=
1
;
int32_t
tsQueryRspPolicy
=
0
;
int32_t
tsQuerySmaOptimize
=
0
;
int32_t
tsQuerySmaOptimize
=
0
;
int32_t
tsQueryRsmaTolerance
=
1000
;
// the tolerance time (ms) to judge from which level to query rsma data.
int32_t
tsQueryRsmaTolerance
=
1000
;
// the tolerance time (ms) to judge from which level to query rsma data.
bool
tsQueryPlannerTrace
=
false
;
bool
tsQueryPlannerTrace
=
false
;
...
@@ -345,6 +346,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
...
@@ -345,6 +346,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"countAlwaysReturnValue"
,
tsCountAlwaysReturnValue
,
0
,
1
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"countAlwaysReturnValue"
,
tsCountAlwaysReturnValue
,
0
,
1
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"queryBufferSize"
,
tsQueryBufferSize
,
-
1
,
500000000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"queryBufferSize"
,
tsQueryBufferSize
,
-
1
,
500000000000
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"printAuth"
,
tsPrintAuth
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"printAuth"
,
tsPrintAuth
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"queryRspPolicy"
,
tsQueryRspPolicy
,
0
,
1
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"multiProcess"
,
tsMultiProcess
,
0
,
2
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"multiProcess"
,
tsMultiProcess
,
0
,
2
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"mnodeShmSize"
,
tsMnodeShmSize
,
TSDB_MAX_MSG_SIZE
*
2
+
1024
,
INT32_MAX
,
0
)
!=
0
)
return
-
1
;
if
(
cfgAddInt32
(
pCfg
,
"mnodeShmSize"
,
tsMnodeShmSize
,
TSDB_MAX_MSG_SIZE
*
2
+
1024
,
INT32_MAX
,
0
)
!=
0
)
return
-
1
;
...
@@ -721,6 +723,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
...
@@ -721,6 +723,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
tsMonitorPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"monitorPort"
)
->
i32
;
tsMonitorPort
=
(
uint16_t
)
cfgGetItem
(
pCfg
,
"monitorPort"
)
->
i32
;
tsMonitorMaxLogs
=
cfgGetItem
(
pCfg
,
"monitorMaxLogs"
)
->
i32
;
tsMonitorMaxLogs
=
cfgGetItem
(
pCfg
,
"monitorMaxLogs"
)
->
i32
;
tsMonitorComp
=
cfgGetItem
(
pCfg
,
"monitorComp"
)
->
bval
;
tsMonitorComp
=
cfgGetItem
(
pCfg
,
"monitorComp"
)
->
bval
;
tsQueryRspPolicy
=
cfgGetItem
(
pCfg
,
"queryRspPolicy"
)
->
i32
;
tsEnableTelem
=
cfgGetItem
(
pCfg
,
"telemetryReporting"
)
->
bval
;
tsEnableTelem
=
cfgGetItem
(
pCfg
,
"telemetryReporting"
)
->
bval
;
tsTelemInterval
=
cfgGetItem
(
pCfg
,
"telemetryInterval"
)
->
i32
;
tsTelemInterval
=
cfgGetItem
(
pCfg
,
"telemetryInterval"
)
->
i32
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
74be3572
...
@@ -3021,6 +3021,8 @@ void cleanupExprSupp(SExprSupp* pSupp) {
...
@@ -3021,6 +3021,8 @@ void cleanupExprSupp(SExprSupp* pSupp) {
destroyExprInfo
(
pSupp
->
pExprInfo
,
pSupp
->
numOfExprs
);
destroyExprInfo
(
pSupp
->
pExprInfo
,
pSupp
->
numOfExprs
);
taosMemoryFreeClear
(
pSupp
->
pExprInfo
);
taosMemoryFreeClear
(
pSupp
->
pExprInfo
);
}
}
filterFreeInfo
(
pSupp
->
pFilterInfo
);
taosMemoryFree
(
pSupp
->
rowEntryInfoOffset
);
taosMemoryFree
(
pSupp
->
rowEntryInfoOffset
);
}
}
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
74be3572
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include "tmsg.h"
#include "tmsg.h"
#include "tname.h"
#include "tname.h"
#include "tdatablock.h"
#include "tdatablock.h"
#include "tglobal.h"
SQWorkerMgmt
gQwMgmt
=
{
SQWorkerMgmt
gQwMgmt
=
{
.
lock
=
0
,
.
lock
=
0
,
...
@@ -92,6 +93,16 @@ int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) {
...
@@ -92,6 +93,16 @@ int32_t qwHandleTaskComplete(QW_FPARAMS_DEF, SQWTaskCtx *ctx) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
qwSendQueryRsp
(
QW_FPARAMS_DEF
,
int32_t
msgType
,
SQWTaskCtx
*
ctx
,
int32_t
rspCode
,
bool
quickRsp
)
{
if
((
!
quickRsp
)
||
QUERY_RSP_POLICY_QUICK
==
tsQueryRspPolicy
)
{
qwBuildAndSendQueryRsp
(
msgType
,
&
ctx
->
ctrlConnInfo
,
rspCode
,
ctx
);
ctx
->
queryRsped
=
true
;
QW_TASK_DLOG
(
"query msg rsped, handle:%p, code:%x - %s"
,
ctx
->
ctrlConnInfo
.
handle
,
rspCode
,
tstrerror
(
rspCode
));
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
qwExecTask
(
QW_FPARAMS_DEF
,
SQWTaskCtx
*
ctx
,
bool
*
queryStop
)
{
int32_t
qwExecTask
(
QW_FPARAMS_DEF
,
SQWTaskCtx
*
ctx
,
bool
*
queryStop
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
bool
qcontinue
=
true
;
bool
qcontinue
=
true
;
...
@@ -411,6 +422,11 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu
...
@@ -411,6 +422,11 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu
QW_ERR_JRET
(
TSDB_CODE_QRY_DUPLICATTED_OPERATION
);
QW_ERR_JRET
(
TSDB_CODE_QRY_DUPLICATTED_OPERATION
);
}
}
if
(
ctx
->
rspCode
)
{
QW_TASK_ELOG
(
"task already failed cause of %s, phase:%s"
,
tstrerror
(
ctx
->
rspCode
),
qwPhaseStr
(
phase
));
QW_ERR_JRET
(
ctx
->
rspCode
);
}
if
(
!
ctx
->
queryRsped
)
{
if
(
!
ctx
->
queryRsped
)
{
QW_TASK_ELOG
(
"ready msg has not been processed, phase:%s"
,
qwPhaseStr
(
phase
));
QW_TASK_ELOG
(
"ready msg has not been processed, phase:%s"
,
qwPhaseStr
(
phase
));
QW_ERR_JRET
(
TSDB_CODE_QRY_TASK_MSG_ERROR
);
QW_ERR_JRET
(
TSDB_CODE_QRY_TASK_MSG_ERROR
);
...
@@ -423,6 +439,11 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu
...
@@ -423,6 +439,11 @@ int32_t qwHandlePrePhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inpu
QW_ERR_JRET
(
TSDB_CODE_QRY_TASK_DROPPED
);
QW_ERR_JRET
(
TSDB_CODE_QRY_TASK_DROPPED
);
}
}
if
(
ctx
->
rspCode
)
{
QW_TASK_ELOG
(
"task already failed cause of %s, phase:%s"
,
tstrerror
(
ctx
->
rspCode
),
qwPhaseStr
(
phase
));
QW_ERR_JRET
(
ctx
->
rspCode
);
}
if
(
QW_EVENT_RECEIVED
(
ctx
,
QW_EVENT_DROP
))
{
if
(
QW_EVENT_RECEIVED
(
ctx
,
QW_EVENT_DROP
))
{
QW_ERR_JRET
(
qwDropTask
(
QW_FPARAMS
()));
QW_ERR_JRET
(
qwDropTask
(
QW_FPARAMS
()));
...
@@ -506,22 +527,15 @@ _return:
...
@@ -506,22 +527,15 @@ _return:
ctx
->
queryGotData
=
true
;
ctx
->
queryGotData
=
true
;
}
}
#if 0
if
(
QW_PHASE_POST_QUERY
==
phase
&&
ctx
&&
!
ctx
->
localExec
&&
!
ctx
->
queryRsped
)
{
if (QW_PHASE_POST_QUERY == phase && ctx) {
if (!ctx->localExec) {
bool
rsped
=
false
;
bool
rsped
=
false
;
SQWMsg
qwMsg
=
{.
msgType
=
ctx
->
msgType
,
.
connInfo
=
ctx
->
ctrlConnInfo
};
SQWMsg
qwMsg
=
{.
msgType
=
ctx
->
msgType
,
.
connInfo
=
ctx
->
ctrlConnInfo
};
qwDbgSimulateRedirect
(
&
qwMsg
,
ctx
,
&
rsped
);
qwDbgSimulateRedirect
(
&
qwMsg
,
ctx
,
&
rsped
);
qwDbgSimulateDead
(
QW_FPARAMS
(),
ctx
,
&
rsped
);
qwDbgSimulateDead
(
QW_FPARAMS
(),
ctx
,
&
rsped
);
if
(
!
rsped
)
{
if
(
!
rsped
)
{
qwBuildAndSendQueryRsp(input->msgType + 1, &ctx->ctrlConnInfo, code, ctx);
qwSendQueryRsp
(
QW_FPARAMS
(),
input
->
msgType
+
1
,
ctx
,
code
,
false
);
QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", ctx->ctrlConnInfo.handle, code, tstrerror(code));
}
}
}
ctx->queryRsped = true;
}
}
#endif
if
(
ctx
)
{
if
(
ctx
)
{
QW_UPDATE_RSP_CODE
(
ctx
,
code
);
QW_UPDATE_RSP_CODE
(
ctx
,
code
);
...
@@ -558,20 +572,12 @@ int32_t qwPreprocessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
...
@@ -558,20 +572,12 @@ int32_t qwPreprocessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) {
QW_ERR_JRET
(
qwAcquireTaskCtx
(
QW_FPARAMS
(),
&
ctx
));
QW_ERR_JRET
(
qwAcquireTaskCtx
(
QW_FPARAMS
(),
&
ctx
));
ctx
->
ctrlConnInfo
=
qwMsg
->
connInfo
;
ctx
->
ctrlConnInfo
=
qwMsg
->
connInfo
;
ctx
->
phase
=
-
1
;
QW_ERR_JRET
(
qwAddTaskStatus
(
QW_FPARAMS
(),
JOB_TASK_STATUS_INIT
));
QW_ERR_JRET
(
qwAddTaskStatus
(
QW_FPARAMS
(),
JOB_TASK_STATUS_INIT
));
_return:
_return:
#if 1
qwBuildAndSendQueryRsp
(
qwMsg
->
msgType
+
1
,
&
qwMsg
->
connInfo
,
code
,
ctx
);
if
(
ctx
)
{
ctx
->
queryRsped
=
true
;
ctx
->
phase
=
-
1
;
QW_TASK_DLOG
(
"query msg rsped, handle:%p, code:%x - %s"
,
ctx
->
ctrlConnInfo
.
handle
,
code
,
tstrerror
(
code
));
}
#endif
if
(
ctx
)
{
if
(
ctx
)
{
QW_UPDATE_RSP_CODE
(
ctx
,
code
);
QW_UPDATE_RSP_CODE
(
ctx
,
code
);
qwReleaseTaskCtx
(
mgmt
,
ctx
);
qwReleaseTaskCtx
(
mgmt
,
ctx
);
...
@@ -620,6 +626,8 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) {
...
@@ -620,6 +626,8 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, char *sql) {
QW_ERR_JRET
(
TSDB_CODE_QRY_APP_ERROR
);
QW_ERR_JRET
(
TSDB_CODE_QRY_APP_ERROR
);
}
}
qwSendQueryRsp
(
QW_FPARAMS
(),
qwMsg
->
msgType
+
1
,
ctx
,
code
,
true
);
ctx
->
level
=
plan
->
level
;
ctx
->
level
=
plan
->
level
;
atomic_store_ptr
(
&
ctx
->
taskHandle
,
pTaskInfo
);
atomic_store_ptr
(
&
ctx
->
taskHandle
,
pTaskInfo
);
atomic_store_ptr
(
&
ctx
->
sinkHandle
,
sinkHandle
);
atomic_store_ptr
(
&
ctx
->
sinkHandle
,
sinkHandle
);
...
@@ -660,7 +668,7 @@ _return:
...
@@ -660,7 +668,7 @@ _return:
}
}
}
}
QW_RET
(
code
);
QW_RET
(
TSDB_CODE_SUCCESS
);
}
}
int32_t
qwProcessCQuery
(
QW_FPARAMS_DEF
,
SQWMsg
*
qwMsg
)
{
int32_t
qwProcessCQuery
(
QW_FPARAMS_DEF
,
SQWMsg
*
qwMsg
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录