@Override
    public void reportFailedCheckpoint(FailedCheckpointStats failed) {
        statsReadWriteLock.lock();
        try {
            counts.incrementFailedCheckpoints();
            history.replacePendingCheckpointById(failed);

            dirty = true;
            logCheckpointStatistics(failed);

            if (checkpointStatsListener != null) {
                checkpointStatsListener.onFailedCheckpoint();
            }
        } finally {
            statsReadWriteLock.unlock();
        }
    }
@Test
    void testCheckpointStatsListenerOnFailedCheckpoint() {
        testCheckpointStatsListener(
                (checkpointStatsTracker, pendingCheckpointStats) ->
                        checkpointStatsTracker.reportFailedCheckpoint(
                                pendingCheckpointStats.toFailedCheckpoint(
                                        System.currentTimeMillis(), null)),
                0,
                1);
    }