Skip to content

Commit

Permalink
storageccl: tolerate rewriting span keys ending in interleaved sentinel
Browse files Browse the repository at this point in the history
Some index span keys have been observed to end with the interleaved
sentinel value. It is not yet clear how these types of keys are created
but from the perspective of the key-rewriter it has rewritten the key.

Release note (sql change): Fix a bug in RESTORE where some unusual range
boundaries in interleaved tables caused an error.
  • Loading branch information
pbardea committed Jan 4, 2021
1 parent f0d97d7 commit 5620822
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/ccl/storageccl/key_rewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ func (kr *KeyRewriter) RewriteKey(key []byte, isFromSpan bool) ([]byte, bool, er
if !ok {
return key, true, nil
}
if len(k) == 0 {
// We have seen some span keys end in an interleaved sentinel.
// Check if we ran out of key before getting to an interleave child?
return key, true, nil
}
prefix := key[:len(key)-len(k)]
k, ok, err = kr.RewriteKey(k, isFromSpan)
if err != nil {
Expand Down

0 comments on commit 5620822

Please sign in to comment.