-
Notifications
You must be signed in to change notification settings - Fork 494
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
[Internal] Upgrade Resiliency: Adds Code to Enable Replica Validation Feature Through CosmosClientOptions
#3967
Changes from all commits
c083f18
aa28b03
7a0bbcf
37beed5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,7 +113,6 @@ internal partial class DocumentClient : IDisposable, IAuthorizationTokenProvider | |
private const string DefaultInitTaskKey = "InitTaskKey"; | ||
|
||
private readonly bool IsLocalQuorumConsistency = false; | ||
private readonly bool isReplicaAddressValidationEnabled; | ||
|
||
//Auth | ||
internal readonly AuthorizationTokenProvider cosmosAuthorization; | ||
|
@@ -233,7 +232,6 @@ public DocumentClient(Uri serviceEndpoint, | |
|
||
this.Initialize(serviceEndpoint, connectionPolicy, desiredConsistencyLevel); | ||
this.initTaskCache = new AsyncCacheNonBlocking<string, bool>(cancellationToken: this.cancellationTokenSource.Token); | ||
this.isReplicaAddressValidationEnabled = ConfigurationManager.IsReplicaAddressValidationEnabled(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is CosmosCLientOptions needs to default to ConfigurationManager.IsReplicaAddressValidationEnabled()? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we ship a version that supported setting the environment variable and is anyone using it? If yes, we might want to have backward compatibility? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Then yeah, no issues from my side. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do external CX enable/disable this feature? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you suggesting to have both the environment variable and |
||
} | ||
|
||
/// <summary> | ||
|
@@ -6703,7 +6701,7 @@ private void CreateStoreModel(bool subscribeRntbdStatus) | |
!this.enableRntbdChannel, | ||
this.UseMultipleWriteLocations && (this.accountServiceConfiguration.DefaultConsistencyLevel != Documents.ConsistencyLevel.Strong), | ||
true, | ||
enableReplicaValidation: this.isReplicaAddressValidationEnabled); | ||
enableReplicaValidation: this.ConnectionPolicy.EnableAdvancedReplicaSelectionForTcp); | ||
|
||
if (subscribeRntbdStatus) | ||
{ | ||
|
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.
Is explicit differentiation about opted/not vs default behavior for compute?
If so one option is to model it as nullable. Thoughts?
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.
Similar to
EnableContentResponseOnWrite
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.
Well, not setting this flag
EnableAdvancedReplicaSelectionForTcp
will automatically make the SDK to opt out from replica validation. In order to opt the feature, Compute doesn't need to specify any value for this field and the default value for this flag is alwaysfalse
.I think this brings more simplicity, since we are anyhow not going to make this flag to public.
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.
You can make the SDK default to disabled if the
bool?
has not value by just capturing:I think Kiran's point is that semantically it's always better to make settings
bool?
likeEnableContentResponseOnWrite
because it allows us (for whatever reason) to tell apart the scenario where the property's setter was not touched (use default) and when the user did set some preference (either true or false). In this particular case there might not be a special case for not touched, but for consistency's sake, if we are usingbool?
for other settings, might as well use it here.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.
Its an optional property and hence the conversation.
If compute if always set it explicitly (true/false) then for current requirements its makes sense.