Increments WAL corruption metric on WAL corruption during checkpointing (#7491)

* Increments wal corruption metric on error during checkpointing

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>

* check for wal corruption error

Signed-off-by: Harkishen-Singh <harkishensingh@hotmail.com>
This commit is contained in:
Harkishen Singh 2020-07-05 11:25:42 +05:30 committed by GitHub
parent e65e2e0dac
commit f32307b656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -837,6 +837,9 @@ func (h *Head) Truncate(mint int64) (err error) {
h.metrics.checkpointCreationTotal.Inc()
if _, err = wal.Checkpoint(h.wal, first, last, keep, mint); err != nil {
h.metrics.checkpointCreationFail.Inc()
if _, ok := errors.Cause(err).(*wal.CorruptionErr); ok {
h.metrics.walCorruptionsTotal.Inc()
}
return errors.Wrap(err, "create checkpoint")
}
if err := h.wal.Truncate(last + 1); err != nil {