public class RestorableTsFileIOWriter extends TsFileIOWriter
(1) If the TsFile is closed normally, hasCrashed()=false and canWrite()=false
(2) Otherwise, the writer generates metadata for already flushed Chunks and truncate crashed data. The hasCrashed()=true and canWrite()=true
Notice!!! If you want to query this file through the generated metadata, remember to call the makeMetadataVisible()
canWrite, chunkGroupMetadataList, chunkMetadataList, config, file, MAGIC_STRING_BYTES, out, VERSION_NUMBER_BYTE| Constructor and Description |
|---|
RestorableTsFileIOWriter(File file) |
RestorableTsFileIOWriter(File file,
boolean truncate) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSchema(Path path,
IMeasurementSchema schema) |
Map<Path,IMeasurementSchema> |
getKnownSchema() |
long |
getMaxPlanIndex() |
Map<String,Map<String,List<ChunkMetadata>>> |
getMetadatasForQuery() |
long |
getMinPlanIndex() |
List<ChunkMetadata> |
getVisibleMetadataList(String deviceId,
String measurementId,
TSDataType dataType)
For query.
|
static RestorableTsFileIOWriter |
getWriterForAppendingDataOnCompletedTsFile(File file)
Given a TsFile, generate a writable RestorableTsFileIOWriter.
|
boolean |
hasCrashed()
Whether this TsFile is crashed.
|
void |
makeMetadataVisible()
add all appendChunkMetadatas into memory.
|
canWrite, close, endChunkGroup, endCurrentChunk, endFile, filterChunks, getDeviceChunkMetadataMap, getDeviceTimeseriesMetadataMap, getFile, getIOWriterOut, getPos, isWritingChunkGroup, mark, reset, setFile, setMaxPlanIndex, setMinPlanIndex, startChunkGroup, startFile, startFlushChunk, truncate, writeBytesToStream, writeChunk, writePlanIndicespublic RestorableTsFileIOWriter(File file) throws IOException
file - a given tsfile path you want to (continue to) writeIOException - if write failed, or the file is broken but autoRepair==false.public RestorableTsFileIOWriter(File file, boolean truncate) throws IOException
IOExceptionpublic static RestorableTsFileIOWriter getWriterForAppendingDataOnCompletedTsFile(File file) throws IOException
file - a TsFileIOExceptionpublic Map<Path,IMeasurementSchema> getKnownSchema()
public List<ChunkMetadata> getVisibleMetadataList(String deviceId, String measurementId, TSDataType dataType)
get chunks' metadata from memory.
deviceId - the device idmeasurementId - the measurement iddataType - the value typepublic void makeMetadataVisible()
public boolean hasCrashed()
public void addSchema(Path path, IMeasurementSchema schema)
public long getMinPlanIndex()
getMinPlanIndex in class TsFileIOWriterpublic long getMaxPlanIndex()
getMaxPlanIndex in class TsFileIOWriterCopyright © 2022 The Apache Software Foundation. All rights reserved.