[hotfix] Update comments in 'ChainingStrategy' and remove outdated 'FORCE_ALWAYS' constant
Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/e9c83ea2 Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/e9c83ea2 Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/e9c83ea2 Branch: refs/heads/tableOnCalcite Commit: e9c83ea2c36decf02d0ea9c2b76b0fd50606b51b Parents: 28feede Author: Stephan Ewen <se...@apache.org> Authored: Mon Feb 8 15:08:09 2016 +0100 Committer: Stephan Ewen <se...@apache.org> Committed: Mon Feb 8 20:19:25 2016 +0100 ---------------------------------------------------------------------- .../api/graph/StreamingJobGraphGenerator.java | 9 ++---- .../api/operators/ChainingStrategy.java | 30 +++++++++++--------- 2 files changed, 19 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/e9c83ea2/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java ---------------------------------------------------------------------- diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java index fd75ba7..c0d2856 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/graph/StreamingJobGraphGenerator.java @@ -398,15 +398,12 @@ public class StreamingJobGraphGenerator { && headOperator != null && upStreamVertex.getSlotSharingID() == downStreamVertex.getSlotSharingID() && upStreamVertex.getSlotSharingID() != -1 - && (outOperator.getChainingStrategy() == ChainingStrategy.ALWAYS || - outOperator.getChainingStrategy() == ChainingStrategy.FORCE_ALWAYS) + && outOperator.getChainingStrategy() == ChainingStrategy.ALWAYS && (headOperator.getChainingStrategy() == ChainingStrategy.HEAD || - headOperator.getChainingStrategy() == ChainingStrategy.ALWAYS || - headOperator.getChainingStrategy() == ChainingStrategy.FORCE_ALWAYS) + headOperator.getChainingStrategy() == ChainingStrategy.ALWAYS) && (edge.getPartitioner() instanceof ForwardPartitioner) && upStreamVertex.getParallelism() == downStreamVertex.getParallelism() - && (streamGraph.isChainingEnabled() || - outOperator.getChainingStrategy() == ChainingStrategy.FORCE_ALWAYS); + && streamGraph.isChainingEnabled(); } private void setSlotSharing() { http://git-wip-us.apache.org/repos/asf/flink/blob/e9c83ea2/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ChainingStrategy.java ---------------------------------------------------------------------- diff --git a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ChainingStrategy.java b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ChainingStrategy.java index 18e8858..1bf3259 100644 --- a/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ChainingStrategy.java +++ b/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/ChainingStrategy.java @@ -18,23 +18,22 @@ package org.apache.flink.streaming.api.operators; - /** - * Defines the chaining scheme for the operator. - * By default {@link #ALWAYS} is used, which means operators will be eagerly chained whenever possible. + * Defines the chaining scheme for the operator. When an operator is chained to the + * predecessor, it means that they run in the same thread. They become one operator + * consisting of multiple steps. + * + * <p>The default value used by the {@link StreamOperator} is {@link #HEAD}, which means that + * the operator is not chained to its predecessor. Most operators override this with + * {@link #ALWAYS}, meaning they will be chained to predecessors whenever possible. */ public enum ChainingStrategy { - /** - * Chaining will happen even if chaining is disabled on the execution environment. - * This should only be used by system-level operators, not operators implemented by users. - */ - FORCE_ALWAYS, - /** - * Operators will be eagerly chained whenever possible, for - * maximal performance. It is generally a good practice to allow maximal - * chaining and increase operator parallelism + * Operators will be eagerly chained whenever possible. + * + * <p>To optimize performance, it is generally a good practice to allow maximal + * chaining and increase operator parallelism. */ ALWAYS, @@ -42,7 +41,10 @@ public enum ChainingStrategy { * The operator will not be chained to the preceding or succeeding operators. */ NEVER, - - + + /** + * The operator will not be chained to the predecessor, but successors may chain to this + * operator. + */ HEAD }