Class OSSRecoverableFsDataOutputStream

java.lang.Object
java.io.OutputStream
org.apache.flink.core.fs.FSDataOutputStream
org.apache.flink.core.fs.RecoverableFsDataOutputStream
org.apache.flink.fs.osshadoop.writer.OSSRecoverableFsDataOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

@PublicEvolving @NotThreadSafe public class OSSRecoverableFsDataOutputStream extends org.apache.flink.core.fs.RecoverableFsDataOutputStream
A RecoverableFsDataOutputStream to OSS that is based on a recoverable multipart upload.

This class is NOT thread-safe. Concurrent writes tho this stream result in corrupt or lost data.

The close() method may be called concurrently when cancelling / shutting down. It will still ensure that local transient resources (like streams and temp files) are cleaned up, but will not touch data previously persisted in OSS.

  • Constructor Details

    • OSSRecoverableFsDataOutputStream

      public OSSRecoverableFsDataOutputStream(long ossUploadPartSize, org.apache.flink.util.function.FunctionWithException<File,org.apache.flink.core.fs.RefCountedFileWithStream,IOException> cachedFileCreator, OSSRecoverableMultipartUpload upload, long sizeBeforeCurrentPart) throws IOException
      Throws:
      IOException
  • Method Details

    • persist

      public org.apache.flink.core.fs.RecoverableWriter.ResumeRecoverable persist() throws IOException
      Specified by:
      persist in class org.apache.flink.core.fs.RecoverableFsDataOutputStream
      Throws:
      IOException
    • closeForCommit

      public org.apache.flink.core.fs.RecoverableFsDataOutputStream.Committer closeForCommit() throws IOException
      Specified by:
      closeForCommit in class org.apache.flink.core.fs.RecoverableFsDataOutputStream
      Throws:
      IOException
    • getPos

      public long getPos() throws IOException
      Specified by:
      getPos in class org.apache.flink.core.fs.FSDataOutputStream
      Throws:
      IOException
    • write

      public void write(int b) throws IOException
      Specified by:
      write in class OutputStream
      Throws:
      IOException
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Overrides:
      write in class OutputStream
      Throws:
      IOException
    • flush

      public void flush() throws IOException
      Specified by:
      flush in interface Flushable
      Specified by:
      flush in class org.apache.flink.core.fs.FSDataOutputStream
      Throws:
      IOException
    • sync

      public void sync() throws IOException
      Specified by:
      sync in class org.apache.flink.core.fs.FSDataOutputStream
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in class org.apache.flink.core.fs.RecoverableFsDataOutputStream
      Throws:
      IOException