Class MetadataUpgrader


  • public class MetadataUpgrader
    extends java.lang.Object
    IoTDB 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
      boolean clearEnvBeforeUpgrade()  
      void clearOldFiles()  
      void redoMLog()  
      void reloadMetadataFromSnapshot()  
      static void upgrade()
      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
      • Methods inherited from class java.lang.Object

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

      • upgrade

        public static void upgrade()
                            throws java.io.IOException
        There are at most four files of old versions:
        1. snapshot: store the base MTree
        2. mlog: store the metadata operations based on the exising metadata stored in snapshot
        3. tag file: store the tag info of timeseries and snapshot and mlog both may hold offsets pointing to some part of this file
        4. 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:

        1. Deserialize the snapshot and recover the MRTree into memory
        2. Try set storage group based on the recovered StorageGroupMNodes and create timeseries based on the recovered MeasurementMNode
        3. Redo the mlog
        4. rename and backup the files in the same directory, the order is:
          1. mlog.bin to mlog.bin.bak
          2. mtree-1.snapshot.bin to mtree-1.snapshot.bin.bak
          3. tlog.txt to tlog.txt.bak
          4. 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