Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21161

camel-aws2-s3 is uploading always files as multipart when multiPartUpload is set true

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.4.0, 4.7.0
    • 4.4.4, 4.8.0
    • camel-aws2
    • None
    • Novice

    Description

      The Camel component camel-aws2-s3 has a producer boolean option called multiPartUpload.
      Based on the documentation, when this attribute is set to true, the upload will be with multipart format in case the file is larger than the partSize (another attribute). 
      This is not happening, when multiPartUpload is set to true, the upload is always in multipart format unless the fileSize is 0, which is a corner case.

      The root cause of the problem is in the  AWS2S3Producer code around line 151.
              long partSize = getConfiguration().getPartSize();
              if (contentLength == 0 && contentLength < partSize) {
                  // optimize to do a single op if content length is known and < part size
                  LOG.debug("File size < partSize. Uploading file in single operation: {}", filePayload);
                  processSingleOp(exchange);
                  return;
              }
      If the contentLength is not 0, the condition "contentLength < partSize" is never met so the upload is always done as multipart.

      This is really affecting performance upload when files are below the partSize.

      The proposed fix is just to change the condition to:
      if (contentLength == 0 || contentLength < partSize) {
      ...

      Attachments

        1. CAMEL-21161.patch
          1 kB
          Hervé Dumont

        Issue Links

          Activity

            People

              acosentino Andrea Cosentino
              gfolch Guillem Folch
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: