This is an automated email from the ASF dual-hosted git repository.
neuyilan 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 e4b7f64 [IOTDB-1857] Remove useless handle logic for CountPlan in
executeNonQuery in cluster module
e4b7f64 is described below
commit e4b7f64deb54b3fc186424cf969a68bff23a6fc7
Author: Potato <[email protected]>
AuthorDate: Mon Oct 18 20:25:36 2021 -0500
[IOTDB-1857] Remove useless handle logic for CountPlan in executeNonQuery
in cluster module
---
.../iotdb/cluster/query/ClusterPlanRouter.java | 50 ----------------------
.../cluster/partition/SlotPartitionTableTest.java | 37 ----------------
2 files changed, 87 deletions(-)
diff --git
a/cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanRouter.java
b/cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanRouter.java
index bdbb9d3..598046a 100644
---
a/cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanRouter.java
+++
b/cluster/src/main/java/org/apache/iotdb/cluster/query/ClusterPlanRouter.java
@@ -30,7 +30,6 @@ import org.apache.iotdb.cluster.rpc.thrift.Node;
import org.apache.iotdb.cluster.utils.PartitionUtils;
import org.apache.iotdb.db.engine.StorageEngine;
import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.exception.metadata.StorageGroupNotSetException;
import org.apache.iotdb.db.metadata.MManager;
import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.qp.physical.PhysicalPlan;
@@ -40,13 +39,11 @@ import
org.apache.iotdb.db.qp.physical.crud.InsertRowsOfOneDevicePlan;
import org.apache.iotdb.db.qp.physical.crud.InsertRowsPlan;
import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
import org.apache.iotdb.db.qp.physical.sys.AlterTimeSeriesPlan;
-import org.apache.iotdb.db.qp.physical.sys.CountPlan;
import org.apache.iotdb.db.qp.physical.sys.CreateAlignedTimeSeriesPlan;
import org.apache.iotdb.db.qp.physical.sys.CreateMultiTimeSeriesPlan;
import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
import org.apache.iotdb.db.qp.physical.sys.LogPlan;
import org.apache.iotdb.db.qp.physical.sys.ShowChildPathsPlan;
-import org.apache.iotdb.db.qp.physical.sys.ShowPlan.ShowContentType;
import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.db.utils.TestOnly;
import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -127,8 +124,6 @@ public class ClusterPlanRouter {
return splitAndRoutePlan((InsertTabletPlan) plan);
} else if (plan instanceof InsertMultiTabletPlan) {
return splitAndRoutePlan((InsertMultiTabletPlan) plan);
- } else if (plan instanceof CountPlan) {
- return splitAndRoutePlan((CountPlan) plan);
} else if (plan instanceof CreateTimeSeriesPlan) {
return splitAndRoutePlan((CreateTimeSeriesPlan) plan);
} else if (plan instanceof CreateAlignedTimeSeriesPlan) {
@@ -410,51 +405,6 @@ public class ClusterPlanRouter {
return bitMaps;
}
- private Map<PhysicalPlan, PartitionGroup> splitAndRoutePlan(CountPlan plan)
- throws MetadataException {
- // CountPlan is quite special because it has the behavior of wildcard at
the tail of the path
- // even though there is no wildcard
- Map<String, String> sgPathMap =
getMManager().groupPathByStorageGroup(plan.getPath());
- if (sgPathMap.isEmpty()) {
- throw new StorageGroupNotSetException(plan.getPath().getFullPath());
- }
- Map<PhysicalPlan, PartitionGroup> result = new HashMap<>();
- if (plan.getShowContentType().equals(ShowContentType.COUNT_TIMESERIES)) {
- // support wildcard
- for (Map.Entry<String, String> entry : sgPathMap.entrySet()) {
- CountPlan plan1 =
- new CountPlan(
- ShowContentType.COUNT_TIMESERIES,
- new PartialPath(entry.getValue()),
- plan.getLevel());
- result.put(plan1, partitionTable.route(entry.getKey(), 0));
- }
- } else {
- // do not support wildcard
- if (sgPathMap.size() == 1) {
- // the path of the original plan has only one SG, or there is only one
SG in the system.
- for (Map.Entry<String, String> entry : sgPathMap.entrySet()) {
- // actually, there is only one entry
- result.put(plan, partitionTable.route(entry.getKey(), 0));
- }
- } else {
- // the path of the original plan contains more than one SG, and we
added a wildcard at the
- // tail.
- // we have to remove it.
- for (Map.Entry<String, String> entry : sgPathMap.entrySet()) {
- CountPlan plan1 =
- new CountPlan(
- ShowContentType.COUNT_TIMESERIES,
- new PartialPath(
- entry.getValue().substring(0,
entry.getValue().lastIndexOf(".*"))),
- plan.getLevel());
- result.put(plan1, partitionTable.route(entry.getKey(), 0));
- }
- }
- }
- return result;
- }
-
private Map<PhysicalPlan, PartitionGroup>
splitAndRoutePlan(CreateMultiTimeSeriesPlan plan)
throws MetadataException {
Map<PhysicalPlan, PartitionGroup> result = new HashMap<>();
diff --git
a/cluster/src/test/java/org/apache/iotdb/cluster/partition/SlotPartitionTableTest.java
b/cluster/src/test/java/org/apache/iotdb/cluster/partition/SlotPartitionTableTest.java
index 510e6bc..04ff3d9 100644
---
a/cluster/src/test/java/org/apache/iotdb/cluster/partition/SlotPartitionTableTest.java
+++
b/cluster/src/test/java/org/apache/iotdb/cluster/partition/SlotPartitionTableTest.java
@@ -42,7 +42,6 @@ import org.apache.iotdb.db.qp.physical.crud.DeletePlan;
import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
import org.apache.iotdb.db.qp.physical.sys.AuthorPlan;
-import org.apache.iotdb.db.qp.physical.sys.CountPlan;
import org.apache.iotdb.db.qp.physical.sys.CreateTimeSeriesPlan;
import org.apache.iotdb.db.qp.physical.sys.DataAuthPlan;
import org.apache.iotdb.db.qp.physical.sys.DeleteStorageGroupPlan;
@@ -493,42 +492,6 @@ public class SlotPartitionTableTest {
}
// @Test
- public void testCountPlan() throws IllegalPathException {
- PhysicalPlan countPlan1 =
- new CountPlan(
- ShowContentType.COUNT_TIMESERIES, new PartialPath("root.sg.*.l3" +
".l4.28.*"));
- PhysicalPlan countPlan2 =
- new CountPlan(ShowContentType.COUNT_TIMESERIES, new
PartialPath("root.sg.*.l3" + ".*"));
- PhysicalPlan countPlan3 =
- new CountPlan(
- ShowContentType.COUNT_NODE_TIMESERIES, new PartialPath("root.sg" +
".l2.l3.l4.28"));
- PhysicalPlan countPlan4 =
- new CountPlan(
- ShowContentType.COUNT_NODE_TIMESERIES, new PartialPath("root.sg" +
".l2.l3"), 6);
- PhysicalPlan countPlan5 =
- new CountPlan(ShowContentType.COUNT_NODES, new
PartialPath("root.sg.l2.l3"), 5);
- try {
- ClusterPlanRouter router = new ClusterPlanRouter(localTable);
- assertTrue(countPlan1.canBeSplit());
- Map<PhysicalPlan, PartitionGroup> result1 =
router.splitAndRoutePlan(countPlan1);
- assertEquals(1, result1.size());
- Map<PhysicalPlan, PartitionGroup> result2 =
router.splitAndRoutePlan(countPlan2);
- assertEquals(40, result2.size());
- Map<PhysicalPlan, PartitionGroup> result3 =
router.splitAndRoutePlan(countPlan3);
- assertEquals(1, result3.size());
- Map<PhysicalPlan, PartitionGroup> result4 =
router.splitAndRoutePlan(countPlan4);
- // TODO this case can be optimized
- assertEquals(40, result4.size());
- Map<PhysicalPlan, PartitionGroup> result5 =
router.splitAndRoutePlan(countPlan5);
- // TODO this case can be optimized
- assertEquals(40, result5.size());
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- // @Test
public void testShowChildPathsPlan() throws IllegalPathException {
PhysicalPlan showChildPathsPlan1 =
new ShowChildPathsPlan(ShowContentType.CHILD_PATH, new
PartialPath("root.sg.l2.l3.l4.28"));