Class MinionTaskMetadataUtils


  • public final class MinionTaskMetadataUtils
    extends Object
    Helper methods to fetch/persist ZNRecord for minion task metadata
    • Method Summary

      Modifier and Type Method Description
      static void deleteTaskMetadata​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore, String tableNameWithType)
      Deletes the minion task metadata ZNRecord for the given tableName, from both the new path MINION_TASK_METADATA/${tableNameWthType} and the old path MINION_TASK_METADATA//${tableNameWthType}
      static void deleteTaskMetadata​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore, String taskType, String tableNameWithType)
      Deletes the minion task metadata ZNRecord for the given minion task and tableName, from both the new path MINION_TASK_METADATA/${tableNameWthType}/${taskType} and the old path MINION_TASK_METADATA/${taskType}/${tableNameWthType}.
      static org.apache.helix.zookeeper.datamodel.ZNRecord fetchTaskMetadata​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore, String taskType, String tableNameWithType)
      Fetches the minion task metadata ZNRecord for the given minion task and tableName.
      static Map<String,​Map<String,​Long>> getAllTaskMetadataLastUpdateTimeMs​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore)
      Gets the last update time (in ms) of all minion task metadata.
      static void persistTaskMetadata​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore, String taskType, BaseTaskMetadata taskMetadata, int expectedVersion)
      Generic method for persisting BaseTaskMetadata to MINION_TASK_METADATA.
    • Method Detail

      • fetchTaskMetadata

        @Nullable
        public static org.apache.helix.zookeeper.datamodel.ZNRecord fetchTaskMetadata​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore,
                                                                                      String taskType,
                                                                                      String tableNameWithType)
        Fetches the minion task metadata ZNRecord for the given minion task and tableName. Fetch from the new path MINION_TASK_METADATA/${tableNameWthType}/{taskType} if it exists; otherwise, fetch from the old path MINION_TASK_METADATA/${taskType}/${tableNameWthType}.
      • getAllTaskMetadataLastUpdateTimeMs

        public static Map<String,​Map<String,​Long>> getAllTaskMetadataLastUpdateTimeMs​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore)
        Gets the last update time (in ms) of all minion task metadata.
        Parameters:
        propertyStore - the property store where all minion task metadata is stored.
        Returns:
        a map storing the last update time (in ms) of all minion task metadata: (tableNameWithType -> taskType -> last update time in ms)
      • deleteTaskMetadata

        public static void deleteTaskMetadata​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore,
                                              String taskType,
                                              String tableNameWithType)
        Deletes the minion task metadata ZNRecord for the given minion task and tableName, from both the new path MINION_TASK_METADATA/${tableNameWthType}/${taskType} and the old path MINION_TASK_METADATA/${taskType}/${tableNameWthType}.
      • deleteTaskMetadata

        public static void deleteTaskMetadata​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore,
                                              String tableNameWithType)
        Deletes the minion task metadata ZNRecord for the given tableName, from both the new path MINION_TASK_METADATA/${tableNameWthType} and the old path MINION_TASK_METADATA//${tableNameWthType}
      • persistTaskMetadata

        public static void persistTaskMetadata​(org.apache.helix.store.HelixPropertyStore<org.apache.helix.zookeeper.datamodel.ZNRecord> propertyStore,
                                               String taskType,
                                               BaseTaskMetadata taskMetadata,
                                               int expectedVersion)
        Generic method for persisting BaseTaskMetadata to MINION_TASK_METADATA. The metadata will be saved in the ZNode under the new path /MINION_TASK_METADATA/${tableNameWithType}/${taskType} if it exists or the old path does not exist; otherwise, it will be saved in the ZNode under the old path /MINION_TASK_METADATA/${taskType}/${tableNameWithType}. Will fail if expectedVersion does not match. Set expectedVersion -1 to override version check.