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

sql: add ImportType to descriptor #120809

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Conversation

stevendanna
Copy link
Collaborator

This adds an ImportType field to table descriptors. We need this field
if we want to support disabling ImportEpoch writing via a cluster
setting since we won't necessarily be able to trust that a non-zero
ImportEpoch is actually from the currently in-progress IMPORT.

Epic: none
Release note: None

@stevendanna stevendanna requested review from a team as code owners March 21, 2024 04:00
@stevendanna stevendanna requested review from dt and mgartner and removed request for a team March 21, 2024 04:00
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@stevendanna
Copy link
Collaborator Author

First commit is #120407

// Next ID: 60
// ImportType is the type of import that is running if
// ImportStartWallTime is set.
optional ImportType import_type = 60 [(gogoproto.nullable) = false, (gogoproto.customname) = "ImportType"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

could this be a bool instead with the var name epoch_based_import_runnning? This feels cleaner then import_type==0 (i.e. IMPORT_WITH_START_TIME_ONLY) implying no import running or non-epoch based import.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I went back and forth on this. At the time it seemed likely that we might end up with a few more types if we eventually want to differentiate between empty-vs-non-empty as well like you had in your original PR. If so, I'd slightly prefer an Enum or a uint64 with different bits assigned to different properties of the import.

But, I can change it to a bool.

Copy link
Collaborator

Choose a reason for hiding this comment

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

fine by me!

@msbutler
Copy link
Collaborator

it may also be worth adding a small unit test for this

Copy link
Collaborator

@msbutler msbutler left a comment

Choose a reason for hiding this comment

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

thanks for adding that test case!

// Next ID: 60
// ImportType is the type of import that is running if
// ImportStartWallTime is set.
optional ImportType import_type = 60 [(gogoproto.nullable) = false, (gogoproto.customname) = "ImportType"];
Copy link
Collaborator

Choose a reason for hiding this comment

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

fine by me!

@msbutler
Copy link
Collaborator

closing in favor of #121042

@msbutler msbutler closed this Mar 25, 2024
msbutler added a commit to msbutler/cockroach that referenced this pull request Mar 26, 2024
…tting

Currently, the user can disable import from writing the import epoch to the
mvcc value header. This cluster setting was added because we thought this
import epoch logic could be risky:
- it could degrade import performance
- epoch based rollbacks could be incorrect and much slower

The second risk isn't serious because only online restore, a feature in private
preview, uses epoch based rollback. The first risk does not seem apparent
according to import roachperf graphs.

The cluster setting further complicates the rollback code, as pr cockroachdb#120809 shows.
Since the risks of this code aren't terribly bad, it seems fine to remove the
code to simplify the import rollback logic.

Epic: none

Release note: none
@msbutler
Copy link
Collaborator

Changed my mind. I'm reviving this given my comment

@msbutler msbutler reopened this Mar 27, 2024
@msbutler msbutler self-assigned this Mar 27, 2024
Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 6 files at r2, 1 of 10 files at r3, 7 of 7 files at r4, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @mgartner and @stevendanna)

This adds an ImportType field to table descriptors. We need this field
if we want to support disabling ImportEpoch writing via a cluster
setting since we won't necessarily be able to trust that a non-zero
ImportEpoch is actually from the currently in-progress IMPORT.

Epic: none
Release note: None
@dt
Copy link
Member

dt commented Mar 27, 2024

bors r=dt

@msbutler
Copy link
Collaborator

TFTRs!

bors r+

@craig
Copy link
Contributor

craig bot commented Mar 27, 2024

Already running a review

@craig
Copy link
Contributor

craig bot commented Mar 27, 2024

Build failed (retrying...):

@craig craig bot merged commit 40cc14f into cockroachdb:master Mar 27, 2024
21 of 22 checks passed
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.

5 participants