Skip to content

sqlbase: generalize IMPORTING state to OFFLINE #39723

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

Merged
merged 1 commit into from
Aug 20, 2019
Merged

Conversation

dt
Copy link
Member

@dt dt commented Aug 16, 2019

This renames the IMPORTING TableDescriptor state to OFFLINE for reuse outside IMPORT,
and adds a free-form string field OfflineReason in which the process that marked the
table as OFFFLINE can record the reason to surface in user-visible error messages.

@dt dt requested review from jordanlewis and thoszhang August 16, 2019 22:25
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@adityamaru27 adityamaru27 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r1, 8 of 8 files at r2.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @lucy-zhang)

Copy link
Contributor

@thoszhang thoszhang left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dt and @jordanlewis)


pkg/sql/sqlbase/structured.proto, line 556 at r2 (raw file):

  }
  optional State state = 19 [(gogoproto.nullable) = false];
  optional string offline_reason = 38 [(gogoproto.nullable) = false];

Do you think this should be an enum instead, in case we ever want to match on specific reasons?

Copy link
Member Author

@dt dt left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jordanlewis and @lucy-zhang)


pkg/sql/sqlbase/structured.proto, line 556 at r2 (raw file):

Previously, lucy-zhang (Lucy Zhang) wrote…

Do you think this should be an enum instead, in case we ever want to match on specific reasons?

I thought about an enum but I ended up figuring if you need to match a specific reason and handle it differently, the table state enum already gets you that -- the value of Offline is that you don't need to modify the proto and all the switch statements if you want to take a table offline for a different reason.

Copy link
Contributor

@thoszhang thoszhang left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @dt and @jordanlewis)


pkg/sql/sqlbase/structured.proto, line 556 at r2 (raw file):

Previously, dt (David Taylor) wrote…

I thought about an enum but I ended up figuring if you need to match a specific reason and handle it differently, the table state enum already gets you that -- the value of Offline is that you don't need to modify the proto and all the switch statements if you want to take a table offline for a different reason.

I was thinking offline_reason would be a separate enum, so that adding new values wouldn't affect the switch statements, etc. on state. I guess if there's a new reason for taking the table offline whose behavior is different enough from the existing States, then we would add a new State anyway. I think the string is fine.

@dt dt force-pushed the offline branch 2 times, most recently from eff5104 to ab92491 Compare August 19, 2019 21:45
@dt dt requested a review from a team as a code owner August 19, 2019 21:45
This renames the IMPORTING TableDescriptor state to OFFLINE for reuse outside IMPORT,
and adds a free-form string field OfflineReason in which the process that marked the
table as OFFFLINE can record the reason to surface in user-visible error messages.

Release note: none.
@dt
Copy link
Member Author

dt commented Aug 20, 2019

bors r+

craig bot pushed a commit that referenced this pull request Aug 20, 2019
39723:  sqlbase: generalize IMPORTING state to OFFLINE r=dt a=dt

This renames the IMPORTING TableDescriptor state to OFFLINE for reuse outside IMPORT,
and adds a free-form string field OfflineReason in which the process that marked the
table as OFFFLINE can record the reason to surface in user-visible error messages.


Co-authored-by: David Taylor <[email protected]>
@craig
Copy link
Contributor

craig bot commented Aug 20, 2019

Build succeeded

@craig craig bot merged commit 52ef4cd into cockroachdb:master Aug 20, 2019
@dt dt deleted the offline branch August 20, 2019 03:25
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.

4 participants