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

backupccl: tenants should be restored in their correct state #87931

Merged
merged 1 commit into from
Sep 19, 2022

Conversation

adityamaru
Copy link
Contributor

Previously, all backed up tenants were unconditionally moved through an ADD and then ACTIVE state during a cluster/tenant restore. This behaviour appears incorrect. If the tenant was backed up in and adding or dropped state then it should be restored in the same state as well.

This change only moves ACTIVE backed up tenants through an ADD and then ACTIVE state thereby fixing this bug.

Fixes: #87915

Release note (bug fix): Cluster and tenant restores of dropped or adding tenants would incorrectly activate those tenants during restore.

@adityamaru adityamaru requested review from stevendanna, rhu713 and a team September 13, 2022 19:50
@adityamaru adityamaru requested a review from a team as a code owner September 13, 2022 19:50
@cockroach-teamcity
Copy link
Member

This change is Reviewable

// If the tenant was backed up in an `ACTIVE` state then we must activate
// the tenant as the final step of the restore. The tenant has already
// been created at an earlier stage in the restore in an `ADD` state.
tenant.State = descpb.TenantInfo_ADD
Copy link
Member

Choose a reason for hiding this comment

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

what does this assignment do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, deleted.

Previously, all backed up tenants were unconditionally moved through
an `ADD` and then `ACTIVE` state during a cluster/tenant restore. This
behaviour appears incorrect. If the tenant was backed up in and adding or
dropped state then it should be restored in the same state as well.

This change only moves `ACTIVE` backed up tenants through an `ADD` and then
`ACTIVE` state thereby fixing this bug.

Fixes: cockroachdb#87915

Release note (bug fix): Cluster and tenant restores of dropped or adding tenants
would incorrectly activate those tenants during restore.
@adityamaru adityamaru requested a review from dt September 19, 2022 16:03
@adityamaru
Copy link
Contributor Author

TFTR!

bors r=dt

@craig
Copy link
Contributor

craig bot commented Sep 19, 2022

Build succeeded:

@blathers-crl
Copy link

blathers-crl bot commented Sep 19, 2022

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 4e865f7 to blathers/backport-release-22.1-87931: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 22.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

@adityamaru adityamaru deleted the restore-tenant-bug branch September 26, 2022 13:44
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.

backupccl: cluster restore incorrectly restores an inactive tenant as active
3 participants