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

[feat] tools-v2: add update leader-schedule[-all] #2551

Merged
merged 1 commit into from
Jun 25, 2023

Conversation

montaguelhz
Copy link
Contributor

@montaguelhz montaguelhz commented Jun 22, 2023

What problem does this PR solve?

Issue Number: #2359

Problem Summary:

What is changed and how it works?

What's Changed:

How it Works:
curve bs update leader-schedule --logicalpoolid 1
curve bs update leader-schedule-all

+---------+--------+
| RESULT | REASON |
+---------+--------+
| success | null |
+---------+--------+

+--------+--------------------+
| RESULT | REASON |
+--------+--------------------+
| failed | InvalidLogicalPool |
+--------+--------------------+
Side effects(Breaking backward compatibility? Performance regression?):

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

Copy link
Contributor

@Xinlong-Chen Xinlong-Chen left a comment

Choose a reason for hiding this comment

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

good job

Copy link
Contributor

@Xinlong-Chen Xinlong-Chen left a comment

Choose a reason for hiding this comment

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

good job

@Xinlong-Chen
Copy link
Contributor

cicheck

@Xinlong-Chen
Copy link
Contributor

@Cyber-SiKu please take a look this pr, thx.

@montaguelhz
Copy link
Contributor Author

@Cyber-SiKu please take a look this pr, thx.

He must be enjoying the Dragon Boat Festival. Happy Dragon Boat Festival!

@Xinlong-Chen
Copy link
Contributor

@Cyber-SiKu please take a look this pr, thx.

He must be enjoying the Dragon Boat Festival. Happy Dragon Boat Festival!

hahah, just remind him to attention it~
With any luck, we'll merge this pr on Sunday.

@Xinlong-Chen
Copy link
Contributor

@montaguelhz u can take a look issue #2352, u can implement it by the same way as this pr~(related sub-commands have implemented now)
I think this should be pretty easy for you~

@Cyber-SiKu
Copy link
Contributor

@Cyber-SiKu please take a look this pr, thx.

ok

@montaguelhz
Copy link
Contributor Author

cicheck

1 similar comment
@montaguelhz
Copy link
Contributor Author

cicheck

@Xinlong-Chen Xinlong-Chen self-requested a review June 25, 2023 05:22
return err.ToError()
}
out := make(map[string]string)
if response, ok := result.(*schedule.RapidLeaderScheduleResponse); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is ok necessary here?

Comment on lines 145 to 151
if response.GetStatusCode() != 0 {
out[cobrautil.ROW_RESULT] = cobrautil.ROW_VALUE_FAILED
out[cobrautil.ROW_REASON] = statuscode.ScheduleStatusCode_name[*response.StatusCode]
} else {
out[cobrautil.ROW_RESULT] = cobrautil.ROW_VALUE_SUCCESS
out[cobrautil.ROW_REASON] = cobrautil.ROW_VALUE_NULL
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be handled by adding ErrBsRapidLeaderSchedule.

Suggested change
if response.GetStatusCode() != 0 {
out[cobrautil.ROW_RESULT] = cobrautil.ROW_VALUE_FAILED
out[cobrautil.ROW_REASON] = statuscode.ScheduleStatusCode_name[*response.StatusCode]
} else {
out[cobrautil.ROW_RESULT] = cobrautil.ROW_VALUE_SUCCESS
out[cobrautil.ROW_REASON] = cobrautil.ROW_VALUE_NULL
}
err = cmderr.ErrBsRapidLeaderSchedule(response.GetStatusCode())
if err.TypeCode() != cmderr.CODE_SUCCESS {
out[cobrautil.ROW_RESULT] = cobrautil.ROW_VALUE_FAILED
} else {
out[cobrautil.ROW_RESULT] = cobrautil.ROW_VALUE_SUCCESS
}
out[cobrautil.ROW_REASON] = err.Message

lCmd.TableNew.Append(res)

lCmd.Result = out
lCmd.Error = cmderror.ErrSuccess()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
lCmd.Error = cmderror.ErrSuccess()
lCmd.Error = err

@montaguelhz
Copy link
Contributor Author

cicheck

Copy link
Contributor

@Cyber-SiKu Cyber-SiKu left a comment

Choose a reason for hiding this comment

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

LGTM~

@Cyber-SiKu
Copy link
Contributor

cicheck

1 similar comment
@montaguelhz
Copy link
Contributor Author

cicheck

@Cyber-SiKu Cyber-SiKu merged commit cb8d72f into opencurve:master Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants