You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/12/23 09:21:10 UTC
[GitHub] [iotdb] Alima777 commented on a diff in pull request #8432: [IOTDB-4005] Pipeline fragmentInstance to implement parallel execution
Alima777 commented on code in PR #8432:
URL: https://github.com/apache/iotdb/pull/8432#discussion_r1056171915
##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/PipelineDriverFactory.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.mpp.plan.planner;
+
+import org.apache.iotdb.db.mpp.execution.driver.DataDriver;
+import org.apache.iotdb.db.mpp.execution.driver.Driver;
+import org.apache.iotdb.db.mpp.execution.driver.DriverContext;
+import org.apache.iotdb.db.mpp.execution.operator.Operator;
+
+import javax.annotation.concurrent.GuardedBy;
+
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
+
+public class PipelineDriverFactory {
+
+ private final DriverContext driverContext;
+ private final Operator operation;
+ // 控制 Instance 的数量 = 并行度
+ // private final OptionalInt driverInstances;
+
+ @GuardedBy("this")
+ private boolean noMoreDrivers;
+
+ public PipelineDriverFactory(Operator operation, DriverContext driverContext) {
+ this.operation = requireNonNull(operation, "rootOperator is null");
+ this.driverContext = driverContext;
+ }
+
+ public DriverContext getDriverContext() {
+ return driverContext;
+ }
+
+ // thinking: why synchronized
+ public synchronized Driver createDriver() {
+ checkState(!noMoreDrivers, "noMoreDrivers is already set");
+ requireNonNull(driverContext, "driverContext is null");
+ try {
+ return new DataDriver(operation, driverContext);
+ } catch (Throwable failure) {
+ try {
+ operation.close();
+ } catch (Throwable closeFailure) {
+ if (failure != closeFailure) {
+ failure.addSuppressed(closeFailure);
+ }
+ }
+ throw failure;
+ }
+ }
+
+ // public synchronized void noMoreDrivers()
+ // {
+ // if (noMoreDrivers) {
+ // return;
+ // }
+ // noMoreDrivers = true;
+ // for (OperatorFactory operatorFactory : operatorFactories) {
+ // operatorFactory.noMoreOperators();
+ // }
+ // }
Review Comment:
yes, it will be deleted when it's ready for merge.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org