-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Support insert timeout #50644
base: main
Are you sure you want to change the base?
Conversation
@@ -1303,6 +1304,7 @@ private void handleAnalyzeStmt() throws IOException { | |||
// will print warning log if timeout, so we update timeout temporarily to avoid | |||
// warning log | |||
context.getSessionVariable().setQueryTimeoutS((int) Config.statistic_collect_query_timeout); | |||
context.getSessionVariable().setInsertTimeoutS((int) Config.statistic_collect_query_timeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the usage here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
analyze job has both query and insert sql, so set query_timeout and insert_timeout
String.format("Query exceeded time limit of %d seconds", | ||
ConnectContext.get().getSessionVariable().getQueryTimeoutS()))); | ||
status.setStatus(new Status(TStatusCode.TIMEOUT, ErrorCode.ERR_TIMEOUT.formatErrorMsg( | ||
"Query", timeoutMs / 1000, "please increase the 'query_timeout' session variable"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query_timeout only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, only query uses this.
} | ||
|
||
public String getExecType() { | ||
if (parsedStmt instanceof InsertStmt || parsedStmt instanceof CreateTableAsSelectStmt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not implement it as a method in StatementBase?
And provide a StmtExecType class with DML_INSERT, DML_UPDATE, DML_DELETE, DCL_QUERY
@@ -2689,4 +2693,28 @@ public void addFinishedQueryDetail() { | |||
QueryDetailQueue.addQueryDetail(queryDetail); | |||
} | |||
|
|||
public int getExecTimeout() { | |||
if (parsedStmt instanceof DmlStmt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better to provide a abstract getTimeout method in StatementBase, with some sub-classes implementing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
10874fd
to
a76bca3
Compare
Signed-off-by: wyb <[email protected]>
Signed-off-by: wyb <[email protected]>
Signed-off-by: wyb <[email protected]>
Quality Gate passedIssues Measures |
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]❌ fail : 59 / 79 (74.68%) file detail
|
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Why I'm doing:
insert
andquery
use the samequery_timeout
session variable to control timeout.but they need different default values, default
query_timeout 300s
is very small for insert.What I'm doing:
add a new
insert_timeout
session variable forinsert/update/delete
and the default value is14400s
.you can also set
timeout
ininsert properties
for the current insert sql, for exampleif
timeout
property is not set,insert_timeout
session variable will be used.Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: