-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db: defer loading L0 range key blocks during iterator construction
Previously, construction of an iterator over range keys that found sstables containing range keys within L0 performed I/O to load the range key blocks during iterator construction. This was less efficient: If the iterator ultimately didn't need to read the keyspace overlapping the sstables containing range keys, the block loads were unnecessary. More significantly, if the I/O failed during iterator construction, the resulting iterator was unusable. It would always error with the original error returned by the failed block load. This is a deviation from iterator error handling across the rest of the iterator stack, which allows an Iterator to be re-seeked to clear the current iterator error. Resolves #2994.
- Loading branch information
Showing
4 changed files
with
116 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,3 +57,43 @@ b: (b, .) | |
c: (c, .) | ||
d: (d, .) | ||
. | ||
|
||
# Regression test for #2994. | ||
# | ||
# Previously, an error while loading an L0 sstable's range key block could | ||
# result in an iterator that would always return the same error. Now, the IO is | ||
# deferred to the first seek. If a seek encounters an IO error, re-seeking the | ||
# iterator should re-attempt the failed IO operation, potentially succeeding if | ||
# the IO error was transient. | ||
|
||
define auto-compactions=off | ||
L0 | ||
a.SET.9:a | ||
rangekey:c-d:{(#0,RANGEKEYSET,@1,foo)} | ||
[email protected]:e@2 | ||
---- | ||
0.0: | ||
000004:[a#9,SET-e@2#2,SET] | ||
|
||
layout filename=000004.sst | ||
---- | ||
0 data (38) | ||
43 index (35) | ||
83 range-key (29) | ||
117 properties (645) | ||
767 meta-index (57) | ||
829 footer (53) | ||
882 EOF | ||
|
||
# Inject an error on the first `ReadAt` call on 000004.sst's range key block | ||
# (which is at offset 83). | ||
|
||
reopen auto-compactions=off enable-table-stats=false inject-errors=((ErrInjected (And (PathMatch "000004.sst") (OpFileReadAt 83) (OnIndex 0)))) | ||
---- | ||
|
||
combined-iter | ||
first | ||
first | ||
---- | ||
err=injected error | ||
a: (a, .) |