refactor(ingester): Only automatically recover when encountering `IncompleteEntry` during wal replay
parent
73533a71fa
commit
36604d30ae
|
@ -214,7 +214,12 @@ where
|
||||||
let segment_id = batches.id();
|
let segment_id = batches.id();
|
||||||
|
|
||||||
for batch in batches {
|
for batch in batches {
|
||||||
if let Err(err @ wal::Error::UnableToReadNextOps { .. }) = batch {
|
if let Err(
|
||||||
|
err @ wal::Error::UnableToReadNextOps {
|
||||||
|
source: wal::blocking::ReaderError::IncompleteEntry { .. },
|
||||||
|
},
|
||||||
|
) = batch
|
||||||
|
{
|
||||||
error!(%err, ?segment_id, "unable to recover further op batches from wal segment");
|
error!(%err, ?segment_id, "unable to recover further op batches from wal segment");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -618,7 +623,12 @@ mod tests {
|
||||||
Ok([arbitrary_sequenced_wal_op(SequenceNumber::new(2))]
|
Ok([arbitrary_sequenced_wal_op(SequenceNumber::new(2))]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect()),
|
.collect()),
|
||||||
Err(wal::Error::SegmentFileIdentifierMismatch {}),
|
Err(wal::Error::UnableToReadNextOps {
|
||||||
|
source: wal::blocking::ReaderError::ChecksumMismatch {
|
||||||
|
expected: 1,
|
||||||
|
actual: 2,
|
||||||
|
},
|
||||||
|
}),
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect::<VecDeque<_>>(),
|
.collect::<VecDeque<_>>(),
|
||||||
|
@ -657,9 +667,11 @@ mod tests {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect()),
|
.collect()),
|
||||||
Err(wal::Error::UnableToReadNextOps {
|
Err(wal::Error::UnableToReadNextOps {
|
||||||
source: wal::blocking::ReaderError::LengthMismatch {
|
source: wal::blocking::ReaderError::IncompleteEntry {
|
||||||
expected: 1,
|
source: std::io::Error::new(
|
||||||
actual: 2,
|
std::io::ErrorKind::UnexpectedEof,
|
||||||
|
"gremlins in the drive",
|
||||||
|
),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|
|
@ -164,7 +164,7 @@ pub enum Error {
|
||||||
source: io::Error,
|
source: io::Error,
|
||||||
},
|
},
|
||||||
|
|
||||||
/// An [`IncompleteEntry`] error is returned when the reader is unable to
|
/// An [`Error::IncompleteEntry`] error is returned when the reader is unable to
|
||||||
/// read an entry because of an unexpected end of file.
|
/// read an entry because of an unexpected end of file.
|
||||||
IncompleteEntry {
|
IncompleteEntry {
|
||||||
source: io::Error,
|
source: io::Error,
|
||||||
|
|
Loading…
Reference in New Issue