Skip to content
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

CosmosClientOptions: Add ApplicationPreferredRegions #1305

Merged
merged 18 commits into from
Apr 3, 2020

Conversation

ealsur
Copy link
Member

@ealsur ealsur commented Mar 25, 2020

Pull Request Template

Description

The most common use case for global availability is for applications to specify ApplicationRegion in CosmosClientOptions.

ApplicationRegion defines where is the current application running and lets the SDK populate the list of preferred regions based on availability (which regions the account is available on) and distance (closest regions first).

There are however, some situations where the application might want to manually specify the order of preference.

This PR adds the CosmosClientOptions.ApplicationPreferredRegions to enable these scenarios as an alternative to ApplicationRegion. Both cannot be set.

Type of change

  • New feature (non-breaking change which adds functionality)

Closing issues

Closes #1306

@ealsur ealsur requested a review from kirillg as a code owner March 25, 2020 22:32
@ealsur ealsur self-assigned this Mar 25, 2020
abhijitpai
abhijitpai previously approved these changes Mar 26, 2020

[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void VerifyLimitToEndpointSettingsWithPreferredRegions()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably outside the scope of this PR but is there any way to validate the SDK is following the order provided?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question, I believe it depends on the error. I've seen logic in the ClientRetryPolicy which should honor the order but other that are actively not honoring it. I am not familiar with why it works like that.

Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs Outdated Show resolved Hide resolved
@kirankumarkolli
Copy link
Member

@kirillg FYR we are adding preferred locations as explicit specification.

kirankumarkolli
kirankumarkolli previously approved these changes Apr 3, 2020
@ealsur ealsur changed the title PreferredRegions support [Added] Configuration: ApplicationPreferredRegions support Apr 3, 2020
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Please follow the required format. [Internal] Category: (Add|Fix) Description

@ealsur ealsur changed the title [Added] Configuration: ApplicationPreferredRegions support [Added] Configuration: Add ApplicationPreferredRegions support on CosmosClientOptions Apr 3, 2020
@ealsur ealsur changed the title [Added] Configuration: Add ApplicationPreferredRegions support on CosmosClientOptions CosmosClientOptions: Add ApplicationPreferredRegions Apr 3, 2020
@ealsur ealsur merged commit 446fa00 into master Apr 3, 2020
@ealsur ealsur deleted the users/ealsur/preferredlocatoins branch April 3, 2020 23:37
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.

Ability to set PreferredLocations
5 participants