cockroachdb / cockroachdb/pebble
db: better testing of error handling pathways
- Dominant language
- Go
- Stars
- 6k
- Forks
- 584
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 5
Description
cockroachdb/cockroach#63847 is likely an example of improper error handling introducing corruption. As a part of the quality initiative, we should make an effort to audit and improve testing of error handling code paths.
We currently have some existing tests like [TestIngestError](https://github.com/cockroachdb/pebble/blob/108cd0260986c5972d20bd807a4d7192d912c97a/ingest_test.go#L581) that try injecting an error at every _i_-th operation. There are probably more code paths that deserve this testing treatment. That particular test, `TestIngestError`, might also benefit from more assertions around the state of the resulting DB.
The metamorphic test has an [`-error-rate`](https://github.com/cockroachdb/pebble/blob/master/internal/metamorphic/meta_test.go#L53-L54) that will inject errors into _read-only_ operations and automatically retry them, but it currently defaults off. We can update it to default to some low rate.
Related to #270.
Jira issue: PEBBLE-212
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with TestIngestError in ingest_test.go and the -error-rate handling in internal/metamorphic/meta_test.go. Review how these tests inject errors and what database state they assert, then identify additional error-handling paths that need similar coverage. Done means stronger state assertions and a low default error rate for the metamorphic test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- database, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100