Skip to content

Conversation

@fuatbasik
Copy link
Collaborator

Description of change

This is the first PR of a series of 2, that is adding RetryPolicy (with Failsafe as a dependency) and applying these retries with the current defaults. In the next PR, I will add the logic to pass RetryPolicy from library user to block, through Open Stream Information

Relevant issues

NO.

Does this contribution introduce any breaking changes to the existing APIs or behaviors?

No.

Does this contribution introduce any new public APIs or behaviors?

Yes, it introduces a new capability to change/add retries on top of SDK retries.

How was the contribution tested?

Added new unit tests, confirmed existing GrayFailureTests are passing.

Does this contribution need a changelog entry?

Yes. I will update the ChangeLog and Readme in the next PR.

  • I have updated the CHANGELOG or README if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).

this.aggregatingMetrics = aggregatingMetrics;
this.indexCache = indexCache;
generateSourceAndData();
this.configuration = configuration;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this variable ever used?
think line 111 and 109-110 use class variable vs constructor variable in different ways maybe just remove this config?


/**
* Executes a supplier with retry logic according to the configured retry policy.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these 2 lines are basically saying the same thing about using the retry policy maybe just merge them?


/** Functional interface for operations that can throw IOException. */
@FunctionalInterface
interface IORunnable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think this interface and the interface below can be handy in the future should we move them to their own classes.

* @param configuration the physical IO configuration containing retry settings
* @throws NullPointerException if configuration is null
*/
public SeekableInputStreamRetryExecutor(PhysicalIOConfiguration configuration) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should take PhysicalIOConfiguration, I can see us wanting to re-use this logic elsewhere and we might not necessarily want to use PhysicalIOConfiguration there. Can't we split this out to it's own thing? even if it just includes the 2 settings we have for now.

}

@Test
void testConfigurationConstructor() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing about using parameterized test to just cover all the constructor tests.

import java.io.IOException;

/**
* Interface for executing operations with retry logic. We do not expect consumers of AAL to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't the one design include consumers having access to this?

*
* @throws RuntimeException if all retries fails and an error occurs
*/
private void generateSourceAndData() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this PR we are changing the retry behaviour, intentionally. Today if generateSourceAndData timeouts (mostly this is relevant to StreamUtils.toByteArray()), we will retry, even if there is no call to 'read' function of that block. With this change we will only retry if there is a call to 'read' function. This could be when we prefetch a block but never read it, but it does make sense not to retry them anyways.

@stubz151
Copy link
Contributor

LGTM TY

@fuatbasik fuatbasik merged commit ee6f62d into awslabs:main Jul 14, 2025
4 checks passed
@fuatbasik fuatbasik deleted the retry branch July 25, 2025 10:32
@ozkoca ozkoca mentioned this pull request Jul 29, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants