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

AllocateBlockResponse.keyLocation must be an optional field

    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

        1. HDDS-501.01.patch
          0.5 kB
          Arpit Agarwal

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: