Recover stuck service operations after transient DB failures#5011
Draft
serdarozerr wants to merge 3 commits intocloudfoundry:mainfrom
Draft
Recover stuck service operations after transient DB failures#5011serdarozerr wants to merge 3 commits intocloudfoundry:mainfrom
serdarozerr wants to merge 3 commits intocloudfoundry:mainfrom
Conversation
…e operations Introduces a new periodic recovery job that scans permanently failed delayed_jobs and re-enqueues polling for service operations still in progress at the broker. Recovers cases where a transient DB connection error caused the polling job to fail permanently (max_attempts=1) while the broker operation was still running, leaving the service instance stuck in 'in progress' with no active poller.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When CCDB becomes temporarily unreachable during a service broker polling cycle, the polling job fails permanently even though the broker is still processing the operation. This leaves the service instance stuck:
last_operation.state = 'in progress'(broker still working)pollable_job.state = FAILED(CC gave up)422 "operation in progress"Solution
Adds a new periodic scheduled job
DelayedJobsRecoverthat scansdelayed_jobsfor permanently failed rows and re-enqueues polling for any broker operation still in progress.Detection chain:
delayed_jobs.failed_at IS NOT NULL→ linkedpollable_jobin POLLING/FAILED state → service instancelast_operation.state = 'in progress'Recovery:
Deserializes the original handler from the dead
delayed_job(preserving@start_time,@maximum_duration,@first_time = false) and callsenqueue_next_job, the same path used by normal poll cycles. A row-levelFOR UPDATElock withdelayed_job_guidre-verification prevents double recovery when multiple CC instances run concurrently.I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
mainbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests