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 #4538pull/4580/head
parent
c01e768253
commit
4afb98ba8b
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue