Class AbstractTsFileRecoverPerformer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    SealedTsFileRecoverPerformer, UnsealedTsFileRecoverPerformer

    public abstract class AbstractTsFileRecoverPerformer
    extends java.lang.Object
    implements java.io.Closeable
    This class is used to help recover TsFile
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected TsFileResource tsFileResource
      TsFile which needs recovery
      protected org.apache.iotdb.tsfile.write.writer.RestorableTsFileIOWriter writer
      this writer will be open when .resource file doesn't exist
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canWrite()  
      void close()  
      boolean hasCrashed()  
      protected void reconstructResourceFile()  
      protected void recoverWithWriter()
      Recover TsFile with RestorableTsFileIOWriter, including load .resource file (reconstruct when necessary) and truncate the file to remaining corrected data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • tsFileResource

        protected final TsFileResource tsFileResource
        TsFile which needs recovery
      • writer

        protected org.apache.iotdb.tsfile.write.writer.RestorableTsFileIOWriter writer
        this writer will be open when .resource file doesn't exist
    • Constructor Detail

      • AbstractTsFileRecoverPerformer

        public AbstractTsFileRecoverPerformer​(TsFileResource tsFileResource)
    • Method Detail

      • recoverWithWriter

        protected void recoverWithWriter()
                                  throws DataRegionException,
                                         java.io.IOException
        Recover TsFile with RestorableTsFileIOWriter, including load .resource file (reconstruct when necessary) and truncate the file to remaining corrected data.
        Notice: this method may open a RestorableTsFileIOWriter, remember to close it.
        Throws:
        DataRegionException
        java.io.IOException
      • reconstructResourceFile

        protected void reconstructResourceFile()
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • hasCrashed

        public boolean hasCrashed()
      • canWrite

        public boolean canWrite()
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException