flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aljoscha <...@git.apache.org>
Subject [GitHub] flink pull request #3509: [FLINK-5808] Fix Missing verification for setParal...
Date Mon, 13 Mar 2017 14:07:40 GMT
Github user aljoscha commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3509#discussion_r105667466
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/common/ExecutionConfig.java ---
    @@ -280,13 +289,18 @@ public int getParallelism() {
     	 * @param parallelism The parallelism to use
     	 */
     	public ExecutionConfig setParallelism(int parallelism) {
    -		if (parallelism != PARALLELISM_UNKNOWN) {
    -			if (parallelism < 1 && parallelism != PARALLELISM_DEFAULT) {
    -				throw new IllegalArgumentException(
    -					"Parallelism must be at least one, or ExecutionConfig.PARALLELISM_DEFAULT (use system
default).");
    -			}
    -			this.parallelism = parallelism;
    -		}
    +		checkArgument(parallelism != PARALLELISM_UNKNOWN, "Cannot specify UNKNOWN_PARALLELISM.");
    +		checkArgument(
    +				parallelism >= 1 || parallelism == PARALLELISM_DEFAULT,
    +				"Parallelism must be at least one, or ExecutionConfig.PARALLELISM_DEFAULT " +
    +						"(use system default).");
    +		checkArgument(
    +				maxParallelism == -1 || parallelism <= maxParallelism,
    --- End diff --
    
    This verifies that the parallelism is smaller-or-equal the max parallelism, but only if
a max parallelism is set. If no max parallelism is set you should be able to set any parallelism
(that is > 0).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message