-
Notifications
You must be signed in to change notification settings - Fork 720
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
mcs: forward current http request to mcs #7078
Merged
Merged
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4e6f3b3
mcs: watch scheduling service primary address
lhy1024 780736b
address comments
lhy1024 4012981
mcs: forward current http request to mcs
lhy1024 e8a88b9
avoid unexpected EOF error with gzip
lhy1024 0f733dc
fix test
lhy1024 32a81e3
address comments
lhy1024 7eafe59
Merge branch 'master' of github.com:tikv/pd into sche-redirect
lhy1024 40f129f
add methods check
lhy1024 98a573b
address comments
lhy1024 590d971
rename
lhy1024 2193aff
add test
lhy1024 f070884
add test with failpoint
lhy1024 338058d
Merge branch 'master' into sche-redirect
ti-chi-bot[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,9 @@ import ( | |
"net/http" | ||
|
||
"github.com/gorilla/mux" | ||
scheapi "github.com/tikv/pd/pkg/mcs/scheduling/server/apis/v1" | ||
tsoapi "github.com/tikv/pd/pkg/mcs/tso/server/apis/v1" | ||
mcs "github.com/tikv/pd/pkg/mcs/utils" | ||
"github.com/tikv/pd/pkg/utils/apiutil" | ||
"github.com/tikv/pd/pkg/utils/apiutil/serverapi" | ||
"github.com/tikv/pd/server" | ||
|
@@ -34,12 +36,29 @@ func NewHandler(_ context.Context, svr *server.Server) (http.Handler, apiutil.AP | |
Name: "core", | ||
IsCore: true, | ||
} | ||
router := mux.NewRouter() | ||
prefix := apiPrefix + "/api/v1" | ||
r := createRouter(apiPrefix, svr) | ||
router := mux.NewRouter() | ||
router.PathPrefix(apiPrefix).Handler(negroni.New( | ||
serverapi.NewRuntimeServiceValidator(svr, group), | ||
serverapi.NewRedirector(svr, serverapi.MicroserviceRedirectRule( | ||
apiPrefix+"/api/v1"+"/admin/reset-ts", tsoapi.APIPathPrefix+"/admin/reset-ts", "tso")), | ||
serverapi.NewRedirector(svr, | ||
serverapi.MicroserviceRedirectRule( | ||
prefix+"/admin/reset-ts", | ||
tsoapi.APIPathPrefix+"/admin/reset-ts", | ||
mcs.TSOServiceName), | ||
serverapi.MicroserviceRedirectRule( | ||
prefix+"/operators", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about the config or other paths? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will resolve them in other PRs, this PR only forwards the current HTTP method in scheduling server. |
||
scheapi.APIPathPrefix+"/operators", | ||
mcs.SchedulingServiceName), | ||
serverapi.MicroserviceRedirectRule( | ||
prefix+"/checker", // Note: this is a typo in the original code | ||
scheapi.APIPathPrefix+"/checkers", | ||
mcs.SchedulingServiceName), | ||
serverapi.MicroserviceRedirectRule( | ||
prefix+"/schedulers", | ||
scheapi.APIPathPrefix+"/schedulers", | ||
mcs.SchedulingServiceName), | ||
lhy1024 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
), | ||
negroni.Wrap(r)), | ||
) | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a concern about it and am not sure if only two keys will affect it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible, but for now gzip only affects these two, and we'll do more testing as we add interfaces.