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: simplify index span merging logic for backup #72293

Merged
merged 1 commit into from
Nov 2, 2021

Conversation

adityamaru
Copy link
Contributor

This change simplifies the index span merging logic used
by BACKUP when identifying what spans to backup and protect.
Previously, we would attempt to "logically" merge spans by
checking if any dropped indexes that have been GC'ed can be
merged over.

This has been the cause of a few subtle bugs as outlined in
#72263.

This change simplifies the merging logic to only merge
adjacent, public index spans into a single span. If there
exist any non-public index IDs between the two public index
IDs, we no longer attempt to merge. In the presence of
dropped indexes this will result in more spans being backed
up and protected than before, but we believe that the simplification
is worth losing the optimization in this case.

This change also fixes an existing bug in the merging logic
where two (or more) public indexes followed by an interleaved
index would result in certain index keys being missed during
backup. A regression test has been added to this effect.

Fixes: #72263

Release note (bug fix): This change fixes two bugs in the
logic that optimized the number of spans to backup.

This change simplifies the index span merging logic used
by BACKUP when identifying what spans to backup and protect.
Previously, we would attempt to "logically" merge spans by
checking if any dropped indexes that have been GC'ed can be
merged over.

This has been the cause of a few subtle bugs as outlined in
cockroachdb#72263.

This change simplifies the merging logic to only merge
adjacent, public index spans into a single span. If there
exist any non-public index IDs between the two public index
IDs, we no longer attempt to merge. In the presence of
dropped indexes this will result in more spans being backed
up and protected than before, but we believe that the simplification
is worth losing the optimization in this case.

This change also fixes an existing bug in the merging logic
where two (or more) public indexes followed by an interleaved
index would result in certain index keys being missed during
backup. A regression test has been added to this effect.

Fixes: cockroachdb#72263

Release note (bug fix): This change fixes two bugs in the
logic that optimized the number of spans to backup.
@adityamaru adityamaru requested review from stevendanna and a team and removed request for a team November 1, 2021 16:55
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@adityamaru
Copy link
Contributor Author

This is a forward port of #72270.

@adityamaru
Copy link
Contributor Author

Filed #72321 for the bazel failure. I want to get this baking on master before we merge the backport so I'm going ahead with the merge.

TFTR!

bors r=stevendanna

@craig
Copy link
Contributor

craig bot commented Nov 2, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Nov 2, 2021

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Nov 2, 2021

Build succeeded:

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: merging over a dropped index span after GC can cause incremental backups to fail
3 participants