adding dev.Failsafe Retry policy to handle SQL transient#1
adding dev.Failsafe Retry policy to handle SQL transient#1AbhishekKumar9984 wants to merge 1 commit intodevelopfrom
Conversation
|
will check |
|
@AbhishekKumar9984 PR is missing the major implementation steps, it is taking care of retries at single place that too while getting connection only, failures can be there while executing queries, getting data from resultsets and while getting schema. All those are not yet handled. All the values related to retry policy will come from either user or some default values as we have done in Salesforce, take a reference from there and then do it |
database-commons/src/main/java/io/cdap/plugin/util/RetryPolicyUtil.java
Outdated
Show resolved
Hide resolved
database-commons/src/main/java/io/cdap/plugin/util/RetryPolicyUtil.java
Outdated
Show resolved
Hide resolved
database-commons/src/main/java/io/cdap/plugin/db/CommonSchemaReader.java
Outdated
Show resolved
Hide resolved
database-commons/src/main/java/io/cdap/plugin/db/connector/AbstractDBConnectorConfig.java
Outdated
Show resolved
Hide resolved
|
|
||
|
|
|
|
||
| protected void setFieldAccordingToSchema(ResultSet resultSet, StructuredRecord.Builder recordBuilder, | ||
| Schema.Field field, int columnIndex) throws SQLException { | ||
|
|
| // private static final String NAME_RETRY_MULTIPLIER = "retryMultiplier"; | ||
| private static final String NAME_MAX_RETRY_COUNT = "maxRetryCount"; | ||
| public static final int DEFAULT_INITIAL_RETRY_DURATION_SECONDS = 2; | ||
| public static final int DEFAULT_RETRY_MULTIPLIER = 2; |
There was a problem hiding this comment.
DEFAULT_RETRY_MULTIPLIER - Is this constant needed? If not, remove it.
There was a problem hiding this comment.
at this point it is not needed but if we want a retry multiplier which is specified according to user .so we can use it for now i will remove it .
| Failsafe.with(RetryPolicyUtil.RETRY_POLICY).run(() -> { | ||
| String[] columns = config.getArgumentsColumns().split(","); | ||
| for (String column : columns) { | ||
| arguments.set(column, resultSet.getString(column)); | ||
| } | ||
| }); |
There was a problem hiding this comment.
Is there any call to the backend taking place here that can cause SQLTransientConnectionException? If not, retry is not needed here.
|
|
||
| @Override | ||
| public Statement createStatement() throws SQLException { | ||
|
|
|
|
||
| import dev.failsafe.Failsafe; | ||
| import io.cdap.plugin.util.RetryPolicyUtil; | ||
|
|
No description provided.