Skip to content

Commit 8b75a8e

Browse files
committed
Implemented mem ctrl for tree-model plan node
1 parent 18090a7 commit 8b75a8e

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/LogicalPlanBuilder.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.DeviceRegionScanNode;
8787
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.LastQueryScanNode;
8888
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.SeriesScanNode;
89-
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.SeriesSourceNode;
9089
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.ShowQueriesNode;
90+
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.SourceNode;
9191
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.source.TimeseriesRegionScanNode;
9292
import org.apache.iotdb.db.queryengine.plan.planner.plan.parameter.AggregationDescriptor;
9393
import org.apache.iotdb.db.queryengine.plan.planner.plan.parameter.AggregationStep;
@@ -110,6 +110,7 @@
110110
import org.apache.commons.lang3.Validate;
111111
import org.apache.tsfile.enums.TSDataType;
112112
import org.apache.tsfile.file.metadata.IDeviceID;
113+
import org.apache.tsfile.utils.Accountable;
113114

114115
import java.util.ArrayList;
115116
import java.util.Arrays;
@@ -1114,15 +1115,16 @@ public LogicalPlanBuilder planSeriesSchemaFetchSource(
11141115
overlappedPatternTree.appendFullPath(pathPattern);
11151116
}
11161117
this.root.addChild(
1117-
new SeriesSchemaFetchScanNode(
1118-
context.getQueryId().genPlanNodeId(),
1119-
storageGroupPath,
1120-
overlappedPatternTree,
1121-
templateMap,
1122-
withTags,
1123-
withAttributes,
1124-
withTemplate,
1125-
withAliasForce));
1118+
reserveMemoryForAccountableNode(
1119+
new SeriesSchemaFetchScanNode(
1120+
context.getQueryId().genPlanNodeId(),
1121+
storageGroupPath,
1122+
overlappedPatternTree,
1123+
templateMap,
1124+
withTags,
1125+
withAttributes,
1126+
withTemplate,
1127+
withAliasForce)));
11261128
} catch (IllegalPathException e) {
11271129
// definitely won't happen
11281130
throw new RuntimeException(e);
@@ -1146,11 +1148,12 @@ public LogicalPlanBuilder planDeviceSchemaFetchSource(
11461148
overlappedPatternTree.appendFullPath(pathPattern);
11471149
}
11481150
this.root.addChild(
1149-
new DeviceSchemaFetchScanNode(
1150-
context.getQueryId().genPlanNodeId(),
1151-
databasePath,
1152-
overlappedPatternTree,
1153-
authorityScope));
1151+
reserveMemoryForAccountableNode(
1152+
new DeviceSchemaFetchScanNode(
1153+
context.getQueryId().genPlanNodeId(),
1154+
databasePath,
1155+
overlappedPatternTree,
1156+
authorityScope)));
11541157
} catch (IllegalPathException e) {
11551158
// definitely won't happen
11561159
throw new RuntimeException(e);
@@ -1425,7 +1428,8 @@ public LogicalPlanBuilder planTimeseriesRegionScan(
14251428
* We need to check the memory used by SeriesSourceNodes.(Number of other PlanNodes are rather
14261429
* small compared to SourceNodes and could be safely ignored for now.)
14271430
*/
1428-
private PlanNode reserveMemoryForAccountableNode(final SeriesSourceNode sourceNode) {
1431+
private <T extends SourceNode & Accountable> T reserveMemoryForAccountableNode(
1432+
final T sourceNode) {
14291433
this.context.reserveMemoryForFrontEnd(
14301434
MemoryEstimationHelper.getEstimatedSizeOfAccountableObject(sourceNode));
14311435
return sourceNode;

0 commit comments

Comments
 (0)