Class MetadataUpgrader
- java.lang.Object
-
- org.apache.iotdb.db.metadata.upgrade.MetadataUpgrader
-
public class MetadataUpgrader extends java.lang.ObjectIoTDB after v0.13 only support upgrade from v0.12x. This class implements the upgrade program.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanclearEnvBeforeUpgrade()voidclearOldFiles()voidredoMLog()voidreloadMetadataFromSnapshot()static voidupgrade()There are at most four files of old versions: snapshot: store the base MTree mlog: store the metadata operations based on the exising metadata stored in snapshot tag file: store the tag info of timeseries and snapshot and mlog both may hold offsets pointing to some part of this file tmp snapshot: a tmp file generated during the process of creating snapshot; this file is useless
-
-
-
Method Detail
-
upgrade
public static void upgrade() throws java.io.IOExceptionThere are at most four files of old versions:- snapshot: store the base MTree
- mlog: store the metadata operations based on the exising metadata stored in snapshot
- tag file: store the tag info of timeseries and snapshot and mlog both may hold offsets pointing to some part of this file
- tmp snapshot: a tmp file generated during the process of creating snapshot; this file is useless
The purpose of upgrader is to recover metadata from the existing files and split and store them into files in certain storage group dirs. The upgrader will execute the following steps in order:
- Deserialize the snapshot and recover the MRTree into memory
- Try set storage group based on the recovered StorageGroupMNodes and create timeseries based on the recovered MeasurementMNode
- Redo the mlog
- rename and backup the files in the same directory, the order is:
- mlog.bin to mlog.bin.bak
- mtree-1.snapshot.bin to mtree-1.snapshot.bin.bak
- tlog.txt to tlog.txt.bak
- mtree-1.snapshot.bin.tmp to mtree-1.snapshot.bin.tmp.bak
- Throws:
java.io.IOException
-
clearEnvBeforeUpgrade
public boolean clearEnvBeforeUpgrade() throws java.io.IOException- Throws:
java.io.IOException
-
clearOldFiles
public void clearOldFiles() throws java.io.IOException- Throws:
java.io.IOException
-
reloadMetadataFromSnapshot
public void reloadMetadataFromSnapshot() throws java.io.IOException- Throws:
java.io.IOException
-
redoMLog
public void redoMLog() throws java.io.IOException- Throws:
java.io.IOException
-
-