Skip to content

Commit 2170a32

Browse files
Merge branch 'master' into copilot/fix-5111
2 parents 584468c + 7f03bf0 commit 2170a32

74 files changed

Lines changed: 12635 additions & 1383 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<ClientOfficialVersion>3.52.0</ClientOfficialVersion>
4-
<ClientPreviewVersion>3.53.0</ClientPreviewVersion>
3+
<ClientOfficialVersion>3.53.0</ClientOfficialVersion>
4+
<ClientPreviewVersion>3.54.0</ClientPreviewVersion>
55
<ClientPreviewSuffixVersion>preview.0</ClientPreviewSuffixVersion>
66
<DirectVersion>3.39.1</DirectVersion>
77
<FaultInjectionVersion>1.0.0</FaultInjectionVersion>

Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionRuleProcessor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ await BackoffRetryUtility<IEnumerable<string>>.ExecuteAsync(
189189
result.GetDelay(),
190190
result.GetSuppressServiceRequests(),
191191
result.GetInjectionRate(),
192-
this.applicationContext));
192+
this.applicationContext,
193+
this.globalEndpointManager));
193194
}
194195

195196
private async Task<IFaultInjectionRuleInternal> GetEffectiveConnectionErrorRule(FaultInjectionRule rule)

Microsoft.Azure.Cosmos/FaultInjection/src/implementation/FaultInjectionServerErrorResultInternal.cs

Lines changed: 144 additions & 69 deletions
Large diffs are not rendered by default.

Microsoft.Azure.Cosmos/contracts/API_3.52.1.txt

Lines changed: 1756 additions & 0 deletions
Large diffs are not rendered by default.

Microsoft.Azure.Cosmos/contracts/API_3.53.0-preview.1.txt

Lines changed: 1890 additions & 0 deletions
Large diffs are not rendered by default.

Microsoft.Azure.Cosmos/contracts/API_3.53.0.txt

Lines changed: 1758 additions & 0 deletions
Large diffs are not rendered by default.

Microsoft.Azure.Cosmos/contracts/API_3.54.0-preview.0.txt

Lines changed: 1892 additions & 0 deletions
Large diffs are not rendered by default.

Microsoft.Azure.Cosmos/src/ClientRetryPolicy.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ internal sealed class ClientRetryPolicy : IDocumentClientRetryPolicy
2727
private readonly IDocumentClientRetryPolicy throttlingRetry;
2828
private readonly GlobalEndpointManager globalEndpointManager;
2929
private readonly GlobalPartitionEndpointManager partitionKeyRangeLocationCache;
30-
private readonly bool enableEndpointDiscovery;
31-
private readonly bool isPartitionLevelFailoverEnabled;
30+
private readonly bool enableEndpointDiscovery;
31+
private readonly bool isThinClientEnabled;
3232
private int failoverRetryCount;
3333

3434
private int sessionTokenRetryCount;
@@ -44,8 +44,8 @@ public ClientRetryPolicy(
4444
GlobalEndpointManager globalEndpointManager,
4545
GlobalPartitionEndpointManager partitionKeyRangeLocationCache,
4646
RetryOptions retryOptions,
47-
bool enableEndpointDiscovery,
48-
bool isPartitionLevelFailoverEnabled)
47+
bool enableEndpointDiscovery,
48+
bool isThinClientEnabled)
4949
{
5050
this.throttlingRetry = new ResourceThrottleRetryPolicy(
5151
retryOptions.MaxRetryAttemptsOnThrottledRequests,
@@ -58,8 +58,8 @@ public ClientRetryPolicy(
5858
this.sessionTokenRetryCount = 0;
5959
this.serviceUnavailableRetryCount = 0;
6060
this.canUseMultipleWriteLocations = false;
61-
this.isMultiMasterWriteRequest = false;
62-
this.isPartitionLevelFailoverEnabled = isPartitionLevelFailoverEnabled;
61+
this.isMultiMasterWriteRequest = false;
62+
this.isThinClientEnabled = isThinClientEnabled;
6363
}
6464

6565
/// <summary>
@@ -226,7 +226,11 @@ public void OnBeforeSendRequest(DocumentServiceRequest request)
226226

227227
// Resolve the endpoint for the request and pin the resolution to the resolved endpoint
228228
// This enables marking the endpoint unavailability on endpoint failover/unreachability
229-
this.locationEndpoint = this.globalEndpointManager.ResolveServiceEndpoint(request);
229+
this.locationEndpoint = this.isThinClientEnabled
230+
&& GatewayStoreModel.IsOperationSupportedByThinClient(request)
231+
? this.globalEndpointManager.ResolveThinClientEndpoint(request)
232+
: this.globalEndpointManager.ResolveServiceEndpoint(request);
233+
230234
request.RequestContext.RouteToLocation(this.locationEndpoint);
231235
}
232236

@@ -493,7 +497,7 @@ private ShouldRetryResult ShouldRetryOnUnavailableEndpointStatusCodes()
493497

494498
if (!this.canUseMultipleWriteLocations
495499
&& !this.isReadRequest
496-
&& !this.isPartitionLevelFailoverEnabled)
500+
&& !this.partitionKeyRangeLocationCache.IsPartitionLevelAutomaticFailoverEnabled())
497501
{
498502
// Write requests on single master cannot be retried if partition level failover is disabled.
499503
// This means there are no other regions available to serve the writes.

Microsoft.Azure.Cosmos/src/ConnectionPolicy.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,12 @@ public bool EnablePartitionLevelCircuitBreaker
338338
set;
339339
}
340340

341+
internal bool DisablePartitionLevelFailoverClientLevelOverride
342+
{
343+
get;
344+
set;
345+
}
346+
341347
/// <summary>
342348
/// Gets or sets the certificate validation callback.
343349
/// </summary>

Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,15 @@ bool EnableRemoteRegionPreferredForSessionRetry
770770
/// If compute gateway chooses to enable PPAF, then the .NET SDK will enable PPCB by default, which will improve the read availability and latency. This would mean
771771
/// when PPAF is enabled, the SDK will automatically enable PPCB as well.
772772
/// </summary>
773-
internal bool EnablePartitionLevelCircuitBreaker { get; set; } = ConfigurationManager.IsPartitionLevelCircuitBreakerEnabled(defaultValue: false);
773+
internal bool EnablePartitionLevelCircuitBreaker { get; set; } = ConfigurationManager.IsPartitionLevelCircuitBreakerEnabled(defaultValue: false);
774+
775+
/// <summary>
776+
/// Flag from gateway to disable partition level failover. Normally, the SDK will enable partition level failover based on the account settings.
777+
/// This flag will be used internally by the compute gateway as by default it will disable partition level failover.
778+
///
779+
/// The default value for this parameter is 'false'.
780+
/// </summary>
781+
internal bool DisablePartitionLevelFailover { get; set; } = false;
774782

775783
/// <summary>
776784
/// Quorum Read allowed with eventual consistency account or consistent prefix account.
@@ -1029,7 +1037,8 @@ internal virtual ConnectionPolicy GetConnectionPolicy(int clientId)
10291037
MaxRequestsPerTcpConnection = this.MaxRequestsPerTcpConnection,
10301038
MaxTcpConnectionsPerEndpoint = this.MaxTcpConnectionsPerEndpoint,
10311039
EnableEndpointDiscovery = !this.LimitToEndpoint,
1032-
EnablePartitionLevelCircuitBreaker = this.EnablePartitionLevelCircuitBreaker,
1040+
EnablePartitionLevelCircuitBreaker = this.EnablePartitionLevelCircuitBreaker,
1041+
DisablePartitionLevelFailoverClientLevelOverride = this.DisablePartitionLevelFailover,
10331042
PortReuseMode = this.portReuseMode,
10341043
EnableTcpConnectionEndpointRediscovery = this.EnableTcpConnectionEndpointRediscovery,
10351044
EnableAdvancedReplicaSelectionForTcp = this.EnableAdvancedReplicaSelectionForTcp,

0 commit comments

Comments
 (0)