HDDS-506. Fields in AllocateScmBlockResponseProto should be optional. Contributed by Arpit Agarwal.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e435e12f Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e435e12f Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e435e12f Branch: refs/heads/YARN-7402 Commit: e435e12f1fd00a5f78621ec1933a60171fc224e6 Parents: fb85351 Author: Xiaoyu Yao <x...@apache.org> Authored: Tue Sep 18 23:21:29 2018 -0700 Committer: Xiaoyu Yao <x...@apache.org> Committed: Tue Sep 18 23:21:29 2018 -0700 ---------------------------------------------------------------------- .../common/src/main/proto/ScmBlockLocationProtocol.proto | 6 +++--- .../org/apache/hadoop/hdds/scm/exceptions/SCMException.java | 3 ++- .../org/apache/hadoop/hdds/scm/pipelines/PipelineSelector.java | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/e435e12f/hadoop-hdds/common/src/main/proto/ScmBlockLocationProtocol.proto ---------------------------------------------------------------------- diff --git a/hadoop-hdds/common/src/main/proto/ScmBlockLocationProtocol.proto b/hadoop-hdds/common/src/main/proto/ScmBlockLocationProtocol.proto index 53f408a..9b4e0ac 100644 --- a/hadoop-hdds/common/src/main/proto/ScmBlockLocationProtocol.proto +++ b/hadoop-hdds/common/src/main/proto/ScmBlockLocationProtocol.proto @@ -104,9 +104,9 @@ message AllocateScmBlockResponseProto { unknownFailure = 4; } required Error errorCode = 1; - required BlockID blockID = 2; - required hadoop.hdds.Pipeline pipeline = 3; - required bool createContainer = 4; + optional BlockID blockID = 2; + optional hadoop.hdds.Pipeline pipeline = 3; + optional bool createContainer = 4; optional string errorMessage = 5; } http://git-wip-us.apache.org/repos/asf/hadoop/blob/e435e12f/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/exceptions/SCMException.java ---------------------------------------------------------------------- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/exceptions/SCMException.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/exceptions/SCMException.java index 87a29e3..dae0b06 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/exceptions/SCMException.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/exceptions/SCMException.java @@ -118,6 +118,7 @@ public class SCMException extends IOException { SCM_NOT_INITIALIZED, DUPLICATE_DATANODE, NO_SUCH_DATANODE, - NO_REPLICA_FOUND + NO_REPLICA_FOUND, + FAILED_TO_FIND_ACTIVE_PIPELINE } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/e435e12f/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/PipelineSelector.java ---------------------------------------------------------------------- diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/PipelineSelector.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/PipelineSelector.java index c9f51f7..82946bd 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/PipelineSelector.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipelines/PipelineSelector.java @@ -62,6 +62,7 @@ import java.util.concurrent.TimeUnit; import static org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes .FAILED_TO_CHANGE_PIPELINE_STATE; +import static org.apache.hadoop.hdds.scm.exceptions.SCMException.ResultCodes.FAILED_TO_FIND_ACTIVE_PIPELINE; import static org.apache.hadoop.hdds.server .ServerUtils.getOzoneMetaDirPath; import static org.apache.hadoop.ozone @@ -285,6 +286,9 @@ public class PipelineSelector { // try to return a pipeline from already allocated pipelines PipelineID pipelineId = manager.getPipeline(replicationFactor, replicationType); + if (pipelineId == null) { + throw new SCMException(FAILED_TO_FIND_ACTIVE_PIPELINE); + } pipeline = pipelineMap.get(pipelineId); Preconditions.checkArgument(pipeline.getLifeCycleState() == LifeCycleState.OPEN); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org