Class AbstractTsFileRecoverPerformer
- java.lang.Object
-
- org.apache.iotdb.db.wal.recover.file.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.CloseableThis class is used to help recover TsFile
-
-
Field Summary
Fields Modifier and Type Field Description protected TsFileResourcetsFileResourceTsFile which needs recoveryprotected org.apache.iotdb.tsfile.write.writer.RestorableTsFileIOWriterwriterthis writer will be open when .resource file doesn't exist
-
Constructor Summary
Constructors Constructor Description AbstractTsFileRecoverPerformer(TsFileResource tsFileResource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanWrite()voidclose()booleanhasCrashed()protected voidreconstructResourceFile()protected voidrecoverWithWriter()Recover TsFile with RestorableTsFileIOWriter, including load .resource file (reconstruct when necessary) and truncate the file to remaining corrected data.
-
-
-
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.IOExceptionRecover TsFile with RestorableTsFileIOWriter, including load .resource file (reconstruct when necessary) and truncate the file to remaining corrected data.
Notice: this method may open aRestorableTsFileIOWriter, remember to close it.- Throws:
DataRegionExceptionjava.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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-