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

storage: fix possible raft log panic after fsync error #37102

Merged
merged 1 commit into from
Apr 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pkg/storage/engine/rocksdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ func (r *RocksDB) syncLoop() {
s.Lock()

var lastSync time.Time
var err error

for {
for len(s.pending) == 0 && !s.closed {
Expand All @@ -713,8 +714,14 @@ func (r *RocksDB) syncLoop() {

s.Unlock()

var err error
if r.cfg.Dir != "" {
// Linux only guarantees we'll be notified of a writeback error once
// during a sync call. After sync fails once, we cannot rely on any
// future data written to WAL being crash-recoverable. That's because
// any future writes will be appended after a potential corruption in
// the WAL, and RocksDB's recovery terminates upon encountering any
// corruption. So, we must not call `DBSyncWAL` again after it has
// failed once.
if r.cfg.Dir != "" && err == nil {
err = statusToError(C.DBSyncWAL(r.rdb))
lastSync = timeutil.Now()
}
Expand Down