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

release-20.1: kv/kvserver: Remove buffering from SSTSnapshotStorageFile #50847

Merged
merged 1 commit into from
Jun 30, 2020

Conversation

itsbilal
Copy link
Member

Backport 1/1 commits from #50831.

/cc @cockroachdb/release


When investigating a durability violation around ingested sstables
that disappeared after a power outage, we realized that
SSTSnapshotStorageFile does not flush its buffer before doing
a Sync(). When used with a pebble SSTWriter, we expect Sync()
to ensure all bytes written to that file are synced to disk,
which is not what was happening here for the last couple bytes
written to the buffer.

This change removes buffering from SSTSnapshotStorageFile
as pebble's SST writer already does its own buffering. This
makes Sync() do what it is expected to do.

Release note (bug fix): Fix a bug where a badly timed power outage
or system crash could result in an error upon process restart.

When investigating a durability violation around ingested sstables
that disappeared after a power outage, we realized that
SSTSnapshotStorageFile does not flush its buffer before doing
a Sync(). When used with a pebble SSTWriter, we expect Sync()
to ensure all bytes written to that file are synced to disk,
which is not what was happening here for the last couple bytes
written to the buffer.

This change removes buffering from SSTSnapshotStorageFile
as pebble's SST writer already does its own buffering. This
makes Sync() do what it is expected to do.

Release note (bug fix): Fix a bug where a badly timed power outage
or system crash could result in an error upon process restart.
@itsbilal itsbilal self-assigned this Jun 30, 2020
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@petermattis petermattis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Did you check whether this bug existed in 19.2?

@itsbilal
Copy link
Member Author

TFTR!

And yes, I just checked. It seems like snapshots aren't applied through ingestions in 19.2 at all - we seem to be doing ApplyBatchRepr's and then following the batch commit pipeline. All of that stuff seems safe enough.

@itsbilal
Copy link
Member Author

Nevermind, that was 19.1. Checking 19.2 right now.

@itsbilal
Copy link
Member Author

Yep, in 19.2 we just use RocksDB's DBFile->Append() and ->Close(), and the WritableFileWriter definitely seems to be syncing on close, so this bug doesn't exist there.

@itsbilal itsbilal merged commit 9c486c5 into cockroachdb:release-20.1 Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants