Class MobFileName

java.lang.Object
org.apache.hadoop.hbase.mob.MobFileName

@Private public final class MobFileName extends Object
The mob file name. It consists of a md5 of a start key, a date, uuid and encoded region name. It looks like md5(start) + date + uuid+ "_" + encoded region name.
  1. characters 0-31: md5 hex string of a start key. Since the length of the start key is not fixed, have to use the md5 instead which has a fix length.
  2. characters 32-39: a string of a date with format yyyymmdd. The date is the latest timestamp of cells in this file
  3. the remaining characters: the uuid.
Using md5 hex string of start key as the prefix of file name makes files with the same start key unique, they're different from the ones with other start keys The cells come from different regions might be in the same mob file by region split, this is allowed. Has the latest timestamp of cells in the file name in order to clean the expired mob files by TTL easily. If this timestamp is older than the TTL, it's regarded as expired.
  • Field Details

  • Constructor Details

    • MobFileName

      private MobFileName(byte[] startKey, String date, String uuid, String regionName)
      Creates an instance of MobFileName
      Parameters:
      startKey - The start key.
      date - The string of the latest timestamp of cells in this file, the format is yyyymmdd.
      uuid - The uuid
      regionName - name of a region, where this file was created during flush or compaction.
    • MobFileName

      private MobFileName(String startKey, String date, String uuid, String regionName)
      Creates an instance of MobFileName
      Parameters:
      startKey - The md5 hex string of the start key.
      date - The string of the latest timestamp of cells in this file, the format is yyyymmdd.
      uuid - The uuid
      regionName - name of a region, where this file was created during flush or compaction.
  • Method Details

    • create

      public static MobFileName create(byte[] startKey, String date, String uuid, String regionName)
      Creates an instance of MobFileName
      Parameters:
      startKey - The md5 hex string of the start key.
      date - The string of the latest timestamp of cells in this file, the format is yyyymmdd.
      uuid - The uuid.
      regionName - name of a region, where this file was created during flush or compaction.
      Returns:
      An instance of a MobFileName.
    • create

      public static MobFileName create(String startKey, String date, String uuid, String regionName)
      Creates an instance of MobFileName
      Parameters:
      startKey - The md5 hex string of the start key.
      date - The string of the latest timestamp of cells in this file, the format is yyyymmdd.
      uuid - The uuid.
      regionName - name of a region, where this file was created during flush or compaction.
      Returns:
      An instance of a MobFileName.
    • create

      public static MobFileName create(String fileName)
      Creates an instance of MobFileName.
      Parameters:
      fileName - The string format of a file name.
      Returns:
      An instance of a MobFileName.
    • isOldMobFileName

      public static boolean isOldMobFileName(String name)
    • getStartKeyFromName

      public static String getStartKeyFromName(String fileName)
      get startKey from MobFileName.
      Parameters:
      fileName - file name.
    • getDateFromName

      public static String getDateFromName(String fileName)
      get date from MobFileName.
      Parameters:
      fileName - file name.
    • getStartKey

      public String getStartKey()
      Gets the hex string of the md5 for a start key.
      Returns:
      The hex string of the md5 for a start key.
    • getRegionName

      Gets region name
      Returns:
      name of a region, where this file was created during flush or compaction.
    • getDate

      public String getDate()
      Gets the date string. Its format is yyyymmdd.
      Returns:
      The date string.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object anObject)
      Overrides:
      equals in class Object
    • getFileName

      public String getFileName()
      Gets the file name.
      Returns:
      The file name.