release-23.1.9-rc: backupccl: during restore, do not .Next() any keys in makeSimpleImportSpans #109939
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 1/1 commits from #109750 on behalf of @rhu713.
/cc @cockroachdb/release
Previously, if
bulkio.restore.use_simple_import_spans
was true duringrestore, makeSimpleImportSpans called .Next() on all end keys of its input
file spans in order to handle the fact that these spans are end keys are end
key inclusive. This resulted in some spans having start or end keys that are
not valid for splitting. This patch removes all .Next() calls in
makeSimpleImportSpans, and instead addresses the end key inclusive file spans
by constantly keeping track of all files that do not have their end points
covered as the covering is created, and immediately populating the next cover
entry with these files.
This fixes an issue where a split can be called on an invalid key that's in the
form of someValidKey.Next() during restore. These invalid keys will generally
have a NULL at the end of the key, which will result in an error when calling
EnsureSafeSplits on this split key. Currently errors from EnsureSafeSplits
are ignored, and thus a split will always be attempted on this type of invalid
split key. This split key can land in the middle of a row with column families,
and thus result in failing SQL queries when querying the restored table.
This patch adds some additional testing for backup manifest file entries with
zero sized spans. The previous .Next() called on all file spans meant that
there were no zero sized spans, so backups with these types of files were
under tested.
Informs: #109483
Release note (bug fix): Fixes an issue where a split can be called on an
invalid key that's in the form of someValidKey.Next() during restore
with
bulkio.restore.use_simple_import_spans=true
. Thissplit key can land in the middle of a row with column families, and thus result
in failing SQL queries when querying the restored table.
Release justification: fixes a severe bug in a default-disabled codepath