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

server/api: add an API to configure failpoints in runtime #3488

Merged
merged 2 commits into from
Mar 22, 2021

Conversation

sticnarf
Copy link
Contributor

@sticnarf sticnarf commented Mar 17, 2021

What is changed and how it works?

It would be easier to construct test cases if we could configure failpoint in runtime. Both TiKV and TiDB support such an API.

This PR adds /pd/api/v1/fail/ to configure failpoints.

Check List

Tests

  • Manual test (add detailed scripts or steps below)

First set GO_FAILPOINTS="github.com/tikv/pd/server/api/enableFailpointAPI=return" environment variable to enable this API.

Then, we can run HTTP requests like this to set failpoints:

curl -X PUT -d "return" http://{PD_ADDR}:2379/pd/api/v1/fail/github.com/tikv/pd/server/tso/systemTimeSlow

And we can also get the enabled failpoint list:

❯ curl http://{PD_ADDR}:2379/pd/api/v1/fail/
github.com/tikv/pd/server/api/enableFailpointAPI=return
github.com/tikv/pd/server/tso/systemTimeSlow=return

Code changes

  • Has HTTP API interfaces change

Release note

  • No release note.

Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@codecov
Copy link

codecov bot commented Mar 17, 2021

Codecov Report

Merging #3488 (27e57a6) into master (b4813a2) will increase coverage by 0.01%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3488      +/-   ##
==========================================
+ Coverage   74.50%   74.52%   +0.01%     
==========================================
  Files         244      244              
  Lines       24034    24039       +5     
==========================================
+ Hits        17907    17915       +8     
- Misses       4508     4512       +4     
+ Partials     1619     1612       -7     
Flag Coverage Δ
unittests 74.52% <33.33%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/api/router.go 97.05% <33.33%> (-2.34%) ⬇️
pkg/tempurl/tempurl.go 60.00% <0.00%> (-10.00%) ⬇️
server/tso/local_allocator.go 73.23% <0.00%> (-7.05%) ⬇️
server/tso/global_allocator.go 70.80% <0.00%> (-6.57%) ⬇️
server/election/lease.go 89.83% <0.00%> (-5.09%) ⬇️
server/tso/allocator_manager.go 75.08% <0.00%> (-1.83%) ⬇️
pkg/btree/btree.go 85.30% <0.00%> (-0.97%) ⬇️
server/grpc_service.go 47.42% <0.00%> (-0.68%) ⬇️
client/client.go 72.33% <0.00%> (-0.29%) ⬇️
client/base_client.go 83.78% <0.00%> (+0.54%) ⬆️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b4813a2...27e57a6. Read the comment docs.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 19, 2021
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JmPotato
  • nolouch

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 21, 2021
@JmPotato
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

@JmPotato: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

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

Commit hash: 9126856

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 22, 2021
@ti-chi-bot ti-chi-bot merged commit fab689d into tikv:master Mar 22, 2021
sticnarf added a commit to sticnarf/pd that referenced this pull request May 27, 2021
Signed-off-by: Yilin Chen <sticnarf@gmail.com>

Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com>
ti-chi-bot added a commit that referenced this pull request Jun 1, 2021
)

Signed-off-by: Yilin Chen <sticnarf@gmail.com>

Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com>

Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com>
sticnarf added a commit to sticnarf/pd that referenced this pull request Jun 23, 2021
Signed-off-by: Yilin Chen <sticnarf@gmail.com>

Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com>
ti-chi-bot added a commit that referenced this pull request Jul 6, 2021
)

Signed-off-by: Yilin Chen <sticnarf@gmail.com>

Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com>

Co-authored-by: Ti Chi Robot <71242396+ti-chi-bot@users.noreply.github.com>
Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants