Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-501

AllocateBlockResponse.keyLocation must be an optional field

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • None
    • 0.2.1
    • None
    • None

    Description

      keyLocation may not be initialized if allocateBlock fails in the following function:

      public AllocateBlockResponse allocateBlock(RpcController controller,
          AllocateBlockRequest request) throws ServiceException {
        AllocateBlockResponse.Builder resp =
            AllocateBlockResponse.newBuilder();
        try {
          KeyArgs keyArgs = request.getKeyArgs();
          OmKeyArgs omKeyArgs = new OmKeyArgs.Builder()
              .setVolumeName(keyArgs.getVolumeName())
              .setBucketName(keyArgs.getBucketName())
              .setKeyName(keyArgs.getKeyName())
              .build();
          OmKeyLocationInfo newLocation = impl.allocateBlock(omKeyArgs,
              request.getClientID());
          resp.setKeyLocation(newLocation.getProtobuf());
          resp.setStatus(Status.OK);
        } catch (IOException e) {
          resp.setStatus(exceptionToResponseStatus(e));
        }
        return resp.build();
      }

      Hence it must be an optional field. Else the protobuf builder exception suppresses the real issue.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            arp Arpit Agarwal
            arp Arpit Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment