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

importer: clean up importResumer.dropTables #84872

Merged
merged 1 commit into from
Jul 22, 2022

Conversation

msbutler
Copy link
Collaborator

Previously, importResumer.DropTables() assumed that IMPORT INTO could act upon
multiple tables, which isn't actually the case, leading to overly complex code.
This pr is a simple refactor, in preparation for more import rollback work
in #76722 and #70428.

Release note: none

@msbutler msbutler requested review from dt, rhu713 and a team July 21, 2022 20:12
@msbutler msbutler self-assigned this Jul 21, 2022
@cockroach-teamcity
Copy link
Member

This change is Reviewable

pkg/sql/importer/import_job.go Outdated Show resolved Hide resolved
pkg/sql/importer/import_job.go Outdated Show resolved Hide resolved
// older-format (v1.1) descriptor. This enables ClearTableData to use a
// RangeClear for faster data removal, rather than removing by chunks.
intoTable.TableDesc().DropTime = int64(1)
if err := gcjob.ClearTableData(
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm wasn't this previously conditional on the table actually being empty? What if we have a table that is !empty, I don't think we want to ClearRange it right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oooof. Good catch. Done.

@adityamaru adityamaru self-requested a review July 21, 2022 20:36
Previously, importResumer.DropTables() assumed that IMPORT INTO could act upon
multiple tables, which isn't actually the case, leading to overly complex code.
This pr is a simple refactor, in preparation for more import rollback work
in cockroachdb#76722 and cockroachdb#70428.

Release note: none
@msbutler msbutler force-pushed the butler-import-rollbacks-refactor branch from 3750eed to fbaf116 Compare July 21, 2022 20:49
@msbutler
Copy link
Collaborator Author

TFTR!

bors=adityamaru

@msbutler
Copy link
Collaborator Author

bors r=adityamaru

@craig
Copy link
Contributor

craig bot commented Jul 22, 2022

Build succeeded:

@craig craig bot merged commit 4ce560f into cockroachdb:master Jul 22, 2022
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.

3 participants