Class InsertMultiTabletsPlan
- java.lang.Object
-
- org.apache.iotdb.db.qp.physical.PhysicalPlan
-
- org.apache.iotdb.db.qp.physical.crud.InsertPlan
-
- org.apache.iotdb.db.qp.physical.crud.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.iotdb.db.qp.physical.PhysicalPlan
PhysicalPlan.Factory, PhysicalPlan.PhysicalPlanType
-
-
Field Summary
-
Fields inherited from class org.apache.iotdb.db.qp.physical.crud.InsertPlan
dataTypes, deviceID, devicePath, isAligned, measurementMNodes, measurements
-
Fields inherited from class org.apache.iotdb.db.qp.physical.PhysicalPlan
canBeSplit, index
-
-
Constructor Summary
Constructors Constructor Description InsertMultiTabletsPlan()InsertMultiTabletsPlan(java.util.List<InsertTabletPlan> insertTabletPlanList)InsertMultiTabletsPlan(java.util.List<InsertTabletPlan> insertTabletPlanList, java.util.List<java.lang.Integer> parentInsertTabletPlanIndexList)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInsertTabletPlan(InsertTabletPlan plan, java.lang.Integer parentIndex)voidcheckIntegrity()Check the integrity of the plan in case that the plan is generated by a careless user through Session API.voiddeserialize(java.nio.ByteBuffer buffer)Deserialize the plan from the given buffer.booleanequals(java.lang.Object o)intgetBatchSize()Return how many sub-plans are in the planintgetDifferentStorageGroupsCount()org.apache.iotdb.common.rpc.thrift.TSStatus[]getFailingStatus()org.apache.iotdb.commons.path.PartialPathgetFirstDeviceId()java.lang.ObjectgetFirstValueOfIndex(int index)InsertTabletPlangetInsertTabletPlan(int index)java.util.List<InsertTabletPlan>getInsertTabletPlanList()longgetMaxTime()longgetMinTime()intgetParentIndex(int index)java.util.List<java.lang.Integer>getParentInsertTabletPlanIndexList()java.util.List<org.apache.iotdb.commons.path.PartialPath>getPaths()java.util.List<org.apache.iotdb.commons.path.PartialPath>getPrefixPaths()Return prefix paths of all sub-plansjava.util.Map<java.lang.Integer,org.apache.iotdb.common.rpc.thrift.TSStatus>getResults()Return execution status for each pathintgetRowCount(int index)Gets the number of rows in the InsertTabletPlan of the index, zero will be returned if the index is out of bound.intgetTabletsSize()intgetTotalRowCount()inthashCode()booleanisEnableMultiThreading()booleanisExecuted(int i)Whether the sub-plan at position i has been executed.voidrecoverFromFailure()Reset measurements from failed measurements (if any), as if no failure had ever happened.voidserialize(java.io.DataOutputStream stream)Serialize the plan into the given buffer.voidserializeImpl(java.nio.ByteBuffer buffer)voidsetIndex(long index)voidsetInsertTabletPlanList(java.util.List<InsertTabletPlan> insertTabletPlanList)voidsetIsExecuted(int i)Mark the sub-plan at position i as executed.voidsetParentInsertTabletPlanIndexList(java.util.List<java.lang.Integer> parentInsertTabletPlanIndexList)voidsetResults(java.util.Map<java.lang.Integer,org.apache.iotdb.common.rpc.thrift.TSStatus> results)java.lang.StringtoString()voidunsetIsExecuted(int i)Mark the sub-plan at position i as not executed.-
Methods inherited from class org.apache.iotdb.db.qp.physical.crud.InsertPlan
getDataTypes, getDeviceID, getDevicePath, getFailedExceptions, getFailedMeasurementNumber, getFailedMeasurements, getMeasurementMNodes, getMeasurements, getPlanFromFailed, hasValidMeasurements, isAligned, markFailedMeasurementInsertion, setAligned, setDataTypes, setDeviceID, setDevicePath, setMeasurementMNodes, setMeasurements
-
Methods inherited from class org.apache.iotdb.db.qp.physical.PhysicalPlan
canBeSplit, deserialize, getAggregations, getAuthPaths, getIndex, getLoginUserName, getOperatorName, getOperatorType, isAuthenticationRequired, isDebug, isPrefixMatch, isQuery, isSelectInto, putString, putString, putStrings, putStrings, readString, readStrings, serialize, serializeToByteBuffer, setDebug, setLoginUserName, setOperatorType, setPaths, setPrefixMatch, setQuery
-
-
-
-
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:
getPathsin classPhysicalPlan
-
getPrefixPaths
public java.util.List<org.apache.iotdb.commons.path.PartialPath> getPrefixPaths()
Description copied from interface:BatchPlanReturn prefix paths of all sub-plans- Specified by:
getPrefixPathsin interfaceBatchPlan- Returns:
- prefix paths of all sub-plans
-
getMinTime
public long getMinTime()
- Specified by:
getMinTimein classInsertPlan
-
getMaxTime
public long getMaxTime()
-
getFirstValueOfIndex
public java.lang.Object getFirstValueOfIndex(int index)
- Specified by:
getFirstValueOfIndexin classInsertPlan
-
getTabletsSize
public int getTabletsSize()
-
getResults
public java.util.Map<java.lang.Integer,org.apache.iotdb.common.rpc.thrift.TSStatus> getResults()
Description copied from interface:BatchPlanReturn execution status for each path- Specified by:
getResultsin interfaceBatchPlan- 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
-
checkIntegrity
public void checkIntegrity() throws QueryProcessExceptionDescription copied from class:PhysicalPlanCheck the integrity of the plan in case that the plan is generated by a careless user through Session API.- Overrides:
checkIntegrityin classInsertPlan- Throws:
QueryProcessException- when the check fails
-
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:InsertPlanReset measurements from failed measurements (if any), as if no failure had ever happened.- Overrides:
recoverFromFailurein classInsertPlan
-
serializeImpl
public void serializeImpl(java.nio.ByteBuffer buffer)
- Overrides:
serializeImplin classPhysicalPlan
-
serialize
public void serialize(java.io.DataOutputStream stream) throws java.io.IOExceptionDescription copied from class:PhysicalPlanSerialize the plan into the given buffer. All necessary fields will be serialized.- Overrides:
serializein classPhysicalPlan- Throws:
java.io.IOException
-
deserialize
public void deserialize(java.nio.ByteBuffer buffer) throws org.apache.iotdb.commons.exception.IllegalPathExceptionDescription copied from class:PhysicalPlanDeserialize the plan from the given buffer.- Overrides:
deserializein classPhysicalPlan- Throws:
org.apache.iotdb.commons.exception.IllegalPathException
-
setIndex
public void setIndex(long index)
- Overrides:
setIndexin classPhysicalPlan
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
setIsExecuted
public void setIsExecuted(int i)
Description copied from interface:BatchPlanMark the sub-plan at position i as executed.- Specified by:
setIsExecutedin interfaceBatchPlan- Parameters:
i- the position of the sub-plan
-
isExecuted
public boolean isExecuted(int i)
Description copied from interface:BatchPlanWhether the sub-plan at position i has been executed.- Specified by:
isExecutedin interfaceBatchPlan- 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:BatchPlanReturn how many sub-plans are in the plan- Specified by:
getBatchSizein interfaceBatchPlan- Returns:
- how many sub-plans are in the plan.
-
unsetIsExecuted
public void unsetIsExecuted(int i)
Description copied from interface:BatchPlanMark the sub-plan at position i as not executed.- Specified by:
unsetIsExecutedin interfaceBatchPlan- Parameters:
i- the position of the sub-plan
-
getDifferentStorageGroupsCount
public int getDifferentStorageGroupsCount()
-
isEnableMultiThreading
public boolean isEnableMultiThreading()
-
-