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

opgen: added a bool field in struct opgen.transition #90719

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

Xiang-Gu
Copy link
Contributor

@Xiang-Gu Xiang-Gu commented Oct 26, 2022

This PR adds a bool field in struct opgen.transition that indicates whether it results from a equiv(xx) transition spec in the opgen file. It will be useful for a test where we need to find the inital status on a adding/dropping path. Without such a change, it can be problematic if we have a equiv(xx) spec as the first transition. E.g.

  ToAbsent(
    PUBLIC,
    equiv(VALIDATED),
    to(WRITE_ONLY),
    to(ABSENT),
  )

Without this change, the inital status will confusingly be VALIDATED, and the next status will be PUBLIC.
With this change, the initial status will be PUBLIC, and the next status will be WRITE_ONLY.

We also added some comments when we make transitions from the specs.

Epic: None
Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@Xiang-Gu Xiang-Gu marked this pull request as ready for review October 26, 2022 18:45
@Xiang-Gu Xiang-Gu requested a review from a team October 26, 2022 18:45
Copy link
Contributor

@postamar postamar left a comment

Choose a reason for hiding this comment

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

LGTM though based on our conversation today this might not be needed after all. Your call.

return tstn.from
}
// All transitions results from `equiv(xxx)` specs. Return `to` of the last transition.
return t.transitions[len(t.transitions)-1].to
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't return target be the same thing here, but simpler?

This PR adds a bool field in struct opgen.transition that indicates
whether it results from a `equiv(xx)` transition spec in the opgen file.
It will be useful for a test where we need to find the inital
status on a adding/dropping path. Without such a change, it can be
problematic if we have a `equiv(xx)` spec as the first transition.
E.g.
  ToAbsent(
    PUBLIC,
    equiv(VALIDATED),
    to(WRITE_ONLY),
    to(ABSENT),
  )

Without this change, the inital status will confusingly be `VALIDATED`,
and the next status will be `PUBLIC`.
With this change, the initial status will be `PUBLIC`, and the next
status will be `WRITE_ONLY`.

We also added some comments when we make transitions from the specs.

Release note: None
Copy link
Contributor Author

@Xiang-Gu Xiang-Gu left a comment

Choose a reason for hiding this comment

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

I think it's generally good so I'm going to merge it.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @postamar)


pkg/sql/schemachanger/scplan/internal/opgen/op_gen.go line 154 at r1 (raw file):

Previously, postamar (Marius Posta) wrote…

Wouldn't return target be the same thing here, but simpler?

That's correct! Will change it.

@Xiang-Gu
Copy link
Contributor Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Oct 31, 2022

Build succeeded:

@craig craig bot merged commit b7b658f into cockroachdb:master Oct 31, 2022
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