-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Support reading from secondary storage on retries #7622
Conversation
Having an isolated mocked test of Having a separate policy test also makes sure that you call correct sync/async methods when appropriate. Sample policy test https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/core/Azure.Core/tests/BufferResponsePolicyTests.cs |
sdk/storage/Azure.Storage.Common/src/GeoRedundantReadResponseClassifier.cs
Outdated
Show resolved
Hide resolved
Updated to add new tests for both classes. |
ca37195
to
2c2eda7
Compare
/azp run net - storage - ci |
2c2eda7
to
737af48
Compare
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.
It would probably be best for @tg-msft to take another look, too.
737af48
to
c08104d
Compare
sdk/storage/Azure.Storage.Common/tests/StorageResponseClassifierTests.cs
Outdated
Show resolved
Hide resolved
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.
Nice! Please be sure to do one last test pass since a lot of big PRs have gone in today.
7a4c458
to
e6b57e4
Compare
93a457b
to
7037b5e
Compare
7037b5e
to
2ae2606
Compare
Fixes #6890
Adds a settable property on BlobClientOptions and QueueClientOptions where users can specify the GeoRedundantSecondaryUri. This should only be set if the account is configured to have Read-access geo-redundant storage (RA-GRS), i.e. accounts having geo replication without read access would not use this feature. Note Files do not support RA-GRS. If the property is set, in the event of retriable responses or exceptions for either HEAD or GET requests, we will retry against the secondary storage. If that retry fails, we will toggle back to primary storage and continue on in this way for subsequent failures for as many retries are configured in the RetryOptions.
This is different than the Track 1 C# implementation which has a property called LocationMode with the following options: PrimaryOnly (default), PrimaryThenSecondary, SecondaryOnly, SecondaryThenPrimary. What we are implementing is essentially the same as the PrimaryThenSecondary option from Track 1. SecondaryOnly and SecondaryThenPrimary are not supported in this Track 2 implementation. These two options rely on the client being able to add a custom RetryPolicy in which they add an implementation for the Evaluate method (see https://docs.microsoft.com/en-us/azure/storage/common/storage-designing-ha-apps-with-ragrs?toc=%2fazure%2fstorage%2fblobs%2ftoc.json). In this method, they could determine, based on information within RetryContext and OperationContext whether future retries should only occur against Secondary Storage (SecondaryOnly), or against Secondary and then Primary (SecondaryThenPrimary). For now, we would like to leave this level of configurability out of scope and align with the Java implementations for Track 1 and Track 2 which do the same toggling between Primary and Secondary storage that we are adding here. In the future, if we have a need for the more advanced configuration, we could expose our GeoRedundantReadPolicy class so that customers can override to have more flexibility in where retries are routed to.