-
Notifications
You must be signed in to change notification settings - Fork 494
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
ChangeFeed : Adds ChangeFeedStartFrom to support StartTimes x FeedRanges #1725
Conversation
https://github.com/Azure/azure-cosmos-dotnet-v3 into revert-1684-users/jawilley/contract/changefeed_revert
Microsoft.Azure.Cosmos/src/RequestOptions/ChangeFeedRequestOptions.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/ResultSetIteratorUtils.cs
Outdated
Show resolved
Hide resolved
Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Utils/ResultSetIteratorUtils.cs
Outdated
Show resolved
Hide resolved
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/StandByFeedContinuationTokenTests.cs
Show resolved
Hide resolved
Debug.Assert(activityScope != null && | ||
(operationType != OperationType.SqlQuery || operationType != OperationType.Query || operationType != OperationType.QueryPlan), | ||
"There should be an activity id already set"); | ||
//Debug.Assert(activityScope != null && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which scenarios void this assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually looks like a bug I introduced. I will send out a fix later today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We run all tests in release mode, so adding a debug assert doesn't actually do anything. We should add code analysis to avoid this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix is merged in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the public examples on the Container.cs file with the new API
…github.com/Azure/azure-cosmos-dotnet-v3 into users/brchon/ChangeFeed/StartFromFeedRange
Closing due to in-activity, pease feel free to re-open. |
Internal ChangeFeed : Adds StartFrom x FeedRange
Description
This PR removes FeedRange from ChangeFeedRequestOptions and instead moves it as a cross product to StartFrom. This is to avoid a user setting a continuation token (that already has the FeedRange) with another FeedRange. The full details for that can be found here: #1686.
This implies that we need to remove the PartitionKey + ChangeFeedRequestOptions overloads, since users might set PartitionKey and the FeedRange in ChangeFeedRequestOptions, which is ambigious for which should win. This implies that FeedRange needs a static constructor for users to create a FeedRange that points to a single logical partition:
public static FeedRange CreateFromPartitionKey(PartitionKey partitionKey) => new FeedRangePartitionKey(partitionKey);
With that in mind the current API for StartFrom looks like this:
Which is a slight variation from what is proposed in the github issue. It opts for additional methods instead of overloads or optional parameters. This is to make the intellisense on the public API more clear and also allows for non compile time default values (like EpkRange.FullRange).
The ChangeFeed API now looks like this:
With
ChangeFeedStartFrom
as a required field. This eliminates ambiguous defaults.A new derived class from start from was also added (StartFromContinuationAndFeedRange), which is not exposed to the user. Essentially a user will pass in StartFromContinuation and we will deserialize and convert it to a StartFromContinuationAndFeedRange.