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

Cosmos DB: is CosmosExecutionStrategy applied for queries? #24343

Closed
alexeymarkov opened this issue Mar 8, 2021 · 6 comments
Closed

Cosmos DB: is CosmosExecutionStrategy applied for queries? #24343

alexeymarkov opened this issue Mar 8, 2021 · 6 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@alexeymarkov
Copy link

Hello,

currently I have to use EF 5.0.0-preview.3.20181.2 because EF Core 5 release is not working in Azure Functions.
And it seems CosmosExecutionStrategy is not applied when doing queries.
It is correct?
If yes, is it fixed in EF Core 5 release?

Regards,
Alexey Markov

@AndriySvyryd
Copy link
Member

There haven't been any specific changes for this since EF 5.0.0-preview.3, but note that the strategy will only retry 6 times by default and then fail. Enable logging to see whether this was the case.

@alexeymarkov
Copy link
Author

Logging is enabled. Default CosmosExecutionStrategy works well for SaveChangesAsync but not for DbSet.FindAsync and not for IQueryable.ToArrayAsync.
Is this by design?

I see Enumerator implementations in EFCore.Relational\Query\Internal respect Execution Strategy but I see nothing in EFCore.Cosmos\Query\Internal that would use Execution Strategy.

For me it looks like a bug.

@AndriySvyryd
Copy link
Member

AndriySvyryd commented Mar 9, 2021

@alexeymarkov You are right, CosmosExecutionStrategy doesn't handle queries, they are handled by the SDK's built-in retry policy as it allows to handle retries without pre-buffering the whole result set, we will expose more options in #23203

@alexeymarkov
Copy link
Author

So do you suggest disabling CosmosExecutingStrategy for SaveChangesAsync as it does not really make sense as there is a built-in retry in CosmosClient?

@AndriySvyryd
Copy link
Member

There could be a case for that, however the built-in policy doesn't always retry write operations https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/ClientRetryPolicy.cs#L313

@alexeymarkov
Copy link
Author

OK, thanks.
Currently I see the built-in policy fails in 3-5 seconds at my tests when querying data. But with CosmosExecutingStrategy write operations fail in 30-40 seconds. I am thinking about using CosmosExecutingStrategy for querying also...

@ajcvickers ajcvickers added the closed-no-further-action The issue is closed and no further action is planned. label Mar 12, 2021
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

3 participants