cockroachdb / cockroachdb/pebble

db: reconsider commit error handling

Open
#6,004 0 comments 0 reactions 0 assignees View on GitHub
A-storage T-storage
Dominant language
Go
Stars
6k
Forks
584
Avg merge
16h 35m
Merged PRs (30d)
5

Description

`commitWrite` currently panics on synchronous `WriteRecord` errors:
https://github.com/cockroachdb/pebble/blob/f140dd54cbbd13570623d1f58ac1476ec68f8c04/db.go#L951

The only way this can error is if `w.err` is set here:
https://github.com/cockroachdb/pebble/blob/b189a4ea6626b93a5731975b5bd25e48667058c8/record/log_writer.go#L975

`w.err` is set on close and when the flusher is in error state when we queue a block:
https://github.com/cockroachdb/pebble/blob/b189a4ea6626b93a5731975b5bd25e48667058c8/record/log_writer.go#L863

However, the flusher retries, so it's unclear that we should be exposing this error at all.

The error handling when `commitWrite` (as the `commitEnv.write` callback) returns an error is incomplete, at least when the error is `ErrInvalidBatch`.

See https://github.com/cockroachdb/pebble/pull/5984

Jira issue: PEBBLE-1429

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.