@Test
  public void testCloseWALSplitInterrupted() throws IOException {
    RecoveredEditsOutputSink spyOutputSink = Mockito.spy(outputSink);
    // The race condition will lead to an InterruptedException to be caught by finishWriterThreads()
    // which is then rethrown as an InterruptedIOException.
    Mockito.doThrow(new InterruptedIOException()).when(spyOutputSink).finishWriterThreads();
    assertThrows(InterruptedIOException.class, spyOutputSink::close);
    Mockito.verify(spyOutputSink, Mockito.times(1)).finishWriterThreads();
    Mockito.verify(spyOutputSink, Mockito.times(1)).closeWriters(false);
  }
When a WAL split is interrupted (ex. by a RegionServer abort), the thread join in
finishWriterThreads() will get interrupted, rethrowing the exception without stopping the
writer threads. Test to ensure that when this happens, RecoveredEditsOutputSink.close() does
not rename the recoveredEdits WAL files as this can cause corruption. Please see HBASE-28569.
However, the writers must still be closed.
hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestRecoveredEditsOutputSink.java