Comments (11)
@ealsur I see, then we would still need a way of running the custom handler before the default one or removing it.
from azure-cosmos-dotnet-v3.
- What's the use case for multiple paths?
- Currently there are several dependencies that use this, but an issue can be created to track it..
- This is a good idea. Need to create an issue to track the feature request
- The type is required to deserialize the response stream to the object.
- I believe the rename will be the best option. We moved it to a parameter to make sure developers are aware of it, and for it to be easier to set.
- There currently is a bug that is preventing most partition key types and that will be fixed in the next release. We can definitely add more documentation to clarify the requirements.
- The CosmosConfiguration contains MaxRetryAttemptsOnThrottledRequests and MaxRetryWaitTimeOnThrottledRequests . Are there additional properties or settings that are needed?
- An issue can be created for this.
from azure-cosmos-dotnet-v3.
Add a constructor to PartitionKeyDefinition that accepts an IEnumerable of paths
- What's the use case for multiple paths?
The benefit of the constructor is the ability to create CosmosContainerSettings
in one expression:
var settings = new CosmosContainerSettings
{
Id = parameters.ContainerId,
PartitionKey = new PartitionKeyDefinition("/pk")
};
instead of
var pk = new PartitionKeyDefinition();
pk.Paths.Add("/pk");
var settings = new CosmosContainerSettings
{
Id = parameters.ContainerId,
PartitionKey = pk
};
Allow to provide a custom IDocumentClientRetryPolicy or provide a built in way of using exponential backoff.
- The CosmosConfiguration contains MaxRetryAttemptsOnThrottledRequests and MaxRetryWaitTimeOnThrottledRequests . Are there additional properties or settings that are needed?
For bursty highly parallelized workloads a more aggressive delay strategy could be required:
- Additional delay in the form of
c^n
wherec
is a user-specified value andn
is the current number of failed retry attempts - Additional random delay up to the specified amount
from azure-cosmos-dotnet-v3.
There doesn’t seem to be an advantage to have CosmosResponse.Resource be strongly typed, as the generic argument cannot always be inferred and frequently needs to be specified explicitly. Returning it as object makes using the methods like DeleteItemAsync<>() simpler as they won’t need the generic argument.
- The type is required to deserialize the response stream to the object.
In the case of DeleteItemAsync<T>
Resource
is always null
In cases where it isn't you can make deserialization lazy by changing Resource
property to a method - GetResource<T>()
from azure-cosmos-dotnet-v3.
- There is a constructor overload that takes in the path.
var settings = new CosmosContainerSettings(
id: "SampleContainer",
partitionKeyPath: "/pk");
In the case of DeleteItemAsync Resource is always null
In cases where it isn't you can make deserialization lazy by changing Resource property to a method - GetResource()
- The reason the typed is not lazy is we wanted avoid having everything implement IDisposable. The original response back from Cosmos contains a Stream that needs to be disposed. If we did a lazy deserialization then all the responses would need to wrapped in using statements in the scenario that the objects are never deserialized. This made basic applications look very complex and was very easy for developers to have memory leaks. If you need additional performance or want to do your own deserialization you can use the stream APIs.
For bursty highly parallelized workloads a more aggressive delay strategy could be required:
Additional delay in the form of c^n where c is a user-specified value and n is the current number of failed retry attempts
Additional random delay up to the specified amount
- We are planning to design a new retry system based on the handler pipeline that would allow custom retry handlers. We're still in the process of planning so I'm not sure when this will be worked on.
from azure-cosmos-dotnet-v3.
- The reason the typed is not lazy is we wanted avoid having everything implement IDisposable. The original response back from Cosmos contains a Stream that needs to be disposed. If we did a lazy deserialization then all the responses would need to wrapped in using statements in the scenario that the objects are never deserialized. This made basic applications look very complex and was very easy for developers to have memory leaks. If you need additional performance or want to do your own deserialization you can use the stream APIs.
The stream APIs response needs to be disposed anyway. If you established that all responses need to be disposed it would actually make it less likely for a developer to forget to do it as it would be consistent across all of your API and shown in all samples.
from azure-cosmos-dotnet-v3.
@AndriySvyryd @divega Re 7: You can apply your custom retry policy as a Handler, in our samples, there is one that covers using Polly: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos.Samples/CodeSamples/Handlers/ThrottlingHandler.cs
from azure-cosmos-dotnet-v3.
@ealsur Thanks, would that replace the built-in retry policy or would it run on top of it?
from azure-cosmos-dotnet-v3.
It would run on top of it. If the custom retry is covering a scenario the built-in retry handler already covers, then the default one will be applied first. V3 uses Retry handlers such as https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/Handler/RetryHandler.cs to apply the default retry policy. If no default retry handler exists to cover that case, then your custom handler would be the first responder.
from azure-cosmos-dotnet-v3.
Or expose the default one retry options, that would work too, just in the V2 SDK.
from azure-cosmos-dotnet-v3.
Please create specific issues for gaps if-any.
from azure-cosmos-dotnet-v3.
Related Issues (20)
- PatchItemAsync failing with HTTP400 when using CosmosPropertyNamingPolicy.CamelCase instead of [JsonProperty("id") HOT 9
- PkRangeStats
- [Thin Client Integration] Analyze and Implement Changes in Cosmos Diagnostics
- CF/P AVAD: Issues with Serialization/Deserialization with JsonSerializerOptions on Custom serializer and UseSystemTextJsonSerializerWithOptions.
- CFP AVAD: Add public access to FeedRange from ChangeFeedProcessorContext
- PartitionKey.None.GetHashCode() throws an ArgumentNullException HOT 4
- [BUG][Thin Client Integration] Fix Rntbd deserializer: Throwing exception when deserializing error responses HOT 1
- [Vector Index] Remove Unsupported Data Types from Embedding Contract
- [Cosmos Diagnostics] - Reverse the Network Interactions Order when Diagnostics is Truncated
- Cannot disable Analytical store in container (setting AnalyticalStoreTimeToLiveInSeconds to null has not effect) HOT 7
- Incomplete example documentation
- Prevent invalid characters in the Id property
- Availability: Improve fallback for 503 scenarios when ApplicationRegion is not set
- Binary Encoding - Add Support for Point Operations HOT 1
- Binary Encoding - Add Support for Change Feed Operations
- How to migrate partition key range statistics from v2 to v3 sdk
- Thank you HOT 1
- Extra w beneficts for you HOT 1
- System.IO.FileNotFoundException: Could not find file 'Microsoft.Azure.Cosmos.Direct.resources HOT 1
- Logic App Connector Cosmos DB: Issue with 429 Retries flooding the logs and overcharge for Application Insights. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-cosmos-dotnet-v3.