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

db: iterator creation is fallible #2994

Closed
jbowens opened this issue Oct 11, 2023 · 0 comments · Fixed by #3004
Closed

db: iterator creation is fallible #2994

jbowens opened this issue Oct 11, 2023 · 0 comments · Fixed by #3004
Assignees
Labels
A-storage C-bug Something isn't working T-storage

Comments

@jbowens
Copy link
Collaborator

jbowens commented Oct 11, 2023

Relates to #1115.

The pebble Iterator is generally designed to tolerate errors. If an iterator operation errors, resulting in Iterator.Error() returning a non-nil error, the expectation is that the user may seek the Iterator again, and the previous error is cleared. There's at least 1 violation of this contract in which an I/O error encountered during iterator construction results in an Iterator that will always error.

If L0 contains any range keys, each file in L0 containing the range keys is opened during iterator construction. If opening the file encounters an error, then a keyspan.Iter that always errors is used, preventing any Iterator operation from succeeding:

i.rangeKey.iterConfig.AddLevel(&errorKeyspanIter{err: err})

We should not perform any I/O during the iterator creation itself.

@jbowens jbowens added the C-bug Something isn't working label Oct 11, 2023
jbowens added a commit to jbowens/pebble that referenced this issue Oct 11, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 11, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 11, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 11, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 12, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 12, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 13, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 13, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 13, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 13, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small DSL. Future work will build off this to test handling of I/O
errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 16, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small lisp-like DSL. Future work will build off this to test handling
of I/O errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 16, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small lisp-like DSL. Future work will build off this to test handling
of I/O errors during iteration.

Informs cockroachdb#1115.
Informs cockroachdb#2994.
@jbowens jbowens self-assigned this Oct 16, 2023
jbowens added a commit that referenced this issue Oct 16, 2023
We frequently use the errorfs package to inject errors into filesystem
operations to test error code paths. This commit builds off this package to
support encoding error injection conditions within datadriven tests through
parsing a small lisp-like DSL. Future work will build off this to test handling
of I/O errors during iteration.

Informs #1115.
Informs #2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 17, 2023
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 cockroachdb#2994.
jbowens added a commit to jbowens/pebble that referenced this issue Oct 17, 2023
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 cockroachdb#2994.
jbowens added a commit that referenced this issue Oct 20, 2023
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.
@jbowens jbowens moved this to Done in [Deprecated] Storage Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-storage C-bug Something isn't working T-storage
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant