-
Notifications
You must be signed in to change notification settings - Fork 2k
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 mode switch error handling #38740
Change feed mode switch error handling #38740
Conversation
API change check API changes are not detected in this pull request. |
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
…angeFeedModeSwitchErrorHandling
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Missing changelog.
...rc/main/java/com/azure/cosmos/implementation/changefeed/pkversion/LeaseStoreManagerImpl.java
Outdated
Show resolved
Hide resolved
...azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/LeaseStoreManager.java
Outdated
Show resolved
Hide resolved
...os/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/BootstrapperImpl.java
Outdated
Show resolved
Hide resolved
...os/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/BootstrapperImpl.java
Outdated
Show resolved
Hide resolved
...c/main/java/com/azure/cosmos/implementation/changefeed/epkversion/LeaseStoreManagerImpl.java
Show resolved
Hide resolved
.../cosmos/implementation/changefeed/epkversion/PkRangeIdVersionLeaseStoreBootstrapperImpl.java
Outdated
Show resolved
Hide resolved
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
LGTM, thanks
...os/src/main/java/com/azure/cosmos/implementation/changefeed/epkversion/BootstrapperImpl.java
Show resolved
Hide resolved
.../java/com/azure/cosmos/implementation/changefeed/epkversion/ChangeFeedProcessorImplBase.java
Show resolved
Hide resolved
.../java/com/azure/cosmos/implementation/changefeed/epkversion/ChangeFeedProcessorImplBase.java
Show resolved
Hide resolved
...test/java/com/azure/cosmos/rx/changefeed/epkversion/FullFidelityChangeFeedProcessorTest.java
Outdated
Show resolved
Hide resolved
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run java - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
Looks to be a regression in several split-based tests not finishing in time - tests pass locally. Change unrelated to splits so merging as is. |
/check-enforcer override |
Closes #38577 |
Objective
The objective of this PR is to detect scenarios where the customer starts an
AllVersionsAndDeletes
CFP instance following stopping theLatestVersion
CFP instance with an already initialized lease container (and vice-versa). This is to prevent scenarios whereAllVersionsAndDeletes
picks up a continuation from the lease outside its retention period or picks up a lease withStartFrom
asBEGINNING
which doesn't apply forAllVersionsAndDeletes
change-feed mode.Implementation
Transition 1:
LatestVersion
using EPK-range based lease toAllVersionAndDeletes
:BootstrapperImpl
.id
starts with a given lease prefix (or an empty prefix). This is done to see if the CFP instance in the bootstrapping phase will reuse leases or not.Mode
property from theContinuationToken
of the lease document and compare it with theChangeFeedMode
value of the CFP instance in bootstrapping phase.IllegalStateException
if there is a mismatch in theMode
value from the fetched lease and theChangeFeedMode
value of the CFP instance in bootstrapping phase.Transition 2:
AllVersionAndDeletes
toLatestVersion
using EPK-range based lease:PkRangeIdVersionBootstrapperImpl
.id
starts with a given lease prefix (or an empty prefix). This is done to see if the CFP instance in the bootstrapping phase will reuse leases or not.Mode
property from theContinuationToken
of the lease document and compare it with theChangeFeedMode
value of the CFP instance in bootstrapping phase.IllegalStateException
if there is a mismatch in theMode
value from the fetched lease and theChangeFeedMode
value of the CFP instance in bootstrapping phase.Transition 3:
AllVersionAndDeletes
toLatestVersion
using Pk-range based lease:LatestVersion
CFP bootstraps - it can't pick up an EPK-range based lease as the CFP instance fetches leases /.info
documents whoseid
embeds the name-based id of the database and feed container. An EPK-range based lease & its respective.info
document hasid
which embeds the resource id (system-generated) of the database and feed container.id
of the lease document and that of the CFP instance match) or create its own Pk-range based leases.Transition 4:
LatestVersion
using Pk-range based lease toAllVersionAndDeletes
:AllVersionAndDeletes
CFP bootstraps - it can't pick up a PK-range based lease as the CFP instance fetches leases /.info
documents whoseid
embeds the resource id of the database and feed container. A PK-range based lease & its respective.info
document hasid
which embeds the name-based id (user provided) of the database and feed container.id
of the lease document and that of the CFP instance match) or create its own EPK-range based leases.Design decisions
Mode
. This limits RU-usage on the lease container.null
continuation token - this scenario should not error out on a change-feed mode switch as the subsequent-running CFP instance could still try and use the lease with its ownContinuationToken
.