Class TriggerManager

java.lang.Object
org.apache.iotdb.confignode.manager.TriggerManager

public class TriggerManager extends Object
  • Constructor Details

  • Method Details

    • getTriggerInfo

      public TriggerInfo getTriggerInfo()
    • createTrigger

      public TSStatus createTrigger(TCreateTriggerReq req)
      Create a trigger in cluster.

      If TriggerType is STATELESS, we should create TriggerInstance on all DataNodes, the DataNodeLocation in TriggerInformation will be null.

      If TriggerType is STATEFUL, we should create TriggerInstance on the DataNode with the lowest load, and DataNodeLocation of this DataNode will be saved.

      All DataNodes will add TriggerInformation of this trigger in local TriggerTable.

      Parameters:
      req - the createTrigger request
      Returns:
      status of create this trigger
    • dropTrigger

      public TSStatus dropTrigger(TDropTriggerReq req)
    • getTriggerTable

      public TGetTriggerTableResp getTriggerTable(boolean onlyStateful)
    • getLocationOfStatefulTrigger

      public TGetLocationForTriggerResp getLocationOfStatefulTrigger(String triggerName)
    • getTriggerJar

      public TGetJarInListResp getTriggerJar(TGetJarInListReq req)
    • transferTrigger

      public TSStatus transferTrigger(List<TDataNodeLocation> newUnknownDataNodeList, Map<Integer,TDataNodeLocation> dataNodeLocationMap)
      Step1: Mark Stateful Triggers on UnknownDataNodes as TTriggerState.TRANSFERRING.

      Step2: Get all Transferring Triggers marked in Step1.

      Step3: For each trigger gotten in Step2, find the DataNode with the lowest load, then transfer the Stateful Trigger to it and update this information on all DataNodes.

      Step4: Update the newest location on ConfigNodes.

      Parameters:
      dataNodeLocationMap - The DataNodes with NodeStatus.Running State
      Returns:
      result of transferTrigger
    • updateTriggerLocation

      public List<TSStatus> updateTriggerLocation(String triggerName, TDataNodeLocation dataNodeLocation, Map<Integer,TDataNodeLocation> dataNodeLocationMap)