Class InsertMultiTabletsPlan

  • All Implemented Interfaces:
    org.apache.iotdb.consensus.common.request.IConsensusRequest, BatchPlan

    public class InsertMultiTabletsPlan
    extends InsertPlan
    implements BatchPlan
    Mainly used in the distributed version, when multiple InsertTabletPlans belong to a raft replication group, we merge these InsertTabletPlans into one InsertMultiTabletsPlan, which can reduce the number of raft logs. For details, please refer to https://issues.apache.org/jira/browse/IOTDB-1099
    • Constructor Detail

      • InsertMultiTabletsPlan

        public InsertMultiTabletsPlan()
      • InsertMultiTabletsPlan

        public InsertMultiTabletsPlan​(java.util.List<InsertTabletPlan> insertTabletPlanList)
      • InsertMultiTabletsPlan

        public InsertMultiTabletsPlan​(java.util.List<InsertTabletPlan> insertTabletPlanList,
                                      java.util.List<java.lang.Integer> parentInsertTabletPlanIndexList)
    • Method Detail

      • addInsertTabletPlan

        public void addInsertTabletPlan​(InsertTabletPlan plan,
                                        java.lang.Integer parentIndex)
      • getPaths

        public java.util.List<org.apache.iotdb.commons.path.PartialPath> getPaths()
        Specified by:
        getPaths in class PhysicalPlan
      • getPrefixPaths

        public java.util.List<org.apache.iotdb.commons.path.PartialPath> getPrefixPaths()
        Description copied from interface: BatchPlan
        Return prefix paths of all sub-plans
        Specified by:
        getPrefixPaths in interface BatchPlan
        Returns:
        prefix paths of all sub-plans
      • getMaxTime

        public long getMaxTime()
      • getTabletsSize

        public int getTabletsSize()
      • getResults

        public java.util.Map<java.lang.Integer,​org.apache.iotdb.common.rpc.thrift.TSStatus> getResults()
        Description copied from interface: BatchPlan
        Return execution status for each path
        Specified by:
        getResults in interface BatchPlan
        Returns:
        execution status for each path
      • getTotalRowCount

        public int getTotalRowCount()
        Returns:
        the total row of the whole InsertTabletPlan
      • getRowCount

        public int getRowCount​(int index)
        Gets the number of rows in the InsertTabletPlan of the index, zero will be returned if the index is out of bound.
        Parameters:
        index - the index of the insertTabletPlanList
        Returns:
        the total row count of the insertTabletPlanList.get(i)
      • getFirstDeviceId

        public org.apache.iotdb.commons.path.PartialPath getFirstDeviceId()
      • getInsertTabletPlan

        public InsertTabletPlan getInsertTabletPlan​(int index)
      • getParentIndex

        public int getParentIndex​(int index)
        Parameters:
        index - the index of the sub plan in this InsertMultiTabletsPlan
        Returns:
        the parent's index in the parent InsertMultiTabletsPlan
      • setParentInsertTabletPlanIndexList

        public void setParentInsertTabletPlanIndexList​(java.util.List<java.lang.Integer> parentInsertTabletPlanIndexList)
      • getParentInsertTabletPlanIndexList

        public java.util.List<java.lang.Integer> getParentInsertTabletPlanIndexList()
      • setInsertTabletPlanList

        public void setInsertTabletPlanList​(java.util.List<InsertTabletPlan> insertTabletPlanList)
      • getInsertTabletPlanList

        public java.util.List<InsertTabletPlan> getInsertTabletPlanList()
      • getFailingStatus

        public org.apache.iotdb.common.rpc.thrift.TSStatus[] getFailingStatus()
      • setResults

        public void setResults​(java.util.Map<java.lang.Integer,​org.apache.iotdb.common.rpc.thrift.TSStatus> results)
      • recoverFromFailure

        public void recoverFromFailure()
        Description copied from class: InsertPlan
        Reset measurements from failed measurements (if any), as if no failure had ever happened.
        Overrides:
        recoverFromFailure in class InsertPlan
      • serialize

        public void serialize​(java.io.DataOutputStream stream)
                       throws java.io.IOException
        Description copied from class: PhysicalPlan
        Serialize the plan into the given buffer. All necessary fields will be serialized.
        Overrides:
        serialize in class PhysicalPlan
        Throws:
        java.io.IOException
      • deserialize

        public void deserialize​(java.nio.ByteBuffer buffer)
                         throws org.apache.iotdb.commons.exception.IllegalPathException
        Description copied from class: PhysicalPlan
        Deserialize the plan from the given buffer.
        Overrides:
        deserialize in class PhysicalPlan
        Throws:
        org.apache.iotdb.commons.exception.IllegalPathException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • setIsExecuted

        public void setIsExecuted​(int i)
        Description copied from interface: BatchPlan
        Mark the sub-plan at position i as executed.
        Specified by:
        setIsExecuted in interface BatchPlan
        Parameters:
        i - the position of the sub-plan
      • isExecuted

        public boolean isExecuted​(int i)
        Description copied from interface: BatchPlan
        Whether the sub-plan at position i has been executed.
        Specified by:
        isExecuted in interface BatchPlan
        Parameters:
        i - the position of the sub-plan
        Returns:
        whether the sub-plan at position i has been executed.
      • getBatchSize

        public int getBatchSize()
        Description copied from interface: BatchPlan
        Return how many sub-plans are in the plan
        Specified by:
        getBatchSize in interface BatchPlan
        Returns:
        how many sub-plans are in the plan.
      • unsetIsExecuted

        public void unsetIsExecuted​(int i)
        Description copied from interface: BatchPlan
        Mark the sub-plan at position i as not executed.
        Specified by:
        unsetIsExecuted in interface BatchPlan
        Parameters:
        i - the position of the sub-plan
      • getDifferentStorageGroupsCount

        public int getDifferentStorageGroupsCount()
      • isEnableMultiThreading

        public boolean isEnableMultiThreading()