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

Block ChangeFeedMode interoperability for ChangeFeedProcessor. #43798

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

jeet1995
Copy link
Member

@jeet1995 jeet1995 commented Jan 15, 2025

Description

The goal of this PR is to block a customer leveraging the Change Feed Processor to switch between LatestVersion and AllVersionsAndDeletes change feed mode for the same lease prefix. The context behind this change is when EPK_RANGE_BASED_LEASE is left behind by LatestVersion - AllVersionsAndDeletes picks up the lease silently (no hang per se) - we don't understand the repercussions here or functional validity. When PK_RANGE_BASED_LEASE is left behind, AllVersionsAndDeletes doesn't detect it and creates its own lease which is also weird behavior.

During the bootstrap of ChangeFeedProcessor, the presence of leases with the same lease prefix is checked for PARTITION_KEY_BASED_LEASE when an AllVersionsAndDeletes workload is started. If such is the case, then the bootstrap throws an IllegalStateException as a PARTITION_KEY_BASED_LEASE is only applicable for LatestVersion change feed mode. Likewise, if a LatestVersion workload is started with the handleChanges method, the presence of EPK_RANGE_BASED_LEASE is checked, which if present, throws an IllegalStateException. These validations will look for a lease with the same lease prefix as the workload being started.

This PR is a follow up to this - #38740 which introduced blocking change feed mode interoperability scoped to EPK_RANGE_BASED_LEASE.

  • Regression: If a customer has started two workloads with the same lease prefix, one with LatestVersion and the other with AllVersionsAndDeletes, the ChangeFeedProcessor will throw an IllegalStateException during bootstrap.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@jeet1995 jeet1995 changed the title [No Review]; Block AllVersionsAndDeletes when Pk-Range based leases are found in lease container for same lease prefix. [No Review]; Block AllVersionsAndDeletes workload when Pk-Range based leases are found in lease container for same lease prefix. Jan 15, 2025
@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@jeet1995
Copy link
Member Author

/azp run java - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jeet1995
Copy link
Member Author

/azp run java - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jeet1995 jeet1995 changed the title [No Review]; Block AllVersionsAndDeletes workload when Pk-Range based leases are found in lease container for same lease prefix. Block AllVersionsAndDeletes workload when Pk-Range based leases are found in lease container for same lease prefix. Jan 19, 2025
@jeet1995 jeet1995 marked this pull request as ready for review January 19, 2025 22:11
@jeet1995 jeet1995 requested review from kirankumarkolli and a team as code owners January 19, 2025 22:11
@jeet1995
Copy link
Member Author

/azp run java - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jeet1995 jeet1995 changed the title Block AllVersionsAndDeletes workload when Pk-Range based leases are found in lease container for same lease prefix. Block ChangeFeedMode interoperability for ChangeFeedProcessor. Jan 21, 2025
@jeet1995
Copy link
Member Author

/azp run java - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

LGTM except for PR description being misleading as discussed offline.

Copy link
Member

@tvaron3 tvaron3 left a comment

Choose a reason for hiding this comment

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

LGTM

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

Successfully merging this pull request may close these issues.

4 participants