Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/src/ClientContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1073,8 +1073,8 @@ export class ClientContext {
*/
public isPartitionLevelFailOverEnabled(): boolean {
return (
this.connectionPolicy.enablePartitionLevelFailover ||
this.connectionPolicy.enablePartitionLevelCircuitBreaker
this.globalEndpointManager.enablePartitionLevelFailover ||
this.globalEndpointManager.enablePartitionLevelCircuitBreaker
);
}
}
4 changes: 1 addition & 3 deletions sdk/cosmosdb/cosmos/src/common/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export function getUserAgent(
if (hostFramework) {
ua = ua + " " + hostFramework;
}
if (optionsOrConnectionString) {
ua = ua + addFeatureFlagsToUserAgent(optionsOrConnectionString);
}
if (optionsOrConnectionString && optionsOrConnectionString.userAgentSuffix) {
ua = ua + " " + optionsOrConnectionString.userAgentSuffix;
}
Expand All @@ -41,6 +38,7 @@ function userAgentDetails(): string {

/**
* @hidden
* TODO: This function was getting used to track PPAF. Now by default PPAF is enabled. We need to revisit this function.
*/
export function addFeatureFlagsToUserAgent(optionsOrConnectionString: CosmosClientOptions): string {
let featureFlag = 0;
Expand Down
1 change: 0 additions & 1 deletion sdk/cosmosdb/cosmos/src/globalEndpointManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ export class GlobalEndpointManager {
if (databaseAccount) {
this.refreshStaleUnavailableLocations();
this.refreshEndpoints(databaseAccount);
this.refreshPPAFFeatureFlag(databaseAccount.enablePerPartitionFailoverBehavior);
}
this.isRefreshing = false;
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/cosmosdb/cosmos/src/request/RequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ async function httpRequest(
// set a shorter timeout to allow for quicker failover in case of partition unavailability.
// This is to ensure that read requests can quickly failover to another partition if the current one is unavailable.
if (
(requestContext.connectionPolicy.enablePartitionLevelFailover ||
requestContext.connectionPolicy.enablePartitionLevelCircuitBreaker) &&
(requestContext.globalEndpointManager.enablePartitionLevelFailover ||
requestContext.globalEndpointManager.enablePartitionLevelCircuitBreaker) &&
requestContext.partitionKeyRangeId &&
requestContext.resourceType === ResourceType.item &&
isReadRequest(requestContext.operationType)
Expand Down
1 change: 0 additions & 1 deletion sdk/cosmosdb/cosmos/src/retry/retryUtility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export async function execute({
requestContext.resourceType,
requestContext.operationType,
requestContext.connectionPolicy.enableEndpointDiscovery,
requestContext.connectionPolicy.enablePartitionLevelFailover,
requestContext.globalPartitionEndpointManager,
),
};
Expand Down
7 changes: 5 additions & 2 deletions sdk/cosmosdb/cosmos/src/retry/timeoutFailoverRetryPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export class TimeoutFailoverRetryPolicy implements RetryPolicy {
private resourceType: ResourceType,
private operationType: OperationType,
private enableEndPointDiscovery: boolean,
private enablePartitionLevelFailover: boolean,
private globalPartitionEndpointManager?: GlobalPartitionEndpointManager,
) {}

Expand Down Expand Up @@ -96,7 +95,11 @@ export class TimeoutFailoverRetryPolicy implements RetryPolicy {
);
const readRequest = isReadRequest(this.operationType);

if (!canUseMultipleWriteLocations && !readRequest && !this.enablePartitionLevelFailover) {
if (
!canUseMultipleWriteLocations &&
!readRequest &&
!this.globalEndpointManager.enablePartitionLevelFailover
) {
// Write requests on single master cannot be retried if partition level failover is disabled.
// This means there are no other regions available to serve the writes.
return false;
Expand Down