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

api: use suitable status code and make TestResetTS stable #7368

Merged
merged 8 commits into from
Nov 22, 2023

Conversation

lhy1024
Copy link
Contributor

@lhy1024 lhy1024 commented Nov 14, 2023

What problem does this PR solve?

Issue Number: Close #7411 #7314

What is changed and how does it work?

Check List

Tests

  • Unit test

Release note

None.

Signed-off-by: lhy1024 <admin@liudos.us>
Copy link
Contributor

ti-chi-bot bot commented Nov 14, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • CabinfeverB
  • rleungx

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 bot added the release-note-none Denotes a PR that doesn't merit a release note. label Nov 14, 2023
@ti-chi-bot ti-chi-bot bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 14, 2023
Copy link

codecov bot commented Nov 14, 2023

Codecov Report

Merging #7368 (8730e26) into master (f2eaf23) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7368      +/-   ##
==========================================
- Coverage   74.28%   74.28%   -0.01%     
==========================================
  Files         451      451              
  Lines       48899    48905       +6     
==========================================
+ Hits        36327    36331       +4     
- Misses       9348     9358      +10     
+ Partials     3224     3216       -8     
Flag Coverage Δ
unittests 74.28% <0.00%> (-0.01%) ⬇️

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

@rleungx
Copy link
Member

rleungx commented Nov 15, 2023

Please add some explanation of the reason for this unstable test.

@lhy1024
Copy link
Contributor Author

lhy1024 commented Nov 15, 2023

Please add some explanation of the reason for this unstable test.

When we call ResetTS, we may meet etcd transaction conflict.

case http.StatusOK:
re.Contains(string(b), "Reset ts successfully.")
return true
case http.StatusForbidden:
Copy link
Member

Choose a reason for hiding this comment

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

The status code is strange.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

replace it with 503

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Signed-off-by: lhy1024 <admin@liudos.us>
Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 16, 2023
Signed-off-by: lhy1024 <admin@liudos.us>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 16, 2023
@@ -185,6 +185,11 @@ func ResetTS(c *gin.Context) {
if err = svr.ResetTS(ts, ignoreSmaller, skipUpperBoundCheck, 0); err != nil {
if err == errs.ErrServerNotStarted {
c.String(http.StatusInternalServerError, err.Error())
} else if err == errs.ErrEtcdTxnConflict {
Copy link
Member

Choose a reason for hiding this comment

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

This is not only for test? Because it will effect the resp to users.
I want to know whether this PR needs to cherry-pick.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, not only for test. But I am not sure whether it is a bug to need cherry-pick.

Copy link
Member

Choose a reason for hiding this comment

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

If it's only for TSO services, IMO we don't need to.

Copy link
Contributor Author

@lhy1024 lhy1024 Nov 16, 2023

Choose a reason for hiding this comment

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

PD mode also returns 403 when meeting ErrEtcdTxnConflict before this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After discussion with @niubell, we will only fix it on master branch.

@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 16, 2023
@lhy1024
Copy link
Contributor Author

lhy1024 commented Nov 16, 2023

/merge

Copy link
Contributor

ti-chi-bot bot commented Nov 16, 2023

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

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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.

Copy link
Contributor

ti-chi-bot bot commented Nov 16, 2023

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

Commit hash: 50e0365

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 16, 2023
@lhy1024 lhy1024 changed the title tests: make TestResetTS stable api: use suitable status code and make TestResetTS stable Nov 16, 2023
@ti-chi-bot ti-chi-bot bot removed the status/can-merge Indicates a PR has been approved by a committer. label Nov 16, 2023
Signed-off-by: lhy1024 <admin@liudos.us>
@lhy1024
Copy link
Contributor Author

lhy1024 commented Nov 17, 2023

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 17, 2023
@lhy1024
Copy link
Contributor Author

lhy1024 commented Nov 22, 2023

After a discussion with @niubell, we will only fix it on the master branch.

@lhy1024 lhy1024 removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 22, 2023
@lhy1024
Copy link
Contributor Author

lhy1024 commented Nov 22, 2023

/merge

Copy link
Contributor

ti-chi-bot bot commented Nov 22, 2023

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

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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.

Copy link
Contributor

ti-chi-bot bot commented Nov 22, 2023

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

Commit hash: 8730e26

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 22, 2023
Copy link
Contributor

ti-chi-bot bot commented Nov 22, 2023

@lhy1024: Your PR was out of date, I have automatically updated it for you.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-chi-bot bot merged commit 8e6dcfb into tikv:master Nov 22, 2023
22 checks passed
@lhy1024 lhy1024 mentioned this pull request Nov 22, 2023
rleungx pushed a commit to rleungx/pd that referenced this pull request Dec 1, 2023
close tikv#7411

Signed-off-by: lhy1024 <admin@liudos.us>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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.

resetTS should use suitable status code
3 participants