-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Implement full query retries #9361
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
Changes from all commits
8982827
c159dfe
59fa5cb
9f84b4f
e3d8a30
406289c
debb028
e21690a
93151bc
0dc45c2
eb04283
68022ae
cc24d16
c250bc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| import io.airlift.units.DataSize; | ||
| import io.airlift.units.Duration; | ||
| import io.airlift.units.MaxDataSize; | ||
| import io.trino.operator.RetryPolicy; | ||
| import io.trino.sql.analyzer.RegexLibrary; | ||
|
|
||
| import javax.validation.constraints.DecimalMax; | ||
|
|
@@ -40,6 +41,7 @@ | |
| import static io.trino.sql.analyzer.RegexLibrary.JONI; | ||
| import static java.util.Objects.requireNonNull; | ||
| import static java.util.concurrent.TimeUnit.MINUTES; | ||
| import static java.util.concurrent.TimeUnit.SECONDS; | ||
|
|
||
| @DefunctConfig({ | ||
| "analyzer.experimental-syntax-enabled", | ||
|
|
@@ -145,6 +147,11 @@ public class FeaturesConfig | |
| private boolean disableSetPropertiesSecurityCheckForCreateDdl; | ||
| private boolean incrementalHashArrayLoadFactorEnabled = true; | ||
|
|
||
| private RetryPolicy retryPolicy = RetryPolicy.NONE; | ||
| private int retryAttempts = 4; | ||
| private Duration retryInitialDelay = new Duration(10, SECONDS); | ||
|
||
| private Duration retryMaxDelay = new Duration(1, MINUTES); | ||
|
|
||
| public enum JoinReorderingStrategy | ||
| { | ||
| NONE, | ||
|
|
@@ -1108,4 +1115,58 @@ public FeaturesConfig setIncrementalHashArrayLoadFactorEnabled(boolean increment | |
| this.incrementalHashArrayLoadFactorEnabled = incrementalHashArrayLoadFactorEnabled; | ||
| return this; | ||
| } | ||
|
|
||
| @NotNull | ||
| public RetryPolicy getRetryPolicy() | ||
| { | ||
| return retryPolicy; | ||
| } | ||
|
|
||
| @Config("retry-policy") | ||
| public FeaturesConfig setRetryPolicy(RetryPolicy retryPolicy) | ||
| { | ||
| this.retryPolicy = retryPolicy; | ||
| return this; | ||
| } | ||
|
|
||
| @Min(0) | ||
| public int getRetryAttempts() | ||
| { | ||
| return retryAttempts; | ||
| } | ||
|
|
||
| @Config("retry-attempts") | ||
| public FeaturesConfig setRetryAttempts(int retryAttempts) | ||
| { | ||
| this.retryAttempts = retryAttempts; | ||
| return this; | ||
| } | ||
|
|
||
| @NotNull | ||
| public Duration getRetryInitialDelay() | ||
| { | ||
| return retryInitialDelay; | ||
| } | ||
|
|
||
| @Config("retry-initial-delay") | ||
| @ConfigDescription("Initial delay before initiating a retry attempt. Delay increases exponentially for each subsequent attempt up to 'retry_max_delay'") | ||
| public FeaturesConfig setRetryInitialDelay(Duration retryInitialDelay) | ||
| { | ||
| this.retryInitialDelay = retryInitialDelay; | ||
| return this; | ||
| } | ||
|
|
||
| @NotNull | ||
| public Duration getRetryMaxDelay() | ||
| { | ||
| return retryMaxDelay; | ||
| } | ||
|
|
||
| @Config("retry-max-delay") | ||
| @ConfigDescription("Maximum delay before initiating a retry attempt. Delay increases exponentially for each subsequent attempt starting from 'retry_initial_delay'") | ||
| public FeaturesConfig setRetryMaxDelay(Duration retryMaxDelay) | ||
| { | ||
| this.retryMaxDelay = retryMaxDelay; | ||
| return this; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package io.trino.execution; | ||
|
|
||
| import io.airlift.configuration.Config; | ||
| import io.airlift.configuration.ConfigDescription; | ||
| import io.airlift.units.Duration; | ||
|
|
||
| import javax.validation.constraints.NotNull; | ||
|
|
||
| import static java.util.concurrent.TimeUnit.MINUTES; | ||
|
|
||
| public class FailureInjectionConfig | ||
arhimondr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| private Duration expirationPeriod = new Duration(10, MINUTES); | ||
| private Duration requestTimeout = new Duration(2, MINUTES); | ||
|
|
||
| @NotNull | ||
| public Duration getExpirationPeriod() | ||
| { | ||
| return expirationPeriod; | ||
| } | ||
|
|
||
| @Config("failure-injection.expiration-period") | ||
| @ConfigDescription("Period after which an injected failure is considered expired and will no longer be triggering a failure") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would we need expiration of an injected failure?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this to avoid memory leaks |
||
| public FailureInjectionConfig setExpirationPeriod(Duration expirationPeriod) | ||
| { | ||
| this.expirationPeriod = expirationPeriod; | ||
| return this; | ||
| } | ||
|
|
||
| @NotNull | ||
| public Duration getRequestTimeout() | ||
| { | ||
| return requestTimeout; | ||
| } | ||
|
|
||
| @Config("failure-injection.request-timeout") | ||
| @ConfigDescription("Period after which requests blocked to emulate a timeout are released") | ||
| public FailureInjectionConfig setRequestTimeout(Duration requestTimeout) | ||
| { | ||
| this.requestTimeout = requestTimeout; | ||
| return this; | ||
| } | ||
| } | ||
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.
those changes do not seem tests specific
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.
They are not, but I need them for tests. Not sure if it makes sense to extract them into a separate commit, as then it would be harder to understand why do we need it.