diff --git a/Directory.Build.props b/Directory.Build.props
index ab67057965..e6511c44de 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -4,7 +4,7 @@
3.28.0
3.28.0
preview
- 3.28.2
+ 3.29.0
1.0.1
1.0.1
preview
diff --git a/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationHelper.cs b/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationHelper.cs
index 3db0a128a6..1966a63f0f 100644
--- a/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationHelper.cs
+++ b/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationHelper.cs
@@ -384,7 +384,7 @@ public static void CheckTimeRangeIsCurrent(
RMResources.InvalidTokenTimeRange,
startDateTime.ToString("r", CultureInfo.InvariantCulture),
expiryDateTime.ToString("r", CultureInfo.InvariantCulture),
- DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture));
+ Rfc1123DateTimeCache.UtcNow());
DefaultTrace.TraceError(message);
@@ -482,7 +482,7 @@ public static int SerializeMessagePayload(
throw new UnauthorizedException(RMResources.InvalidDateHeader);
}
- headers[HttpConstants.HttpHeaders.XDate] = DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture);
+ headers[HttpConstants.HttpHeaders.XDate] = Rfc1123DateTimeCache.UtcNow();
xDate = AuthorizationHelper.GetHeaderValue(headers, HttpConstants.HttpHeaders.XDate);
}
@@ -662,7 +662,7 @@ private static void ValidateInputRequestTime(
RMResources.InvalidTokenTimeRange,
utcStartTime.ToString("r", CultureInfo.InvariantCulture),
DateTime.MaxValue.ToString("r", CultureInfo.InvariantCulture),
- DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture));
+ Rfc1123DateTimeCache.UtcNow());
DefaultTrace.TraceError(message);
diff --git a/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationTokenProvider.cs b/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationTokenProvider.cs
index 3a148c15dd..c9e98c5415 100644
--- a/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationTokenProvider.cs
+++ b/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationTokenProvider.cs
@@ -19,7 +19,7 @@ public async Task AddSystemAuthorizationHeaderAsync(
string verb,
string resourceId)
{
- request.Headers[HttpConstants.HttpHeaders.XDate] = DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture);
+ request.Headers[HttpConstants.HttpHeaders.XDate] = Rfc1123DateTimeCache.UtcNow();
request.Headers[HttpConstants.HttpHeaders.Authorization] = (await this.GetUserAuthorizationAsync(
resourceId ?? request.ResourceAddress,
diff --git a/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationTokenProviderMasterKey.cs b/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationTokenProviderMasterKey.cs
index 44fd0cfa71..5e9b871c13 100644
--- a/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationTokenProviderMasterKey.cs
+++ b/Microsoft.Azure.Cosmos/src/Authorization/AuthorizationTokenProviderMasterKey.cs
@@ -66,7 +66,7 @@ public AuthorizationTokenProviderMasterKey(string authKey)
AuthorizationTokenType tokenType)
{
// this is masterkey authZ
- headers[HttpConstants.HttpHeaders.XDate] = DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture);
+ headers[HttpConstants.HttpHeaders.XDate] = Rfc1123DateTimeCache.UtcNow();
string authorizationToken = AuthorizationHelper.GenerateKeyAuthorizationSignature(
requestVerb,
@@ -97,7 +97,7 @@ public override ValueTask GetUserAuthorizationTokenAsync(
ITrace trace)
{
// this is masterkey authZ
- headers[HttpConstants.HttpHeaders.XDate] = DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture);
+ headers[HttpConstants.HttpHeaders.XDate] = Rfc1123DateTimeCache.UtcNow();
string authorizationToken = AuthorizationHelper.GenerateKeyAuthorizationSignature(
requestVerb,
@@ -119,7 +119,7 @@ public override ValueTask AddAuthorizationHeaderAsync(
string verb,
AuthorizationTokenType tokenType)
{
- string dateTime = DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture);
+ string dateTime = Rfc1123DateTimeCache.UtcNow();
headersCollection[HttpConstants.HttpHeaders.XDate] = dateTime;
string token = AuthorizationHelper.GenerateKeyAuthorizationSignature(
diff --git a/Microsoft.Azure.Cosmos/src/DocumentClient.cs b/Microsoft.Azure.Cosmos/src/DocumentClient.cs
index b8e86fd03d..2508197b9b 100644
--- a/Microsoft.Azure.Cosmos/src/DocumentClient.cs
+++ b/Microsoft.Azure.Cosmos/src/DocumentClient.cs
@@ -5493,7 +5493,7 @@ private async Task> ExecuteStoredProcedurePrivat
AuthorizationTokenType.PrimaryMasterKey,
headers))
{
- request.Headers[HttpConstants.HttpHeaders.XDate] = DateTime.UtcNow.ToString("r");
+ request.Headers[HttpConstants.HttpHeaders.XDate] = Rfc1123DateTimeCache.UtcNow();
if (options?.PartitionKeyRangeId == null)
{
await this.AddPartitionKeyInformationAsync(
diff --git a/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj b/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj
index 56f802e368..c9bd7da317 100644
--- a/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj
+++ b/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj
@@ -116,7 +116,7 @@
-
+
diff --git a/Microsoft.Azure.Cosmos/src/Regions.cs b/Microsoft.Azure.Cosmos/src/Regions.cs
index 92ee6486d9..64729bd21a 100644
--- a/Microsoft.Azure.Cosmos/src/Regions.cs
+++ b/Microsoft.Azure.Cosmos/src/Regions.cs
@@ -316,7 +316,7 @@ public static class Regions
public const string JioIndiaWest = "Jio India West";
///
- /// Name of the Azure US SLV region in the Azure Cosmos DB service.
+ /// Name of the Azure East US SLV region in the Azure Cosmos DB service.
///
public const string EastUSSLV = "East US SLV";
@@ -334,5 +334,15 @@ public static class Regions
/// Name of the Azure Qatar Central region in the Azure Cosmos DB service.
///
public const string QatarCentral = "Qatar Central";
+
+ ///
+ /// Name of the Azure China North 3 region in the Azure Cosmos DB service.
+ ///
+ public const string ChinaNorth3 = "China North 3";
+
+ ///
+ /// Name of the Azure China East 3 region in the Azure Cosmos DB service.
+ ///
+ public const string ChinaEast3 = "China East 3";
}
}
diff --git a/Microsoft.Azure.Cosmos/src/Routing/ClientCollectionCache.cs b/Microsoft.Azure.Cosmos/src/Routing/ClientCollectionCache.cs
index 51553139b4..477060e4a7 100644
--- a/Microsoft.Azure.Cosmos/src/Routing/ClientCollectionCache.cs
+++ b/Microsoft.Azure.Cosmos/src/Routing/ClientCollectionCache.cs
@@ -178,7 +178,7 @@ private async Task ReadCollectionAsync(
AuthorizationTokenType.PrimaryMasterKey,
headers))
{
- headers.XDate = DateTime.UtcNow.ToString("r");
+ headers.XDate = Rfc1123DateTimeCache.UtcNow();
request.RequestContext.ClientRequestStatistics =
clientSideRequestStatistics ?? new ClientSideRequestStatisticsTraceDatum(DateTime.UtcNow);
diff --git a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs
index 1e5d6984e5..827cc79f67 100644
--- a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs
+++ b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs
@@ -485,7 +485,7 @@ private async Task GetMasterAddressesViaGatewayAsync(
string resourceTypeToSign = PathsHelper.GetResourcePath(resourceType);
- headers.Set(HttpConstants.HttpHeaders.XDate, DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture));
+ headers.Set(HttpConstants.HttpHeaders.XDate, Rfc1123DateTimeCache.UtcNow());
using (ITrace trace = Trace.GetRootTrace(nameof(GetMasterAddressesViaGatewayAsync), TraceComponent.Authorization, TraceLevel.Info))
{
string token = await this.tokenProvider.GetUserAuthorizationTokenAsync(
@@ -545,7 +545,7 @@ private async Task GetServerAddressesViaGatewayAsync(
string resourceTypeToSign = PathsHelper.GetResourcePath(ResourceType.Document);
- headers.Set(HttpConstants.HttpHeaders.XDate, DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture));
+ headers.Set(HttpConstants.HttpHeaders.XDate, Rfc1123DateTimeCache.UtcNow());
string token = null;
using (ITrace trace = Trace.GetRootTrace(nameof(GetMasterAddressesViaGatewayAsync), TraceComponent.Authorization, TraceLevel.Info))
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/NonPartitionedContainerHelper.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/NonPartitionedContainerHelper.cs
index 8eff325839..8748360c9a 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/NonPartitionedContainerHelper.cs
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/NonPartitionedContainerHelper.cs
@@ -181,7 +181,7 @@ private static string GenerateMasterKeyAuthorizationSignature(
private static string GetUtcDateTime()
{
- return DateTime.UtcNow.ToString("r");
+ return Rfc1123DateTimeCache.UtcNow();
}
}
}
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs
index 917cbcd0a7..09c2c76e61 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/TestCommon.cs
@@ -262,7 +262,7 @@ internal static void AddMasterAuthorizationHeader(this HttpClient client, string
if (string.IsNullOrEmpty(key)) throw new ArgumentException("key");
if (headers == null) throw new ArgumentNullException("headers");
- string xDate = DateTime.UtcNow.ToString("r");
+ string xDate = Rfc1123DateTimeCache.UtcNow();
client.DefaultRequestHeaders.Remove(HttpConstants.HttpHeaders.XDate);
client.DefaultRequestHeaders.Add(HttpConstants.HttpHeaders.XDate, xDate);
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/DateTimeAllocationsBenchmark.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/DateTimeAllocationsBenchmark.cs
new file mode 100644
index 0000000000..82b386c8f0
--- /dev/null
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/DateTimeAllocationsBenchmark.cs
@@ -0,0 +1,31 @@
+namespace Microsoft.Azure.Cosmos.Benchmarks
+{
+ using System;
+ using BenchmarkDotNet.Attributes;
+ using Microsoft.Azure.Documents;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Threading.Tasks;
+
+ [MemoryDiagnoser]
+ public class DateTimeAllocationsBenchmark
+ {
+ public DateTimeAllocationsBenchmark()
+ {
+ }
+
+ [Benchmark]
+ public void DateTimeToString()
+ {
+ _ = DateTime.UtcNow.ToString("r");
+ }
+
+ [Benchmark]
+ public void Rfc1123DateTimeCacheUtcNow()
+ {
+ _ = Rfc1123DateTimeCache.UtcNow();
+ }
+
+ }
+}
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/MasterKeyAuthorizationBenchmark.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/MasterKeyAuthorizationBenchmark.cs
index ceed2928e3..f3cd49b65d 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/MasterKeyAuthorizationBenchmark.cs
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Benchmarks/MasterKeyAuthorizationBenchmark.cs
@@ -20,7 +20,7 @@ public MasterKeyAuthorizationBenchmark()
{
this.authKeyHashFunction = new StringHMACSHA256Hash(MockDocumentClient.GenerateRandomKey());
Headers headers = new Headers();
- headers[HttpConstants.HttpHeaders.XDate] = DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture);
+ headers[HttpConstants.HttpHeaders.XDate] = Rfc1123DateTimeCache.UtcNow();
this.testHeaders = headers.CosmosMessageHeaders.INameValueCollection;
}
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Mocks/MockDocumentClient.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Mocks/MockDocumentClient.cs
index de77eafcd9..7c0346c866 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Mocks/MockDocumentClient.cs
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Mocks/MockDocumentClient.cs
@@ -135,7 +135,7 @@ ValueTask ICosmosAuthorizationTokenProvider.GetUserAuthorizationTokenAsy
ITrace trace) // unused, use token based upon what is passed in constructor
{
// this is masterkey authZ
- headers[HttpConstants.HttpHeaders.XDate] = DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture);
+ headers[HttpConstants.HttpHeaders.XDate] = Rfc1123DateTimeCache.UtcNow();
string authorization = AuthorizationHelper.GenerateKeyAuthorizationSignature(
verb: requestVerb,
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Authorization/AuthorizationHelperTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Authorization/AuthorizationHelperTests.cs
index d8fb29a892..1c4d19e732 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Authorization/AuthorizationHelperTests.cs
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Authorization/AuthorizationHelperTests.cs
@@ -9,6 +9,7 @@ namespace Microsoft.Azure.Cosmos.Tests.Authorization
using System.Globalization;
using System.Text;
using Microsoft.Azure.Cosmos;
+ using Microsoft.Azure.Documents;
using Microsoft.Azure.Documents.Collections;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -21,7 +22,7 @@ public class AuthorizationHelperTests
public void TestGenerateAuthorizationTokenWithHashCoreDoesNotEncodeUrl()
{
Mock mockHeaders = new Mock();
- mockHeaders.SetupGet(h => h["x-ms-date"]).Returns(DateTime.UtcNow.ToString("r", CultureInfo.InvariantCulture));
+ mockHeaders.SetupGet(h => h["x-ms-date"]).Returns(Rfc1123DateTimeCache.UtcNow());
Mock hashHelperMock = new Mock();
hashHelperMock.Setup(
ch => ch.ComputeHash(It.IsAny>()))
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs
index f44e5986ef..2634ea1bc3 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs
@@ -107,7 +107,7 @@ public void ProjectPackageDependenciesTest()
{ "System.Numerics.Vectors", new Version(4, 5, 0) },
{ "Newtonsoft.Json", new Version(10, 0, 2) },
{ "Microsoft.Bcl.AsyncInterfaces", new Version(1, 0, 0) },
- { "System.Configuration.ConfigurationManager", new Version(4, 7, 0) },
+ { "System.Configuration.ConfigurationManager", new Version(6, 0, 0) },
{ "System.Memory", new Version(4, 5, 4) },
{ "System.Buffers", new Version(4, 5, 1) },
{ "System.Runtime.CompilerServices.Unsafe", new Version(4, 6, 0) },
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json
index 3c6fb1a381..734e3656b8 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json
@@ -6314,6 +6314,11 @@
"Attributes": [],
"MethodInfo": "System.String ChinaEast2;IsInitOnly:False;IsStatic:True;"
},
+ "System.String ChinaEast3": {
+ "Type": "Field",
+ "Attributes": [],
+ "MethodInfo": "System.String ChinaEast3;IsInitOnly:False;IsStatic:True;"
+ },
"System.String ChinaNorth": {
"Type": "Field",
"Attributes": [],
@@ -6324,6 +6329,11 @@
"Attributes": [],
"MethodInfo": "System.String ChinaNorth2;IsInitOnly:False;IsStatic:True;"
},
+ "System.String ChinaNorth3": {
+ "Type": "Field",
+ "Attributes": [],
+ "MethodInfo": "System.String ChinaNorth3;IsInitOnly:False;IsStatic:True;"
+ },
"System.String EastAsia": {
"Type": "Field",
"Attributes": [],