From 64ff614212bc6d227816d9797ea2ae07a72e5abe Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 13 Jun 2023 11:46:51 -0700 Subject: [PATCH 1/7] Setting EnableODE to true by default in Preview Mode. --- .../src/RequestOptions/QueryRequestOptions.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs index 4cca513013..f445f25719 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs @@ -49,7 +49,11 @@ public class QueryRequestOptions : RequestOptions /// /// Direct (optimistic) execution offers improved performance for several kinds of queries such as a single partition streaming query. /// - public bool EnableOptimisticDirectExecution { get; set; } + #if PREVIEW + public bool EnableOptimisticDirectExecution { get; set; } = true; + #else + internal bool EnableOptimisticDirectExecution { get; set; } + #endif /// /// Gets or sets the maximum number of items that can be buffered client side during From c08d553a46eab48c9f724ebc5bfde3d6637d0291 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 13 Jun 2023 13:16:53 -0700 Subject: [PATCH 2/7] Added seperate if block for default value --- .../src/RequestOptions/QueryRequestOptions.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs index f445f25719..a4e40403eb 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs @@ -50,9 +50,14 @@ public class QueryRequestOptions : RequestOptions /// Direct (optimistic) execution offers improved performance for several kinds of queries such as a single partition streaming query. /// #if PREVIEW - public bool EnableOptimisticDirectExecution { get; set; } = true; + public #else - internal bool EnableOptimisticDirectExecution { get; set; } + internal + #endif + bool EnableOptimisticDirectExecution { get; set; } + + #if PREVIEW + this.EnableOptimisticDirectExecution = true; #endif /// From 18de68b93e7f2c261ee30b98c03fe20a1598006a Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 13 Jun 2023 15:30:47 -0700 Subject: [PATCH 3/7] Updated property --- .../src/RequestOptions/QueryRequestOptions.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs index a4e40403eb..a68a36ff82 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs @@ -5,6 +5,7 @@ namespace Microsoft.Azure.Cosmos { using System; + using System.Runtime.CompilerServices; using System.Text; using Microsoft.Azure.Cosmos.CosmosElements; using Microsoft.Azure.Cosmos.Query.Core; @@ -54,12 +55,13 @@ public class QueryRequestOptions : RequestOptions #else internal #endif - bool EnableOptimisticDirectExecution { get; set; } - - #if PREVIEW - this.EnableOptimisticDirectExecution = true; - #endif - + bool EnableOptimisticDirectExecution { get; set; } = + #if PREVIEW + true + #else + false + #endif + ; /// /// Gets or sets the maximum number of items that can be buffered client side during /// parallel query execution in the Azure Cosmos DB service. From 7be39e9494eb3261d1d556d4955a8fc7185e60cb Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 13 Jun 2023 15:41:44 -0700 Subject: [PATCH 4/7] Removed unused Usings --- Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs index a68a36ff82..29dc6e806e 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs @@ -5,7 +5,6 @@ namespace Microsoft.Azure.Cosmos { using System; - using System.Runtime.CompilerServices; using System.Text; using Microsoft.Azure.Cosmos.CosmosElements; using Microsoft.Azure.Cosmos.Query.Core; From 1c85dad5a084352ad446d76400a0532dffabb651 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 13 Jun 2023 17:11:42 -0700 Subject: [PATCH 5/7] Updated contracts --- .../TraceWriterBaselineTests.TraceData.xml | 10 ++-- .../Contracts/DotNetPreviewSDKAPI.json | 53 ++++++++++++++++++- .../Contracts/DotNetSDKAPI.json | 38 ------------- ...misticDirectExecutionQueryBaselineTests.cs | 2 +- 4 files changed, 58 insertions(+), 45 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/TraceWriterBaselineTests.TraceData.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/TraceWriterBaselineTests.TraceData.xml index 885699cb43..d1dee72a0f 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/TraceWriterBaselineTests.TraceData.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/TraceWriterBaselineTests.TraceData.xml @@ -341,10 +341,10 @@ "RetryAfterInMs": "9000", "BELatencyInMs": "4.2", "ReplicaHealthStatuses": [ - "http://storephysicaladdress-1p.com:Connected", - "http://storephysicaladdress-2s.com:Unknown", - "http://storephysicaladdress-3s.com:Unhealthy", - "http://storephysicaladdress-4s.com:Unknown" + "http://storephysicaladdress-1p.com:Connected", + "http://storephysicaladdress-2s.com:Unknown", + "http://storephysicaladdress-3s.com:Unhealthy", + "http://storephysicaladdress-4s.com:Unknown" ], "transportRequestTimeline": { "requestTimeline": [ @@ -535,7 +535,7 @@ "RequestCharge": 0, "RetryAfterInMs": null, "BELatencyInMs": null, - "ReplicaHealthStatuses":[], + "ReplicaHealthStatuses": [], "transportRequestTimeline": null, "TransportException": null } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json index de49584da2..8546a93b2f 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json @@ -496,8 +496,59 @@ }, "NestedTypes": {} }, - "Microsoft.Azure.Cosmos.RequestOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Microsoft.Azure.Cosmos.QueryRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, + "Members": { + "Boolean EnableOptimisticDirectExecution": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "Boolean EnableOptimisticDirectExecution;CanRead:True;CanWrite:True;Boolean get_EnableOptimisticDirectExecution();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EnableOptimisticDirectExecution(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Boolean get_EnableOptimisticDirectExecution()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Boolean get_EnableOptimisticDirectExecution();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_EnableOptimisticDirectExecution(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_EnableOptimisticDirectExecution(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, + "Microsoft.Azure.Cosmos.RequestOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": { + "Microsoft.Azure.Cosmos.QueryRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Boolean EnableOptimisticDirectExecution": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "Boolean EnableOptimisticDirectExecution;CanRead:True;CanWrite:True;Boolean get_EnableOptimisticDirectExecution();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EnableOptimisticDirectExecution(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Boolean get_EnableOptimisticDirectExecution()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Boolean get_EnableOptimisticDirectExecution();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_EnableOptimisticDirectExecution(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_EnableOptimisticDirectExecution(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + } + }, "Members": { "System.Nullable`1[Microsoft.Azure.Cosmos.PriorityLevel] get_PriorityLevel()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", 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 8a3bc7b462..e5b95a7ed9 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 @@ -6279,18 +6279,6 @@ "Microsoft.Azure.Cosmos.QueryRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { - "Boolean EnableOptimisticDirectExecution": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "Boolean EnableOptimisticDirectExecution;CanRead:True;CanWrite:True;Boolean get_EnableOptimisticDirectExecution();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EnableOptimisticDirectExecution(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Boolean get_EnableOptimisticDirectExecution()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Boolean get_EnableOptimisticDirectExecution();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "Microsoft.Azure.Cosmos.DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions": { "Type": "Property", "Attributes": [], @@ -6445,13 +6433,6 @@ ], "MethodInfo": "Void set_EnableLowPrecisionOrderBy(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "Void set_EnableOptimisticDirectExecution(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_EnableOptimisticDirectExecution(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "Void set_EnableScanInQuery(System.Nullable`1[System.Boolean])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ @@ -7320,18 +7301,6 @@ "Microsoft.Azure.Cosmos.QueryRequestOptions;Microsoft.Azure.Cosmos.RequestOptions;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { - "Boolean EnableOptimisticDirectExecution": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "Boolean EnableOptimisticDirectExecution;CanRead:True;CanWrite:True;Boolean get_EnableOptimisticDirectExecution();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_EnableOptimisticDirectExecution(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Boolean get_EnableOptimisticDirectExecution()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Boolean get_EnableOptimisticDirectExecution();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "Microsoft.Azure.Cosmos.DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions": { "Type": "Property", "Attributes": [], @@ -7486,13 +7455,6 @@ ], "MethodInfo": "Void set_EnableLowPrecisionOrderBy(System.Nullable`1[System.Boolean]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, - "Void set_EnableOptimisticDirectExecution(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { - "Type": "Method", - "Attributes": [ - "CompilerGeneratedAttribute" - ], - "MethodInfo": "Void set_EnableOptimisticDirectExecution(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, "Void set_EnableScanInQuery(System.Nullable`1[System.Boolean])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { "Type": "Method", "Attributes": [ diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs index fad65e80db..7918142ab2 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs @@ -147,7 +147,7 @@ public async Task TestDefaultQueryRequestOptionsSettings() QueryRequestOptions requestOptions = new QueryRequestOptions(); - Assert.AreEqual(requestOptions.EnableOptimisticDirectExecution, false); + Assert.AreEqual(false, requestOptions.EnableOptimisticDirectExecution); } // test checks that the pipeline can take a query to the backend and returns its associated document(s). From 7b21f37afd3343f5eae9c6594b7111836d187b23 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Tue, 13 Jun 2023 22:58:10 -0700 Subject: [PATCH 6/7] Updated test --- .../OptimisticDirectExecutionQueryBaselineTests.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs index 7918142ab2..b134f95fde 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs @@ -144,10 +144,15 @@ public void NegativeOptimisticDirectExecutionOutput() [TestMethod] public async Task TestDefaultQueryRequestOptionsSettings() { - QueryRequestOptions requestOptions = new QueryRequestOptions(); - - Assert.AreEqual(false, requestOptions.EnableOptimisticDirectExecution); + bool odeExpectedValue = + #if PREVIEW + true + #else + false + #endif + ; + Assert.AreEqual(odeExpectedValue, requestOptions.EnableOptimisticDirectExecution); } // test checks that the pipeline can take a query to the backend and returns its associated document(s). From d1560bb2ba71570e3739360191a23ffb5f319692 Mon Sep 17 00:00:00 2001 From: Aditya Kotalwar Date: Wed, 14 Jun 2023 00:29:11 -0700 Subject: [PATCH 7/7] Updated directive indentation --- .../src/RequestOptions/QueryRequestOptions.cs | 18 ++++++++---------- ...imisticDirectExecutionQueryBaselineTests.cs | 12 ++++++------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs index 29dc6e806e..60cea5b48c 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs @@ -49,18 +49,16 @@ public class QueryRequestOptions : RequestOptions /// /// Direct (optimistic) execution offers improved performance for several kinds of queries such as a single partition streaming query. /// - #if PREVIEW +#if PREVIEW public - #else +#else internal - #endif - bool EnableOptimisticDirectExecution { get; set; } = - #if PREVIEW - true - #else - false - #endif - ; +#endif + bool EnableOptimisticDirectExecution { get; set; } +#if PREVIEW + = true; +#endif + /// /// Gets or sets the maximum number of items that can be buffered client side during /// parallel query execution in the Azure Cosmos DB service. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs index b134f95fde..b3ae18d2d6 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/OptimisticDirectExecutionQueryBaselineTests.cs @@ -146,12 +146,12 @@ public async Task TestDefaultQueryRequestOptionsSettings() { QueryRequestOptions requestOptions = new QueryRequestOptions(); bool odeExpectedValue = - #if PREVIEW - true - #else - false - #endif - ; +#if PREVIEW + true; +#else + false; +#endif + Assert.AreEqual(odeExpectedValue, requestOptions.EnableOptimisticDirectExecution); }