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 backward compatibility of lease store #1733

Merged
merged 5 commits into from
Jul 29, 2020

Conversation

ealsur
Copy link
Member

@ealsur ealsur commented Jul 28, 2020

Description

Current state

Currently V3 Change Feed Processor is compatible with V2 Change Feed Processor by doing a forward migration of the schema to the schema used in V3.

Lease schema for V2 CFP

{
    "id": "<lease-id>",
    "PartitionId": "<partition-key-range-id>",
    "Owner": "<some-owner>",
    "ContinuationToken": "<some-continuation>",
}

Lease schema for V3 CFP

{
    "id": "<lease-id>",
    "LeaseToken": "<partition-key-range-id>",
    "Owner": "<some-owner>",
    "ContinuationToken": "<some-continuation>",
}

The V3 SDK performs the in-place migration by removing the PartitionId property and replacing it for the future-proof LeaseToken (for then leases can be created in a different granularity level from partitions).

Problem

The problem is that if the user wants to rollback (return to V2) for whatever reason (maybe rollback the deployment), then the schema is not compatible and they are locked in.

Solution

This PR makes it so the SDK will maintain the PartitionId attribute only if it was previously there (coming from V2) so if the user goes back to V2, the V2 CFP can continue processing. The value of PartitionId will be the same as LeaseToken.

Type of change

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

Closing issues

Closes #1722

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Please follow the required format: "[Internal] Category: (Adds|Fixes|Refactors) Description"

Examples:
Diagnostics: Adds GetElapsedClientLatency to CosmosDiagnostics
PartitionKey: Fixes null reference when using default(PartitionKey)
[v4] Client Encryption: Refactors code to external project
[Internal] Query: Adds code generator for CosmosNumbers for easy additions in the future.

@ealsur ealsur changed the title Change Feed Processor: Adding backward compatibility of lease store Change Feed Processor: Adds backward compatibility of lease store Jul 28, 2020
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Please follow the required format: "[Internal] Category: (Adds|Fixes|Refactors) Description"

Examples:
Diagnostics: Adds GetElapsedClientLatency to CosmosDiagnostics
PartitionKey: Fixes null reference when using default(PartitionKey)
[v4] Client Encryption: Refactors code to external project
[Internal] Query: Adds code generator for CosmosNumbers for easy additions in the future.

@github-actions github-actions bot dismissed stale reviews from themself July 28, 2020 17:07

All good!

@ealsur ealsur merged commit 55fb8ef into master Jul 29, 2020
@ealsur ealsur deleted the users/ealsur/cfpbackward branch July 29, 2020 17:54
@ghost
Copy link

ghost commented Dec 15, 2021

Closing due to in-activity, pease feel free to re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change Feed Processor V2 <-> V3 backward compatibility
2 participants