Skip to content

Commit

Permalink
Bumping Direct version to 3.24.1 (#3008)
Browse files Browse the repository at this point in the history
- Sub status: Adds SDK generated substatus codes for 503's
- Diagnostics: Captures diagnostics for Splits and RequestTimeoutExcpetion
- Performance: Reduces the size of the Rntbd buffer
- Diagnostics: Adds ServiceEndpoint and Connection Stats to the diagnostics
- Availability: Direct mode removes blocking call on broken connection exception
- Availability: Fixes the SDK to ensure it does not retry on replica that previously failed with 410, 408 and >= 500 status codes
- Session: Fixes scoped session tokens on partition splits and multiple write endpoints enabled.
- DefaultTraceListener: Removes DefaultTraceListener by default unless there is a debugger attached to it.
- Diagnostics: Resetting thread starvation status once it is detected.
- Hierarchical Partitioning: Provides an EPK range for partial partition key specification.
- Session: Fixes gateway session scope during merges
  • Loading branch information
asketagarwal authored Jan 31, 2022
1 parent 1b5bfa8 commit 2e2a9cd
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ClientOfficialVersion>3.23.0</ClientOfficialVersion>
<ClientPreviewVersion>3.23.0</ClientPreviewVersion>
<ClientPreviewSuffixVersion>preview</ClientPreviewSuffixVersion>
<DirectVersion>3.24.0</DirectVersion>
<DirectVersion>3.24.1</DirectVersion>
<EncryptionVersion>1.0.0-previewV19</EncryptionVersion>
<CustomEncryptionVersion>1.0.0-preview02</CustomEncryptionVersion>
<HybridRowVersion>1.1.0-preview3</HybridRowVersion>
Expand Down
5 changes: 5 additions & 0 deletions Microsoft.Azure.Cosmos/src/Regions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,5 +329,10 @@ public static class Regions
/// Name of the Azure Sweden South region in the Azure Cosmos DB service.
/// </summary>
public const string SwedenSouth = "Sweden South";

/// <summary>
/// Name of the Azure Qatar Central region in the Azure Cosmos DB service.
/// </summary>
public const string QatarCentral = "Qatar Central";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public async Task DirectPointOperationsWithTransportErrors()
ITrace trace = ((CosmosTraceDiagnostics)response.Diagnostics).Value;
SummaryDiagnostics summaryDiagnostics = new SummaryDiagnostics(trace);
Assert.AreEqual(summaryDiagnostics.DirectRequestsSummary.Value.Keys.Count, 2);
Assert.AreEqual(summaryDiagnostics.DirectRequestsSummary.Value[(410, 0)], 3);
Assert.AreEqual(summaryDiagnostics.DirectRequestsSummary.Value[(410, (int)SubStatusCodes.TransportGenerated410)], 3);
Assert.AreEqual(summaryDiagnostics.DirectRequestsSummary.Value[(201, 0)], 1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void ValidateTransportException(ResponseMessage responseMessage)
Assert.AreEqual(HttpStatusCode.ServiceUnavailable, responseMessage.StatusCode);
string message = responseMessage.ErrorMessage;
Assert.AreEqual(message, responseMessage.CosmosException.Message);
Assert.IsTrue(message.Contains("ServiceUnavailable (503); Substatus: 0; ActivityId:"));
Assert.IsTrue(message.Contains($"ServiceUnavailable (503); Substatus: {(int)SubStatusCodes.TransportGenerated503}; ActivityId:"));
Assert.IsTrue(message.Contains("Reason: (Message: Channel is closed"), "Should contain exception message");
string diagnostics = responseMessage.Diagnostics.ToString();
Assert.IsNotNull(diagnostics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,22 @@
"startTimeUtc": "2021-12-31T23:59:59.06Z",
"durationInMs": 0
}
]
],
"serviceEndpointStats": {
"inflightRequests": 2,
"openConnections": 1
},
"connectionStats": {
"waitforConnectionInit": "True",
"callsPendingReceive": 1,
"lastSendAttempt": "2021-12-31T23:59:59.059Z",
"lastSend": "2021-12-31T23:59:59.059Z",
"lastReceive": "2021-12-31T23:59:59.059Z"
},
"requestSizeInBytes": 2,
"requestBodySizeInBytes": 1,
"responseMetadataSizeInBytes": 1,
"responseBodySizeInBytes": 1
},
"TransportException": null
}
Expand Down Expand Up @@ -582,7 +597,22 @@
"startTimeUtc": "2021-12-31T23:59:59.06Z",
"durationInMs": 0
}
]
],
"serviceEndpointStats": {
"inflightRequests": 2,
"openConnections": 1
},
"connectionStats": {
"waitforConnectionInit": "True",
"callsPendingReceive": 1,
"lastSendAttempt": "2021-12-31T23:59:59.059Z",
"lastSend": "2021-12-31T23:59:59.059Z",
"lastReceive": "2021-12-31T23:59:59.059Z"
},
"requestSizeInBytes": 2,
"requestBodySizeInBytes": 1,
"responseMetadataSizeInBytes": 1,
"responseBodySizeInBytes": 1
},
"TransportException": null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ StoreResponse sendDirectFunc(Uri uri, ResourceOperation resourceOperation, Docum
Assert.Fail("There should only be 1 TCP request that triggers an address resolution.");
}

throw new GoneException(new TransportException(TransportErrorCode.ConnectFailed, null, Guid.NewGuid(), new Uri("http://one.com"), "description", true, true));
throw new GoneException(new TransportException(TransportErrorCode.ConnectFailed, null, Guid.NewGuid(), new Uri("http://one.com"), "description", true, true), SubStatusCodes.Unknown);
}

using CosmosClient client = MockCosmosUtil.CreateMockCosmosClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5832,6 +5832,11 @@
"Attributes": [],
"MethodInfo": "System.String NorwayWest;IsInitOnly:False;IsStatic:True;"
},
"System.String QatarCentral": {
"Type": "Field",
"Attributes": [],
"MethodInfo": "System.String QatarCentral;IsInitOnly:False;IsStatic:True;"
},
"System.String SouthAfricaNorth": {
"Type": "Field",
"Attributes": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ public void VerifyTransportExceptionToResponseMessage()
{
throw new ServiceUnavailableException(
message: errorMessage,
innerException: transportException);
innerException: transportException,
SubStatusCodes.Unknown);
}
catch (DocumentClientException exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ internal static void SetupServiceUnavailableException(
TransportAddressUri physicalUri)
{
mockTransportClient.Setup(x => x.InvokeResourceOperationAsync(physicalUri, It.IsAny<DocumentServiceRequest>()))
.Returns(() => throw new ServiceUnavailableException($"Mock write forbidden exception on URI:{physicalUri}", physicalUri.Uri));
.Returns(() => throw new ServiceUnavailableException($"Mock write forbidden exception on URI:{physicalUri}", SubStatusCodes.Unknown, physicalUri.Uri));
}

internal static void SetupRequestTimeoutException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,19 @@ internal static TransportRequestStats CreateTransportRequestStats()

field = transportRequestStats.GetType().GetField("requestCompletedTime", BindingFlags.NonPublic | BindingFlags.Instance);
field.SetValue(transportRequestStats, TimeSpan.FromMilliseconds(1));

transportRequestStats.RequestSizeInBytes = 2;
transportRequestStats.RequestBodySizeInBytes = 1;
transportRequestStats.ResponseBodySizeInBytes = 1;
transportRequestStats.ResponseMetadataSizeInBytes = 1;

transportRequestStats.NumberOfInflightRequestsToEndpoint = 2;
transportRequestStats.NumberOfOpenConnectionsToEndpoint = 1;
transportRequestStats.NumberOfInflightRequestsInConnection = 1;
transportRequestStats.RequestWaitingForConnectionInitialization = true;
transportRequestStats.ConnectionLastSendTime = defaultDateTime;
transportRequestStats.ConnectionLastSendAttemptTime = defaultDateTime;
transportRequestStats.ConnectionLastReceiveTime = defaultDateTime;
return transportRequestStats;
}

Expand Down

0 comments on commit 2e2a9cd

Please sign in to comment.