### Question:
TableWriter implements Closeable { private long openAppend(LPSZ name) { long fd = ff.openAppend(name); if (fd == -1) { throw CairoException.instance(Os.errno()).put("Cannot open for append: ").put(name); } return fd; } TableWriter(CairoConfiguration configuration, CharSequence name);  TableWriter(CairoConfiguration configuration, CharSequence name, MessageBus messageBus);  TableWriter(
            CairoConfiguration configuration,
            CharSequence name,
            @Nullable MessageBus messageBus,
            boolean lock,
            LifecycleManager lifecycleManager
    );  TableWriter(
            CairoConfiguration configuration,
            CharSequence name,
            @Nullable MessageBus messageBus,
            boolean lock,
            LifecycleManager lifecycleManager,
            CharSequence root
    ); static TimestampFormat selectPartitionDirFmt(int partitionBy); void addColumn(CharSequence name, int type); void addColumn(
            CharSequence name,
            int type,
            int symbolCapacity,
            boolean symbolCacheFlag,
            boolean isIndexed,
            int indexValueBlockCapacity,
            boolean isSequential
    ); void addIndex(CharSequence columnName, int indexValueBlockSize); void changeCacheFlag(int columnIndex, boolean cache); @Override void close(); void commit(); void commit(int commitMode); int getColumnIndex(CharSequence name); long getMaxTimestamp(); RecordMetadata getMetadata(); CharSequence getName(); int getPartitionBy(); long getStructureVersion(); boolean inTransaction(); boolean isOpen(); Row newRow(long timestamp); Row newRow(); long partitionNameToTimestamp(CharSequence partitionName); void removeColumn(CharSequence name); void renameColumn(CharSequence currentName, CharSequence newName); boolean removePartition(long timestamp); void rollback(); void setLifecycleManager(LifecycleManager lifecycleManager); long size(); @Override String toString(); void transferLock(long lockFd); final void truncate(); void updateMetadataVersion(); void warmUp();  }### Answer:
@Test public void testAddColumnTopFileWriteFail() throws Exception { testAddColumnRecoverableFault(new FilesFacadeImpl() { long fd = -1; @Override public long append(long fd, long buf, int len) { if (fd == this.fd) { this.fd = -1; return -1; } return super.append(fd, buf, len); } @Override public long openAppend(LPSZ name) { if (Chars.endsWith(name, "abc.top")) { return fd = super.openAppend(name); } return super.openAppend(name); } }); }
@Test public void testFailureToOpenArchiveFile() throws Exception { testCommitRetryAfterFailure(new CountingFilesFacade() { @Override public long openAppend(LPSZ name) { if (--count < 1L) { return -1; } return super.openAppend(name); } }); }
@Test public void testFailureToWriteArchiveFile() throws Exception { testCommitRetryAfterFailure(new CountingFilesFacade() { long fd = -1; @Override public long openAppend(LPSZ name) { if (--count < 1L) { return fd = super.openAppend(name); } return super.openAppend(name); } @Override public long write(long fd, long address, long len, long offset) { if (fd == this.fd) { this.fd = -1; return -1; } return super.write(fd, address, len, offset); } }); }