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

Change Feed Processor: Adds support for Graph API accounts #2491

Merged
merged 8 commits into from
May 27, 2021

Conversation

ealsur
Copy link
Member

@ealsur ealsur commented May 21, 2021

Description

Graph API accounts are allowed to perform operations through the SQL API and as such, can also read the Change Feed.

Change Feed Processor uses a Lease Container that has, by default, a Partition Key Definition of /id . But /id is not allowed in Graph API accounts, so Graph API users could not leverage Change Feed Processor even though they could do any SQL API operation.

Azure/azure-documentdb-changefeedprocessor-dotnet#158 added Graph API support to the V2 Change Feed Processor.

This PR aims to port the same capability to V3 SDK to allow for users to migrate from V2 to V3 without any blocking issues.

The PR does not modify the public surface but just enables users to use Lease Containers that are partitioned by /id (current behavior) or partitioned by /partitionKey (valid in Graph API accounts). The internal implementations will detect the path and generate the extra attribute on the leases in case it is needed.

Strategic value

Since we are also migrating Azure Functions to V3 SDK (Azure/azure-webjobs-sdk-extensions#717) this will also mean that it would enable Azure Functions Triggers to be used on Graph API accounts, which was not previously possible.

Key changes

The PR introduces a new implementation of RequestOptionsFactory, so based on the Lease Container partition key definition, the CFP builder uses a different Factory implementation. The current PartitionedByIdCollectionRequestOptionsFactory or the new PartitionedByPartitionKeyCollectionRequestOptionsFactory and the difference is one uses the value of the id as PartitionKey and the other, the value of the partitionKey, and one does not add the PartitionKey property to lease documents (default), while the other does.

Misc

Besides adding new sets of tests to cover the new behavior, the PR adds new tests for pre-existing APIs that had no test coverage and improves test run time (decreasing Emulator tests time) by using ManualResetEvent instead of waiting pre-defined amount of time on CFP tests.

Type of change

  • New feature (non-breaking change which adds functionality)

Closing issues

Closes #2291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ChangeFeed feature-request New feature or request
Projects
None yet
3 participants