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

parser: create and alter placement policy #1305

Closed
wants to merge 5 commits into from

Conversation

AilinKid
Copy link
Contributor

@AilinKid AilinKid commented Aug 11, 2021

What problem does this PR solve?

support create and alter placement policy

What is changed and how it works?

add syntax for
1: create placement policy if not exists x placement_opts
2: alter placement policy if exists x placement_opts

this is based on #1299, wait for it merged first.

Check List

Tests

  • Unit test
  • Integration test

Related changes

  • Need to update the documentation

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

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.

Comment on lines +76 to +87
DatabaseOptionPlacementPrimaryRegion
DatabaseOptionPlacementRegions
DatabaseOptionPlacementFollowerCount
DatabaseOptionPlacementVoterCount
DatabaseOptionPlacementLearnerCount
DatabaseOptionPlacementSchedule
DatabaseOptionPlacementConstraints
DatabaseOptionPlacementLeaderConstraints
DatabaseOptionPlacementLearnerConstraints
DatabaseOptionPlacementFollowerConstraints
DatabaseOptionPlacementVoterConstraints
DatabaseOptionPlacementPolicy
Copy link
Contributor

Choose a reason for hiding this comment

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

how about defining the db options to have the same values as the table options like

    DatabaseOptionPlacementPrimaryRegion = DatabaseOptionType(TableOptionPlacementPrimaryRegion)
    DatabaseOptionPlacementRegions = DatabaseOptionType(TableOptionPlacementRegions)
    // etc

...

@@ -94,6 +109,13 @@ func (n *DatabaseOption) Restore(ctx *format.RestoreCtx) error {
ctx.WriteKeyWord("ENCRYPTION")
ctx.WritePlain(" = ")
ctx.WriteString(n.Value)
case DatabaseOptionPlacementPrimaryRegion, DatabaseOptionPlacementRegions, DatabaseOptionPlacementFollowerCount, DatabaseOptionPlacementLeaderConstraints, DatabaseOptionPlacementLearnerCount, DatabaseOptionPlacementVoterCount, DatabaseOptionPlacementSchedule, DatabaseOptionPlacementConstraints, DatabaseOptionPlacementFollowerConstraints, DatabaseOptionPlacementVoterConstraints, DatabaseOptionPlacementLearnerConstraints, DatabaseOptionPlacementPolicy:
tblOpt := TableOption{
Tp: TableOptionType(n.Tp-DatabaseOptionPlacementPrimaryRegion) + TableOptionPlacementPrimaryRegion,
Copy link
Contributor

Choose a reason for hiding this comment

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

... the thing is, here we rely on the db options are declared in the same order as the table options, which is not clear on either declaration site (lines 76 and 1908).

if the order in either side is changed (as there is no explicit relationship mentioned) this will be restored to the wrong option.

@xhebox xhebox self-requested a review August 16, 2021 08:06
@ti-chi-bot
Copy link
Member

@AilinKid: PR needs rebase.

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 kubernetes/test-infra repository.

@AilinKid
Copy link
Contributor Author

move to #1313

@AilinKid AilinKid closed this Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants