Commit 3e712ab
Fix handling of consecutive sentinel values
Summary:
For partial indexes, it is possible to have consecutive sentinel values, and the code to skip over sentinel values during iteration does not handle this correctly.
eg. If we have have the following data:
```
a b
1 1 (sentinel)
1 2 (sentinel)
1 2 1
1 2 2
```
`get_prefix_from_start` returns `(1, 2)` as the group we expect to see (since `(1, 1)` group is empty on the primary key). A seek to `a >=1` on the secondary key would land on `(1, 1)`, but we skip this key since we detect that it's a sentinel value. The cursor is then on `(1, 2)` which matches the expected prefix, and we start reading from the SK from that position. However, this is also a sentinel value, and will not decode correctly. This leads to these errors:
```
ERROR 1296 (HY000): Got error 505 'Found data corruption.' from ROCKSDB
```
The fix is to use a while loop to skip over sentinel values. There are two other places where we skip over sentinel values, but they are not problematic since they are used for iterating over a non-empty groups (so consecutive sentinel values are not possible). I decided not to add while loops defensively in the other places, so that we fail loudly if something unexpected happens.
Ideally, we should just seek directly to the first group that we got from the PK (which guarantees a non-empty group, similar to other cases), but this is a more involved change for later.
Differential Revision: D463527471 parent 51b7372 commit 3e712ab
File tree
4 files changed
+18
-1
lines changed- mysql-test/suite/rocksdb
- r
- t
- storage/rocksdb
4 files changed
+18
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
234 | 235 | | |
235 | 236 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
80 | 89 | | |
81 | 90 | | |
82 | 91 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
857 | | - | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
858 | 861 | | |
859 | 862 | | |
860 | 863 | | |
| |||
0 commit comments