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

http_*: add a HTTP API to list changefeed info (#1917) #2022

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #1917

What problem does this PR solve?

#1869

What is changed and how it works?

Add a HTTP API to list changefeed info.
Add a HTTP API to check the health of CDC server. (It only return a response with 200 OK and empty body.)

Check List

Tests

  • Manual test (add detailed scripts or steps below)
  1. list default changefeeds
$ curl -X GET http://127.0.0.1:8300/api/v1/changefeeds
[
 {
  "id": "changefeed-test-1",
  "state": "normal",
  "tso": 425364256174112775,
  "checkpoint": "2021-06-02 20:11:04.922",
  "error": null
 },
 {
  "id": "test1",
  "state": "normal",
  "tso": 425364256174112775,
  "checkpoint": "2021-06-02 20:11:04.922",
  "error": null
 }
]
  1. list all changefeeds.
$ curl -X GET http://127.0.0.1:8300/api/v1/changefeeds?state=all
[
 {
  "id": "changefeed-test-1",
  "state": "normal",
  "tso": 425364263569195009,
  "checkpoint": "2021-06-02 20:11:33.132",
  "error": null
 },
 {
  "id": "test1",
  "state": "normal",
  "tso": 425364263569195009,
  "checkpoint": "2021-06-02 20:11:33.132",
  "error": null
 },
 {
  "id": "test2",
  "state": "removed",
  "tso": 425364254063853571,
  "checkpoint": "2021-06-02 20:10:56.872",
  "error": null
 }
]
  1. list normal / stopped / removed changefeed
$ curl -X GET http://127.0.0.1:8300/api/v1/changefeeds?state=normal

[
 {
  "id": "test1",
  "state": "normal",
  "checkpoint-tso": 425413530255884289,
  "checkpoint-time": "2021-06-05 00:23:50.627",
  "error": null
 },
 {
  "id": "test2",
  "state": "normal",
  "checkpoint-tso": 425413530255884289,
  "checkpoint-time": "2021-06-05 00:23:50.627",
  "error": null
 }
]

$ curl -X GET http://127.0.0.1:8300/api/v1/changefeeds?state=stopped

[
 {
  "id": "test4",
  "state": "stopped",
  "checkpoint-tso": 425412960562708481,
  "checkpoint-time": "2021-06-04 23:47:37.420",
  "error": null
 }
]

$ curl -X GET http://127.0.0.1:8300/api/v1/changefeeds?state=removed

[
 {
  "id": "test3",
  "state": "removed",
  "checkpoint-tso": 425412963750903809,
  "checkpoint-time": "2021-06-04 23:47:49.582",
  "error": null
 }
  1. test POST method
$ curl -POST http://127.0.0.1:8300/api/v1/changefeeds

{
 "error": "this api supports GET method only",
 "errorCode": "CDC:ErrSupportGetOnly"
}
  1. check health of CDC server
$ curl -I -X GET  http://127.0.0.1:8300/api/v1/health

HTTP/1.1 200 OK
Date: Fri, 04 Jun 2021 04:05:56 GMT
Content-Length: 0

Code changes

  • Has exported function/method change

Side effects

  • None

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release note

  • No release note

@ti-chi-bot ti-chi-bot added status/ptal Could you please take a look? size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-4.0 This PR is cherry-picked to release-4.0 from a source PR. labels Jun 10, 2021
@ti-chi-bot ti-chi-bot requested a review from amyangfei June 10, 2021 09:05
@ti-chi-bot ti-chi-bot requested review from zier-one and liuzix June 10, 2021 09:05
@lonng lonng added this to the v4.0.14 milestone Jun 10, 2021
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 23, 2021
@lonng lonng added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jul 6, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 6, 2021
@ti-chi-bot
Copy link
Member Author

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • amyangfei

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 7, 2021
@amyangfei amyangfei added the require-LGT1 Indicates that the PR requires an LGTM. label Jul 7, 2021
@amyangfei
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member Author

This pull request has been accepted and is ready to merge.

Commit hash: 607f241

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 7, 2021
@purelind
Copy link
Collaborator

purelind commented Jul 7, 2021

/run-all-tests

@amyangfei
Copy link
Contributor

/run-leak-tests

@amyangfei
Copy link
Contributor

/run-integration-tests
/run-kafka-tests

@amyangfei
Copy link
Contributor

/run-all-tests

1 similar comment
@amyangfei
Copy link
Contributor

/run-all-tests

Comment on lines 283 to 290
} else {
if s.captureV2 == nil {
// for test only
handleOwnerResp(w, concurrency.ErrElectionNotLeader)
return
}
}

if s.captureV2 == nil {
// for test only
handleOwnerResp(w, concurrency.ErrElectionNotLeader)
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be cherry picked to release-4.0, PTAL @asddongmen

@amyangfei
Copy link
Contributor

/merge

@amyangfei
Copy link
Contributor

/run-leak-tests

@ti-chi-bot ti-chi-bot merged commit 3d907cb into pingcap:release-4.0 Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. require-LGT1 Indicates that the PR requires an LGTM. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. status/ptal Could you please take a look? type/cherry-pick-for-release-4.0 This PR is cherry-picked to release-4.0 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants