Implement handling strategy for retryable vs non-retryable exceptions in workerPartition#6270
Conversation
e91a9aa to
fc43488
Compare
…in workerPartition Signed-off-by: Vecheka Chhourn <vecheka@amazon.com>
fc43488 to
0930903
Compare
| * @param ex - exception thrown by workerScheduler | ||
| * @return boolean: true if we should fallback to backoffRetry | ||
| */ | ||
| private boolean delayRetry(Optional<EnhancedSourcePartition> sourcePartition, Exception ex) { |
There was a problem hiding this comment.
nit.
Suggest to change the naming of this function and isWorkerPartitionLeaseExtended if we have a new revision.
delayRetry and backoffRetry can be renamed to something like shouldLocalRetry. It is because extending partition lease is also a sort of retry in partition level.
isWorkerPartitionLeaseExtended is not 100% true because there is scenario to give up the partition and lease not being extended. It should also be shouldLocalRetry
There was a problem hiding this comment.
That's a good point. I've renamed them for better readability. Thanks!
…retry-strategy Signed-off-by: Vecheka Chhourn <vecheka@amazon.com>
60e5f63 to
ee15c10
Compare
| log.info("Updating workerPartition {}", workerPartition.getPartitionKey()); | ||
| Duration age = Duration.between(partitionCreationTime, Instant.now()); | ||
| if (age.compareTo(this.sourceConfig.getDurationToGiveUpRetry()) <= 0) { | ||
| log.info("Partition {} is within or equal to the configured max duration, scheduling retry", workerPartition.getPartitionKey()); |
There was a problem hiding this comment.
Makes sense, will update this.
| if (progressState instanceof DimensionalTimeSliceWorkerProgressState) { | ||
| DimensionalTimeSliceWorkerProgressState workerProgressState = (DimensionalTimeSliceWorkerProgressState) progressState; | ||
| updateWorkerPartition(workerProgressState.getPartitionCreationTime(), workerPartition); | ||
| shouldLocalRetry = false; |
There was a problem hiding this comment.
Intention of the logic is to update the worker partition when partitionCreationTime exists in the state? or do this only for DimensionalTimeSliceWorkerProgressState ?
There was a problem hiding this comment.
Currently, only DimensionalTimeSliceWorkerProgressState has partitionCreationTime field but ideally we will followup with adding partitionCreationTime field to other SaasWorkerProgressState types.
…retry-strategy Signed-off-by: Vecheka Chhourn <vecheka@amazon.com>
3f4074e to
274b74b
Compare
…in workerPartition (opensearch-project#6270) Signed-off-by: Vecheka Chhourn <vecheka@amazon.com>
…in workerPartition (opensearch-project#6270) Signed-off-by: Vecheka Chhourn <vecheka@amazon.com> Signed-off-by: Simon ELBAZ <elbazsimon9@gmail.com>
…in workerPartition (opensearch-project#6270) Signed-off-by: Vecheka Chhourn <vecheka@amazon.com>
…in workerPartition (opensearch-project#6270) Signed-off-by: Vecheka Chhourn <vecheka@amazon.com>
Description
This is second part of the change to handle retryable vs non-retryable excpetions.
First part PR for more context: #6255
How
We are adding a new generic exception class
SaaSCrawlerExceptionto be shared by all connectors. This class is similar to previous API specific exception class (e.gOffice365Exception).CrawlerException will have two criterias:
We will utilize CrawlerException, and throw this up all the way to
WorkerSchedulewhere in the followup PR:sourceCoordinator.saveProgressStateForPartition(workerPartition, DURATION_TO_DELAY_RETRY). If it continues to fail up to 30 days (using partitionCreationTime field to confirm), we will give up the worker partition.Is this change backward compatible?
Yes. We ensure to keep the catch block on generic "Exception" so all other connectors will still use the default behaviour of backoff retry every 5ms for all exception types.
Testing
Unit tests, ran the below successfully:
Local testing:
Issues Resolved
N/A
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.