api(ticdc): return task_status for changefeeds in warning state - #12759
api(ticdc): return task_status for changefeeds in warning state#12759shreyasp-db wants to merge 2 commits into
Conversation
The changefeed detail handlers populate task_status only when the changefeed is in the normal state, so `cdc cli changefeed query` omits the per-capture table assignment for changefeeds in the warning state -- which is often exactly when this information is most needed for debugging. A changefeed in the warning state is still running (its processors are active), so its task statuses remain meaningful. Gate the task_status population on FeedState.IsRunning() (normal OR warning) instead of an exact StateNormal check.
|
Welcome @shreyasp-db! |
|
Hi @shreyasp-db. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
|
/ok-to-test |
ekexium
left a comment
There was a problem hiding this comment.
LGTM. Please file an issue and link the PR to it
|
@ekexium: adding LGTM is restricted to approvers and reviewers in OWNERS files. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 3AceShowHand, ekexium, hongyunyan The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChangefeed APIs now collect task statuses for all running states, including warning states. Task-status retrieval failures are logged while changefeed responses continue without task-status data. Tests cover normal, warning, and stopped feed responses. ChangesChangefeed task-status handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
/check-issue-triage-complete |
|
Core change looks good: |
What problem does this PR solve?
Issue Number: close #12793
The changefeed query/detail OpenAPI endpoints normally return
task_status, e.g. (as seen viacdc cli changefeed query -c <CHANGEFEED_ID>, which is just one client of this API):However, when a changefeed is in the
warningstate,task_statusis not returned — which is often exactly when this per-capture table assignment is most needed for debugging. This affects every caller of the query API (theGET /api/v1/changefeeds/{id},GET /api/v2/changefeeds/{id}, and meta-info endpoints), not just thecdc cli.The changefeed detail handlers gate the
task_statuspopulation on an exactinfo.State == model.StateNormalcheck, soGetAllTaskStatusesis skipped for any other state, includingwarning.What is changed and how it works?
A changefeed in the
warningstate is still running (its processors are active), so its task statuses remain meaningful.FeedState.IsRunning()already encodes this exact semantic (StateNormal || StateWarning).This PR replaces the exact
StateNormalcheck withFeedState.IsRunning()in the three changefeed-detail handlers:cdc/api/v1/api.go—getChangefeedcdc/api/v2/changefeed.go—getChangeFeedcdc/api/v2/changefeed.go—getChangeFeedMetaInfoCheck List
Tests
Extended
TestGetChangeFeed(cdc/api/v2) with a table-driven check assertingtask_statusis returned fornormalandwarningstates and omitted forstopped.Questions
Will it cause performance regression or break compatibility?
No. It adds one
GetAllTaskStatusescall for changefeeds in thewarningstate (the same call already made fornormal), and only widens the set of states for whichtask_statusis populated — no field or format changes.Do you need to update user documentation, design documentation or monitoring documentation?
No.
Release note
Summary by CodeRabbit