Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: Refactors Optimistic Direct Execution to be turned on by default on .NET SDK #4225

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c5afef5
Turned on ODe by default
akotalwar Dec 21, 2023
1829fac
update subpartitioning tests to include ODE
NaluTripician Jan 2, 2024
1bac380
Updated contracts
akotalwar Jan 3, 2024
caf86c6
Merge branch 'users/akotalwar/TurnOnODEByDefault' of https://github.c…
akotalwar Jan 3, 2024
2fe5471
adds multihash test cases
NaluTripician Jan 3, 2024
f1aae84
Updated client serialization test output
akotalwar Jan 3, 2024
fa4b47f
Merge branch 'users/akotalwar/TurnOnODEByDefault' of https://github.c…
akotalwar Jan 3, 2024
492425c
Updated OffsetLimitPageSize() test
akotalwar Jan 4, 2024
255d13b
Revert changes to Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos…
akotalwar Jan 4, 2024
f4514db
Updated EndToEndTraceWriterBaselineTests.ReadManyAsync baseline test
akotalwar Jan 4, 2024
094e886
Removed account details
akotalwar Jan 5, 2024
cc1db80
Updated performance benchmark results
akotalwar Jan 5, 2024
ab69838
Merge branch 'master' into users/akotalwar/TurnOnODEByDefault
akotalwar Jan 6, 2024
4fb4163
Set enableODE to true for some of the tests
akotalwar Jan 10, 2024
badcfd0
Merge branch 'users/akotalwar/TurnOnODEByDefault' of https://github.c…
akotalwar Jan 10, 2024
eb85e34
Updated Feed token tests to test ODE and non ODE cases
akotalwar Jan 10, 2024
426f6b0
Added ODE testing for Session token regression test
akotalwar Jan 12, 2024
8f0ce41
Updated AggregateQueryTests() and CosmosMultiHashTest()
akotalwar Jan 12, 2024
e30479f
Reverted changes to OffsetLimitPageSize()
akotalwar Jan 13, 2024
a8e01e8
Added ODE testing to AggregateFunctionAsync()
akotalwar Jan 15, 2024
53ed6dc
Removed account details from baseline tests
akotalwar Jan 15, 2024
0110e90
Added assert to confirm that the right document is being returned eve…
akotalwar Jan 16, 2024
07e1a9e
Merge branch 'master' into users/akotalwar/TurnOnODEByDefault
akotalwar Jan 16, 2024
ac55208
Updated location of foreach loop for ODE
akotalwar Jan 16, 2024
2e2e35a
Merge branch 'users/akotalwar/TurnOnODEByDefault' of https://github.c…
akotalwar Jan 16, 2024
ddea7d0
Updated baselines
akotalwar Jan 17, 2024
5af47e4
Merge branch 'master' into users/akotalwar/TurnOnODEByDefault
akotalwar Jan 17, 2024
0918378
Fixed comments
akotalwar Jan 19, 2024
021cad9
Merge branch 'users/akotalwar/TurnOnODEByDefault' of https://github.c…
akotalwar Jan 19, 2024
2b068e0
Cleaned up code
akotalwar Jan 19, 2024
78ea0e4
Merge branch 'master' into users/akotalwar/TurnOnODEByDefault
akotalwar Jan 19, 2024
131112c
Fixed baselines
akotalwar Jan 19, 2024
f84c9d9
Merge branch 'users/akotalwar/TurnOnODEByDefault' of https://github.c…
akotalwar Jan 19, 2024
4ebd3a8
Updated more baselines
akotalwar Jan 19, 2024
3d3c7f7
Merge branch 'master' into users/akotalwar/TurnOnODEByDefault
akotalwar Jan 19, 2024
cd871ad
Setting QueryRequestRateTest() to not use ODE
akotalwar Jan 22, 2024
ede9b21
Merge branch 'users/akotalwar/TurnOnODEByDefault' of https://github.c…
akotalwar Jan 22, 2024
d4df81c
Merge branch 'master' into users/akotalwar/TurnOnODEByDefault
akotalwar Jan 23, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,7 @@ public class QueryRequestOptions : RequestOptions
/// <value>
/// Direct (optimistic) execution offers improved performance for several kinds of queries such as a single partition streaming query.
/// </value>
#if PREVIEW
public
#else
internal
#endif
bool EnableOptimisticDirectExecution { get; set; }
#if PREVIEW
= true;
#endif
public bool EnableOptimisticDirectExecution { get; set; } = true;
akotalwar marked this conversation as resolved.
Show resolved Hide resolved
akotalwar marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Gets or sets the maximum number of items that can be buffered client side during
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ public async Task QueryRequestRateTest(bool directMode)
{
MaxItemCount = 1,
MaxConcurrency = 1,
#if PREVIEW
EnableOptimisticDirectExecution = false
#endif
}))
{
while (feedIterator.HasMoreResults)
Expand Down Expand Up @@ -271,9 +269,7 @@ public async Task QueryRequestRateTest(bool directMode)
{
MaxItemCount = 1,
MaxConcurrency = 1,
#if PREVIEW
EnableOptimisticDirectExecution = false
#endif
});

// First request should be a success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ public async Task QueryPlanRetryTimeoutTestAsync()

QueryRequestOptions requestOptions = new QueryRequestOptions()
{
#if PREVIEW
EnableOptimisticDirectExecution = false
akotalwar marked this conversation as resolved.
Show resolved Hide resolved
#endif
};

using FeedIterator<JObject> iterator = gatewayQueryPlanContainer.GetItemQueryIterator<JObject>("select * From T order by T.status", requestOptions: requestOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,7 @@ public async Task InvalidSessionTokenAfterContainerRecreationAndCollectionCacheR
{
ConsistencyLevel = Cosmos.ConsistencyLevel.Session,
PartitionKey = new Cosmos.PartitionKey(pk),
#if PREVIEW
EnableOptimisticDirectExecution = false
#endif
});
int itemCountOldContainer = 0;
while (queryIteratorOldContainer.HasMoreResults)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ public async Task TestQueryWithCustomJsonSerializer()
fromStreamCount = 0;

FeedIterator<ToDoActivity> itemIterator = container.GetItemQueryIterator<ToDoActivity>(
query
#if PREVIEW
, requestOptions: new QueryRequestOptions() { EnableOptimisticDirectExecution = false }
#endif
query,
requestOptions: new QueryRequestOptions() { EnableOptimisticDirectExecution = false }
);
List<ToDoActivity> items = new List<ToDoActivity>();
while (itemIterator.HasMoreResults)
Expand All @@ -117,10 +115,8 @@ public async Task TestQueryWithCustomJsonSerializer()

// Verify that the custom serializer is actually being used via stream
FeedIterator itemStreamIterator = container.GetItemQueryStreamIterator(
query
#if PREVIEW
, requestOptions: new QueryRequestOptions() { EnableOptimisticDirectExecution = false }
#endif
query,
requestOptions: new QueryRequestOptions() { EnableOptimisticDirectExecution = false }
);
while (itemStreamIterator.HasMoreResults)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,8 @@ public async Task InexistentPKRangeId()
FeedIterator<ToDoActivity> feedIterator = container.GetItemQueryIterator<ToDoActivity>(
queryDefinition: new QueryDefinition("select * from T where STARTSWITH(T.id, \"BasicItem\")"),
feedRange: feedRange,
continuationToken: null

#if PREVIEW
, requestOptions: new QueryRequestOptions() { EnableOptimisticDirectExecution = false }
#endif
continuationToken: null,
requestOptions: new QueryRequestOptions() { EnableOptimisticDirectExecution = false }
);

CosmosException exception = await Assert.ThrowsExceptionAsync<CosmosException>(() => feedIterator.ReadNextAsync());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,7 @@ public static Func<bool, IQueryable<T>> GenerateTestCosmosData<T>(Func<Random, T
FeedOptions feedOptions = new FeedOptions() { EnableScanInQuery = true, EnableCrossPartitionQuery = true };
QueryRequestOptions requestOptions = new QueryRequestOptions()
{
#if PREVIEW
EnableOptimisticDirectExecution = false
akotalwar marked this conversation as resolved.
Show resolved Hide resolved
#endif
};
akotalwar marked this conversation as resolved.
Show resolved Hide resolved

IOrderedQueryable<T> query = container.GetItemLinqQueryable<T>(allowSynchronousQueryExecution: true, requestOptions: requestOptions);
Expand Down Expand Up @@ -350,9 +348,7 @@ public static Func<bool, IQueryable<T>> GenerateSerializationTestCosmosData<T>(F
FeedOptions feedOptions = new FeedOptions() { EnableScanInQuery = true, EnableCrossPartitionQuery = true };
QueryRequestOptions requestOptions = new QueryRequestOptions()
{
#if PREVIEW
EnableOptimisticDirectExecution = false
akotalwar marked this conversation as resolved.
Show resolved Hide resolved
#endif
};

CosmosLinqSerializerOptions linqSerializerOptions = new CosmosLinqSerializerOptions { PropertyNamingPolicy = camelCaseSerialization ? CosmosPropertyNamingPolicy.CamelCase : CosmosPropertyNamingPolicy.Default };
Expand Down Expand Up @@ -538,9 +534,7 @@ public static Func<bool, IQueryable<Data>> GenerateSimpleCosmosData(Cosmos.Datab
FeedOptions feedOptions = new FeedOptions() { EnableScanInQuery = true, EnableCrossPartitionQuery = true };
QueryRequestOptions requestOptions = new QueryRequestOptions()
{
#if PREVIEW
EnableOptimisticDirectExecution = false
akotalwar marked this conversation as resolved.
Show resolved Hide resolved
#endif
};

IOrderedQueryable<Data> query = container.GetItemLinqQueryable<Data>(allowSynchronousQueryExecution: true, requestOptions: requestOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1221,9 +1221,7 @@ public void TestSelectTop()
List<DataObject> data = generatedData.Item2;
QueryRequestOptions requestOptions = new QueryRequestOptions()
{
#if PREVIEW
EnableOptimisticDirectExecution = false
akotalwar marked this conversation as resolved.
Show resolved Hide resolved
#endif
};

IOrderedQueryable<DataObject> query = testContainer.GetItemLinqQueryable<DataObject>(allowSynchronousQueryExecution: true, requestOptions: requestOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ async Task ImplementationAsync(
new QueryRequestOptions()
{
MaxConcurrency = maxDoP,
#if PREVIEW
EnableOptimisticDirectExecution = false
#endif
});

if (argument.ExpectedValue == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,7 @@ static async Task ImplementationAsync(Container container, IReadOnlyList<CosmosO
MaxBufferedItemCount = 7000,
MaxConcurrency = 10,
MaxItemCount = 10,
#if PREVIEW
EnableOptimisticDirectExecution = false
akotalwar marked this conversation as resolved.
Show resolved Hide resolved
#endif
};

string compositeAggregate = "SELECT COUNT(1) + 5 FROM c";
Expand Down Expand Up @@ -696,9 +694,7 @@ async Task ImplementationAsync(Container container, IReadOnlyList<CosmosObject>
MaxBufferedItemCount = 7000,
MaxConcurrency = maxDegreeOfParallelism,
MaxItemCount = maxItemCount,
#if PREVIEW
EnableOptimisticDirectExecution = false
akotalwar marked this conversation as resolved.
Show resolved Hide resolved
#endif
};

async Task<List<CosmosElement>> AssertPassthroughAsync(string query, Cosmos.PartitionKey? pk = default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,7 @@ public async Task QueryAsync()
List<Input> inputs = new List<Input>();
QueryRequestOptions requestOptions = new QueryRequestOptions()
{
#if PREVIEW
EnableOptimisticDirectExecution = false
#endif
EnableOptimisticDirectExecution = false
};

int startLineNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,7 @@ public void NegativeOptimisticDirectExecutionOutput()
public void TestDefaultQueryRequestOptionsSettings()
{
QueryRequestOptions requestOptions = new QueryRequestOptions();
bool odeExpectedValue =
#if PREVIEW
true;
#else
false;
#endif

bool odeExpectedValue = true;
Assert.AreEqual(odeExpectedValue, requestOptions.EnableOptimisticDirectExecution);
}

Expand Down
Loading