Return error instead of panicing if we can't create a new WAL segment

If a drop database is executed while writes are in flight, a panic
could occur because the WAL would fail to write to the DB dirs where
had been removed.

Partil fix for #4538
pull/4580/head
Jason Wilder 2015-10-26 09:35:05 -06:00
parent c01e768253
commit 4afb98ba8b
1 changed files with 3 additions and 2 deletions

View File

@ -431,8 +431,9 @@ func (l *Log) writeToLog(writeType walEntryType, data []byte) error {
if l.currentSegmentFile == nil || l.currentSegmentSize > DefaultSegmentSize {
if err := l.newSegmentFile(); err != nil {
// fail hard since we can't write data
panic(fmt.Sprintf("error opening new segment file for wal: %s", err.Error()))
// A drop database or RP call could trigger this error if writes were in-flight
// when the drop statement executes.
return fmt.Errorf("error opening new segment file for wal: %s", err.Error())
}
}