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

*: refactor dynamic tso switch #8780

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Nov 6, 2024

What problem does this PR solve?

Issue Number: ref #8477.

What is changed and how does it work?

This PR made the following changes:

  1. Merge api subcommand logic to pd. We keep the subcommand for compatibility but won't use it anymore.
  2. Only serverless use env to enable microservice, so I will use a config enable-multi-timelines to replace it in the next PR.
  3. Add more details for different scenes in both serverless and non-serverless environments.
  4. Whether enabling microservice is not relying on subcommand or system variables. We use enable-tso-dynamic-switch for the non-serverless env and enable-multi-timelines for the serverless env to manage it.
  5. Change the checkTSOService and IsServiceIndependent logic that needs attention when reviewing.
  6. Enable keyspace group by default, which adds group ID and user kind when creating keyspace. It's not ideal but considering the config is not used except for displaying, I made the change.
  7. Adapt the above changes for testing.

Check List

Tests

  • Unit test

Release note

None.

Copy link
Contributor

ti-chi-bot bot commented Nov 6, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 6, 2024
@rleungx rleungx force-pushed the remove-api-mode branch 2 times, most recently from baece73 to e252d4c Compare November 7, 2024 03:33
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 12, 2024
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 78.04878% with 18 lines in your changes missing coverage. Please review.

Project coverage is 75.97%. Comparing base (31a0ad6) to head (877c5be).
Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8780      +/-   ##
==========================================
- Coverage   76.29%   75.97%   -0.32%     
==========================================
  Files         465      465              
  Lines       70539    70567      +28     
==========================================
- Hits        53816    53616     -200     
- Misses      13376    13618     +242     
+ Partials     3347     3333      -14     
Flag Coverage Δ
unittests 75.97% <78.04%> (-0.32%) ⬇️

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

@rleungx rleungx marked this pull request as ready for review November 29, 2024 09:33
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 29, 2024
Copy link
Member

@okJiang okJiang left a comment

Choose a reason for hiding this comment

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

Is there any test results?

Copy link
Member

@okJiang okJiang left a comment

Choose a reason for hiding this comment

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

Please add some description about these changes.

server/server.go Outdated
if err := s.member.CampaignLeader(s.ctx, s.cfg.LeaderLease); err != nil {
if err.Error() == errs.ErrEtcdTxnConflict.Error() {
log.Info(fmt.Sprintf("campaign %s leader meets error due to txn conflict, another PD/API server may campaign successfully", s.mode),
log.Info("campaign %PD leader meets error due to txn conflict, another PD/API server may campaign successfully",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
log.Info("campaign %PD leader meets error due to txn conflict, another PD/API server may campaign successfully",
log.Info("campaign PD leader meets error due to txn conflict, another PD/API server may campaign successfully",

@@ -39,11 +39,6 @@ func RegisterMicroService(r *gin.RouterGroup) {
// @Router /ms/members/{service} [get]
func GetMembers(c *gin.Context) {
svr := c.MustGet(middlewares.ServerContextKey).(*server.Server)
if !svr.IsPDServiceMode() {
Copy link
Contributor

Choose a reason for hiding this comment

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

If access pd mode server, will it return 500?

Copy link
Member Author

Choose a reason for hiding this comment

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

After this PR, there won't be pd mode anymore.

}
} else {
servers, err := discovery.Discover(c.etcdClient, constant.SchedulingServiceName)
if c.opt.GetMicroServiceConfig().IsSchedulingFallbackEnabled() && (err != nil || len(servers) == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If SchedulingFallbackEnabled is false and there is no scheduling server, will we not try to start scheduling service in pd server?

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 8, 2025
@rleungx rleungx changed the title *: remove api mode *: refactor dynamic tso Jan 10, 2025
@rleungx rleungx changed the title *: refactor dynamic tso *: refactor dynamic tso switch Jan 10, 2025
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Copy link
Contributor

ti-chi-bot bot commented Jan 13, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from rleungx and additionally assign yudongusa for approval(Please ensuring that each of them provides their approval before proceeding). For more information see the Code Review Process.

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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Signed-off-by: Ryan Leung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has signed the dco. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants