Skip to content

Conversation

@philipthomas-MSFT
Copy link
Contributor

Pull Request Template

Description

Description:

This PR adds a sample for the IsFeedRangePartOfAsync method on the Container class. The purpose of this sample is to demonstrate how to efficiently check whether one feed range is part of another within a Cosmos DB container. This method is crucial for scenarios that involve partitioned data, where comparisons between feed ranges are necessary for tasks such as incremental data migration, parallelization, or distributed queries.

The sample illustrates:

  • How to create a container with a partition key if it doesn't already exist.
  • How to use IsFeedRangePartOfAsync to compare two feed ranges (x and y) and determine if one is part of the other.
  • Practical use cases for checking feed range overlap, such as ensuring data integrity during partitioned operations or efficiently managing feed range comparisons in large datasets.

By providing this sample, developers can better understand how to leverage feed ranges when working with Cosmos DB, leading to more efficient data processing and partition management.

#4566

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] This change requires a documentation update

Closing issues

To automatically close an issue: closes #IssueNumber

// specific value, then the second range should be part of the first.
await Program.GivenContainerWithPartitionKeyExists_WhenFeedRangesAreCompared_ThenResultShouldBeAsExpected(
database: database,
x: FeedRange.FromJsonString(toStringValue: "{\"Range\":{\"min\":\"\",\"max\":\"FFFFFFFFFFFFFFFF\"}}"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ideal use-case application will not set random FeedRange but gets it from one of the client APIs.
So idea is to have a scenario E2E such that the FeedRange is read from client API and then feed into IsFeedRangePartOfAsync API

Copy link
Contributor Author

@philipthomas-MSFT philipthomas-MSFT Oct 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In ideal use-case application will not set random FeedRange but gets it from one of the client APIs.
So idea is to have a scenario E2E such that the FeedRange is read from client API and then feed into
IsFeedRangePartOfAsync API

@kirankumarkolli I disagree. I would have to set up a sample that mimics how a specific customer wants to use this. I am showcasing the new capability, not trying to reproduce every variation someone wants to use it.

Ex. Create a ChangeFeedProcessor, read FeedRange from the ChangeFeedContext, read FeedRanges (bookmarks) from another Container and validate using IsFeedRangePartOfAsync. This is too much for a sample that is supposed to be agnostic and totally disconnected from one customer's use case scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new direction for sample.

NaluTripician
NaluTripician previously approved these changes Oct 10, 2024
kundadebdatta
kundadebdatta previously approved these changes Oct 14, 2024
Copy link
Member

@kundadebdatta kundadebdatta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

auto-merge was automatically disabled March 8, 2025 21:36

Pull request was closed

@github-project-automation github-project-automation bot moved this from In Progress to Done in Azure Cosmos SDKs Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Enables automation to merge PRs

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants