Class TsFileOnlineUpgradeTool
- java.lang.Object
-
- org.apache.iotdb.db.tools.TsFileSplitByPartitionTool
-
- org.apache.iotdb.db.tools.upgrade.TsFileOnlineUpgradeTool
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class TsFileOnlineUpgradeTool extends TsFileSplitByPartitionTool
-
-
Field Summary
-
Fields inherited from class org.apache.iotdb.db.tools.TsFileSplitByPartitionTool
defaultTimeDecoder, maxPlanIndex, minPlanIndex, modsIterator, oldModification, oldTsFile, oldTsFileResource, partitionWriterMap, reader, valueDecoder
-
-
Constructor Summary
Constructors Constructor Description TsFileOnlineUpgradeTool(TsFileResource resourceToBeUpgraded)Create a file reader of the given file.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckIfNeedToDecode(org.apache.iotdb.tsfile.file.metadata.enums.TSDataType dataType, org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding encoding, org.apache.iotdb.tsfile.file.header.PageHeader pageHeader, org.apache.iotdb.tsfile.write.schema.MeasurementSchema schema, java.lang.String deviceId, long chunkHeaderOffset)Due to TsFile version-3 changed the serialize way of integer in TEXT data and INT32 data with PLAIN encoding, and also add a sum statistic for BOOLEAN data, these types of data need to decode to points and rewrite in new TsFile.protected voiddecodeAndWritePage(org.apache.iotdb.tsfile.write.schema.MeasurementSchema schema, java.nio.ByteBuffer pageData, java.util.Map<java.lang.Long,org.apache.iotdb.tsfile.write.chunk.ChunkWriterImpl> partitionChunkWriterMap)protected booleanfileCheck()check if the file to be upgraded has correct magic strings and version numberstatic voidupgradeOneTsFile(TsFileResource resourceToBeUpgraded, java.util.List<TsFileResource> upgradedResources)upgrade a single TsFile.java.lang.StringupgradeTsFileName(java.lang.String oldTsFileName)TsFileName is changing like from 1610635230693-1-0.tsfile to 1610635230693-1-0-0.tsfile-
Methods inherited from class org.apache.iotdb.db.tools.TsFileSplitByPartitionTool
checkIfNeedToDecode, close, decodeAndWritePage, endChunkGroup, endFileAndGenerateResource, getOrDefaultTsFileIOWriter, parseAndRewriteFile, reWriteChunk, rewritePageIntoFiles, rewriteTsFile, writePage
-
-
-
-
Constructor Detail
-
TsFileOnlineUpgradeTool
public TsFileOnlineUpgradeTool(TsFileResource resourceToBeUpgraded) throws java.io.IOException
Create a file reader of the given file. This reader will read the old file and rewrite it to a new format(v3) file- Parameters:
resourceToBeUpgraded- the old tsfile resource which need to be upgrade- Throws:
java.io.IOException- If some I/O error occurs
-
-
Method Detail
-
upgradeOneTsFile
public static void upgradeOneTsFile(TsFileResource resourceToBeUpgraded, java.util.List<TsFileResource> upgradedResources) throws java.io.IOException, org.apache.iotdb.tsfile.exception.write.WriteProcessException
upgrade a single TsFile.- Parameters:
resourceToBeUpgraded- the old file's resource which need to be upgrade.upgradedResources- new version tsFiles' resources- Throws:
java.io.IOExceptionorg.apache.iotdb.tsfile.exception.write.WriteProcessException
-
upgradeTsFileName
public java.lang.String upgradeTsFileName(java.lang.String oldTsFileName)
TsFileName is changing like from 1610635230693-1-0.tsfile to 1610635230693-1-0-0.tsfile- Overrides:
upgradeTsFileNamein classTsFileSplitByPartitionTool
-
checkIfNeedToDecode
protected boolean checkIfNeedToDecode(org.apache.iotdb.tsfile.file.metadata.enums.TSDataType dataType, org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding encoding, org.apache.iotdb.tsfile.file.header.PageHeader pageHeader, org.apache.iotdb.tsfile.write.schema.MeasurementSchema schema, java.lang.String deviceId, long chunkHeaderOffset) throws org.apache.iotdb.commons.exception.IllegalPathExceptionDue to TsFile version-3 changed the serialize way of integer in TEXT data and INT32 data with PLAIN encoding, and also add a sum statistic for BOOLEAN data, these types of data need to decode to points and rewrite in new TsFile.- Throws:
org.apache.iotdb.commons.exception.IllegalPathException
-
decodeAndWritePage
protected void decodeAndWritePage(org.apache.iotdb.tsfile.write.schema.MeasurementSchema schema, java.nio.ByteBuffer pageData, java.util.Map<java.lang.Long,org.apache.iotdb.tsfile.write.chunk.ChunkWriterImpl> partitionChunkWriterMap) throws java.io.IOException- Throws:
java.io.IOException
-
fileCheck
protected boolean fileCheck() throws java.io.IOExceptioncheck if the file to be upgraded has correct magic strings and version number- Overrides:
fileCheckin classTsFileSplitByPartitionTool- Throws:
java.io.IOException
-
-