This is an automated email from the ASF dual-hosted git repository.
xingtanzjr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new c2ce85a3c8 Simplify collect redirect Info logic (#9675)
c2ce85a3c8 is described below
commit c2ce85a3c87a1409d3860c31bfb12b4b358fa06b
Author: Haonan <[email protected]>
AuthorDate: Thu Apr 27 15:05:14 2023 +0800
Simplify collect redirect Info logic (#9675)
---
.../apache/iotdb/db/mpp/plan/analyze/Analysis.java | 19 +++++++++++++++++++
.../iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java | 5 +++--
.../iotdb/db/mpp/plan/execution/QueryExecution.java | 3 +--
.../plan/planner/plan/node/write/InsertRowNode.java | 4 ++++
.../plan/planner/plan/node/write/InsertRowsNode.java | 5 +++++
.../plan/node/write/InsertRowsOfOneDeviceNode.java | 7 +++++++
.../planner/plan/node/write/InsertTabletNode.java | 8 ++++++++
.../mpp/plan/statement/crud/InsertBaseStatement.java | 4 ----
.../statement/crud/InsertMultiTabletsStatement.java | 18 ------------------
.../mpp/plan/statement/crud/InsertRowStatement.java | 17 ++---------------
.../crud/InsertRowsOfOneDeviceStatement.java | 9 ---------
.../mpp/plan/statement/crud/InsertRowsStatement.java | 17 -----------------
.../plan/statement/crud/InsertTabletStatement.java | 13 -------------
.../plan/plan/node/write/WritePlanNodeSplitTest.java | 15 +++++++++++++--
14 files changed, 62 insertions(+), 82 deletions(-)
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analysis.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analysis.java
index e012669ac0..3c4fd6e9ed 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analysis.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/Analysis.java
@@ -20,6 +20,7 @@
package org.apache.iotdb.db.mpp.plan.analyze;
import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
+import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TSchemaNode;
import org.apache.iotdb.commons.partition.DataPartition;
@@ -44,6 +45,7 @@ import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.read.filter.basic.Filter;
import org.apache.iotdb.tsfile.utils.Pair;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -70,6 +72,8 @@ public class Analysis {
private ISchemaTree schemaTree;
+ private List<TEndPoint> redirectNodeList;
+
// map from output column name (for every node) to its datatype
private final Map<NodeRef<Expression>, TSDataType> expressionTypes = new
LinkedHashMap<>();
@@ -260,6 +264,21 @@ public class Analysis {
this.schemaTree = schemaTree;
}
+ public List<TEndPoint> getRedirectNodeList() {
+ return redirectNodeList;
+ }
+
+ public void setRedirectNodeList(List<TEndPoint> redirectNodeList) {
+ this.redirectNodeList = redirectNodeList;
+ }
+
+ public void addEndPointToRedirectNodeList(TEndPoint endPoint) {
+ if (redirectNodeList == null) {
+ redirectNodeList = new ArrayList<>();
+ }
+ redirectNodeList.add(endPoint);
+ }
+
public Filter getGlobalTimeFilter() {
return globalTimeFilter;
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
index 6ed340aff7..52ad29445d 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/AnalyzeVisitor.java
@@ -1924,7 +1924,8 @@ public class AnalyzeVisitor extends
StatementVisitor<Analysis, MPPQueryContext>
DataPartitionQueryParam dataPartitionQueryParam = new
DataPartitionQueryParam();
dataPartitionQueryParam.setDevicePath(insertRowStatement.getDevicePath().getFullPath());
-
dataPartitionQueryParam.setTimePartitionSlotList(insertRowStatement.getTimePartitionSlots());
+ dataPartitionQueryParam.setTimePartitionSlotList(
+ Collections.singletonList(insertRowStatement.getTimePartitionSlot()));
return getAnalysisForWriting(
insertRowStatement,
Collections.singletonList(dataPartitionQueryParam));
@@ -1940,7 +1941,7 @@ public class AnalyzeVisitor extends
StatementVisitor<Analysis, MPPQueryContext>
Set<TTimePartitionSlot> timePartitionSlotSet =
dataPartitionQueryParamMap.computeIfAbsent(
insertRowStatement.getDevicePath().getFullPath(), k -> new
HashSet<>());
- timePartitionSlotSet.addAll(insertRowStatement.getTimePartitionSlots());
+ timePartitionSlotSet.add(insertRowStatement.getTimePartitionSlot());
}
List<DataPartitionQueryParam> dataPartitionQueryParams = new ArrayList<>();
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
index 7c4515ae5a..199329aa93 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
@@ -657,8 +657,7 @@ public class QueryExecution implements IQueryExecution {
&& (!config.isEnable13DataInsertAdapt()
||
IoTDBConstant.ClientVersion.V_1_0.equals(context.getSession().getVersion()))) {
InsertBaseStatement insertStatement = (InsertBaseStatement)
analysis.getStatement();
- List<TEndPoint> redirectNodeList =
- insertStatement.collectRedirectInfo(analysis.getDataPartitionInfo());
+ List<TEndPoint> redirectNodeList = analysis.getRedirectNodeList();
if (insertStatement instanceof InsertRowsStatement
|| insertStatement instanceof InsertMultiTabletsStatement) {
// multiple devices
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowNode.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowNode.java
index e599e26344..311dfd2846 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowNode.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowNode.java
@@ -105,6 +105,10 @@ public class InsertRowNode extends InsertNode implements
WALEntryValue, ISchemaV
analysis
.getDataPartitionInfo()
.getDataRegionReplicaSetForWriting(devicePath.getFullPath(),
timePartitionSlot);
+ // collect redirectInfo
+ analysis.setRedirectNodeList(
+ Collections.singletonList(
+
dataRegionReplicaSet.getDataNodeLocations().get(0).getClientRpcEndPoint()));
return Collections.singletonList(this);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowsNode.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowsNode.java
index 3cb42dda31..5921c033f6 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowsNode.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowsNode.java
@@ -18,6 +18,7 @@
*/
package org.apache.iotdb.db.mpp.plan.planner.plan.node.write;
+import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TSStatus;
import org.apache.iotdb.commons.utils.StatusUtils;
@@ -229,6 +230,7 @@ public class InsertRowsNode extends InsertNode implements
BatchInsertNode {
@Override
public List<WritePlanNode> splitByPartition(Analysis analysis) {
Map<TRegionReplicaSet, InsertRowsNode> splitMap = new HashMap<>();
+ List<TEndPoint> redirectInfo = new ArrayList<>();
for (int i = 0; i < insertRowNodeList.size(); i++) {
InsertRowNode insertRowNode = insertRowNodeList.get(i);
// data region for insert row node
@@ -238,6 +240,8 @@ public class InsertRowsNode extends InsertNode implements
BatchInsertNode {
.getDataRegionReplicaSetForWriting(
insertRowNode.devicePath.getFullPath(),
TimePartitionUtils.getTimePartition(insertRowNode.getTime()));
+ // collect redirectInfo
+
redirectInfo.add(dataRegionReplicaSet.getDataNodeLocations().get(0).getClientRpcEndPoint());
if (splitMap.containsKey(dataRegionReplicaSet)) {
InsertRowsNode tmpNode = splitMap.get(dataRegionReplicaSet);
tmpNode.addOneInsertRowNode(insertRowNode, i);
@@ -248,6 +252,7 @@ public class InsertRowsNode extends InsertNode implements
BatchInsertNode {
splitMap.put(dataRegionReplicaSet, tmpNode);
}
}
+ analysis.setRedirectNodeList(redirectInfo);
return new ArrayList<>(splitMap.values());
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowsOfOneDeviceNode.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowsOfOneDeviceNode.java
index 710c5b7d89..32b3e1c08d 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowsOfOneDeviceNode.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertRowsOfOneDeviceNode.java
@@ -40,6 +40,7 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -170,6 +171,12 @@ public class InsertRowsOfOneDeviceNode extends InsertNode
implements BatchInsert
tmpMap.add(insertRowNode);
tmpIndexMap.add(insertRowNodeIndexList.get(i));
+
+ if (i == insertRowNodeList.size() - 1) {
+ analysis.setRedirectNodeList(
+ Collections.singletonList(
+
dataRegionReplicaSet.getDataNodeLocations().get(0).getClientRpcEndPoint()));
+ }
}
for (Map.Entry<TRegionReplicaSet, List<InsertRowNode>> entry :
splitMap.entrySet()) {
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java
index c023792b95..b292b4f49c 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java
@@ -238,6 +238,14 @@ public class InsertTabletNode extends InsertNode
implements WALEntryValue, ISche
.getDataPartitionInfo()
.getDataRegionReplicaSetForWriting(devicePath.getFullPath(),
timePartitionSlots);
+ // collect redirectInfo
+ analysis.addEndPointToRedirectNodeList(
+ dataRegionReplicaSets
+ .get(dataRegionReplicaSets.size() - 1)
+ .getDataNodeLocations()
+ .get(0)
+ .getClientRpcEndPoint());
+
Map<TRegionReplicaSet, List<Integer>> splitMap = new HashMap<>();
for (int i = 0; i < dataRegionReplicaSets.size(); i++) {
List<Integer> sub_ranges =
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertBaseStatement.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertBaseStatement.java
index 1de24f70b3..d2d6d55ea1 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertBaseStatement.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertBaseStatement.java
@@ -18,8 +18,6 @@
*/
package org.apache.iotdb.db.mpp.plan.statement.crud;
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
-import org.apache.iotdb.commons.partition.DataPartition;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.mpp.plan.statement.Statement;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -80,6 +78,4 @@ public abstract class InsertBaseStatement extends Statement {
public List<PartialPath> getPaths() {
return Collections.emptyList();
}
-
- public abstract List<TEndPoint> collectRedirectInfo(DataPartition
dataPartition);
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertMultiTabletsStatement.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertMultiTabletsStatement.java
index 0ec6b09252..77090231e6 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertMultiTabletsStatement.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertMultiTabletsStatement.java
@@ -19,13 +19,9 @@
package org.apache.iotdb.db.mpp.plan.statement.crud;
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
-import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
-import org.apache.iotdb.commons.partition.DataPartition;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.mpp.plan.statement.StatementType;
import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
-import org.apache.iotdb.db.utils.TimePartitionUtils;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import java.util.ArrayList;
@@ -99,18 +95,4 @@ public class InsertMultiTabletsStatement extends
InsertBaseStatement {
}
return result;
}
-
- @Override
- public List<TEndPoint> collectRedirectInfo(DataPartition dataPartition) {
- List<TEndPoint> result = new ArrayList<>();
- for (InsertTabletStatement insertTabletStatement :
insertTabletStatementList) {
- TRegionReplicaSet regionReplicaSet =
- dataPartition.getDataRegionReplicaSetForWriting(
- insertTabletStatement.devicePath.getFullPath(),
- TimePartitionUtils.getTimePartition(
-
insertTabletStatement.getTimes()[insertTabletStatement.getTimes().length - 1]));
-
result.add(regionReplicaSet.getDataNodeLocations().get(0).getClientRpcEndPoint());
- }
- return result;
- }
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowStatement.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowStatement.java
index d31ea9b98a..7fc5659d90 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowStatement.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowStatement.java
@@ -19,10 +19,7 @@
package org.apache.iotdb.db.mpp.plan.statement.crud;
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
-import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
-import org.apache.iotdb.commons.partition.DataPartition;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.mpp.plan.statement.StatementType;
@@ -33,7 +30,6 @@ import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
public class InsertRowStatement extends InsertBaseStatement {
@@ -126,17 +122,8 @@ public class InsertRowStatement extends
InsertBaseStatement {
}
}
- public List<TTimePartitionSlot> getTimePartitionSlots() {
- return
Collections.singletonList(TimePartitionUtils.getTimePartition(time));
- }
-
- @Override
- public List<TEndPoint> collectRedirectInfo(DataPartition dataPartition) {
- TRegionReplicaSet regionReplicaSet =
- dataPartition.getDataRegionReplicaSetForWriting(
- devicePath.getFullPath(),
TimePartitionUtils.getTimePartition(time));
- return Collections.singletonList(
- regionReplicaSet.getDataNodeLocations().get(0).getClientRpcEndPoint());
+ public TTimePartitionSlot getTimePartitionSlot() {
+ return TimePartitionUtils.getTimePartition(time);
}
@Override
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
index 5569f8dbef..1507dd112b 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsOfOneDeviceStatement.java
@@ -19,9 +19,7 @@
package org.apache.iotdb.db.mpp.plan.statement.crud;
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
-import org.apache.iotdb.commons.partition.DataPartition;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.mpp.plan.statement.StatementType;
import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
@@ -82,13 +80,6 @@ public class InsertRowsOfOneDeviceStatement extends
InsertBaseStatement {
return new ArrayList<>(timePartitionSlotSet);
}
- @Override
- public List<TEndPoint> collectRedirectInfo(DataPartition dataPartition) {
- return insertRowStatementList
- .get(insertRowStatementList.size() - 1)
- .collectRedirectInfo(dataPartition);
- }
-
@Override
public <R, C> R accept(StatementVisitor<R, C> visitor, C context) {
return visitor.visitInsertRowsOfOneDevice(this, context);
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsStatement.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsStatement.java
index aa8752e2b4..c2b24e6926 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsStatement.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertRowsStatement.java
@@ -19,13 +19,9 @@
package org.apache.iotdb.db.mpp.plan.statement.crud;
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
-import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
-import org.apache.iotdb.commons.partition.DataPartition;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.mpp.plan.statement.StatementType;
import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
-import org.apache.iotdb.db.utils.TimePartitionUtils;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import java.util.ArrayList;
@@ -99,17 +95,4 @@ public class InsertRowsStatement extends InsertBaseStatement
{
}
return result;
}
-
- @Override
- public List<TEndPoint> collectRedirectInfo(DataPartition dataPartition) {
- List<TEndPoint> result = new ArrayList<>();
- for (InsertRowStatement insertRowStatement : insertRowStatementList) {
- TRegionReplicaSet regionReplicaSet =
- dataPartition.getDataRegionReplicaSetForWriting(
- insertRowStatement.devicePath.getFullPath(),
-
TimePartitionUtils.getTimePartition(insertRowStatement.getTime()));
-
result.add(regionReplicaSet.getDataNodeLocations().get(0).getClientRpcEndPoint());
- }
- return result;
- }
}
diff --git
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertTabletStatement.java
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertTabletStatement.java
index 4c6257b254..2da234041a 100644
---
a/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertTabletStatement.java
+++
b/server/src/main/java/org/apache/iotdb/db/mpp/plan/statement/crud/InsertTabletStatement.java
@@ -18,10 +18,7 @@
*/
package org.apache.iotdb.db.mpp.plan.statement.crud;
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
-import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
-import org.apache.iotdb.commons.partition.DataPartition;
import org.apache.iotdb.commons.path.PartialPath;
import org.apache.iotdb.db.mpp.plan.statement.StatementType;
import org.apache.iotdb.db.mpp.plan.statement.StatementVisitor;
@@ -29,7 +26,6 @@ import org.apache.iotdb.db.utils.TimePartitionUtils;
import org.apache.iotdb.tsfile.utils.BitMap;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
public class InsertTabletStatement extends InsertBaseStatement {
@@ -107,15 +103,6 @@ public class InsertTabletStatement extends
InsertBaseStatement {
return result;
}
- @Override
- public List<TEndPoint> collectRedirectInfo(DataPartition dataPartition) {
- TRegionReplicaSet regionReplicaSet =
- dataPartition.getDataRegionReplicaSetForWriting(
- devicePath.getFullPath(),
TimePartitionUtils.getTimePartition(times[times.length - 1]));
- return Collections.singletonList(
- regionReplicaSet.getDataNodeLocations().get(0).getClientRpcEndPoint());
- }
-
@Override
public <R, C> R accept(StatementVisitor<R, C> visitor, C context) {
return visitor.visitInsertTablet(this, context);
diff --git
a/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/write/WritePlanNodeSplitTest.java
b/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/write/WritePlanNodeSplitTest.java
index d7a6b90d87..76b5ced8eb 100644
---
a/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/write/WritePlanNodeSplitTest.java
+++
b/server/src/test/java/org/apache/iotdb/db/mpp/plan/plan/node/write/WritePlanNodeSplitTest.java
@@ -21,6 +21,8 @@ package org.apache.iotdb.db.mpp.plan.plan.node.write;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType;
+import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
+import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
@@ -88,6 +90,15 @@ public class WritePlanNodeSplitTest {
dataPartitionMap = new HashMap<>();
Map<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TRegionReplicaSet>>>
seriesPartitionSlotMap = new HashMap<>();
+ List<TDataNodeLocation> locationList = new ArrayList<>();
+ locationList.add(
+ new TDataNodeLocation(
+ 0,
+ new TEndPoint("127.0.0.1", 6667),
+ new TEndPoint("127.0.0.1", 10730),
+ new TEndPoint("127.0.0.1", 10740),
+ new TEndPoint("127.0.0.1", 10760),
+ new TEndPoint("127.0.0.1", 10750)));
// sg1 has 5 data regions
for (int i = 0; i < seriesSlotPartitionNum; i++) {
Map<TTimePartitionSlot, List<TRegionReplicaSet>> timePartitionSlotMap =
new HashMap<>();
@@ -99,7 +110,7 @@ public class WritePlanNodeSplitTest {
new TRegionReplicaSet(
new TConsensusGroupId(
TConsensusGroupType.DataRegion,
getRegionIdByTime(startTime)),
- null)));
+ locationList)));
}
seriesPartitionSlotMap.put(new TSeriesPartitionSlot(i),
timePartitionSlotMap);
@@ -116,7 +127,7 @@ public class WritePlanNodeSplitTest {
new TTimePartitionSlot(t *
TimePartitionUtils.timePartitionInterval),
Collections.singletonList(
new TRegionReplicaSet(
- new TConsensusGroupId(TConsensusGroupType.DataRegion, 99),
null)));
+ new TConsensusGroupId(TConsensusGroupType.DataRegion, 99),
locationList)));
}
seriesPartitionSlotMap.put(new TSeriesPartitionSlot(i),
timePartitionSlotMap);