Usecase: I'm trying to upload a file(107kb) to an OpenStack Swift container using the api BlobStore putBlob(String container, Blob blob, PutOptions options). Below code snippet demonstrates the way I get the BlobStoreContext and upload a file.
Issue: Once the upload process is complete, I found two items created inside the container. One is of type BLOB and the other is of type FOLDER as shown below:
The actual issue is with the below line where I use multipart:
String etag = blobStore.putBlob(bucketName, blob, PutOptions.Builder.multipart(true));
However the above code works fine in AWS S3 and adds only one item of type BLOB into the required container.
Debug: I debug the code to find the following:
- step into putBlob(bucketName, blob, PutOptions.Builder.multipart(true))
- step into RegionScopedSwiftBlobStore > putBlob(String container, Blob blob, PutOptions options).
- step into putMultipartBlob(String container, Blob blob, PutOptions overrides). Here i found the contentLength: 109256(file size), partSize: 33554432, part: 0
- *step into initiateMultipartUpload(String container, BlobMetadata blobMetadata, long partSize, PutOptions options). Here I found the *contentLength: 109256(file size), uploadId: TestFile.DOCX/slo/1546583793.081000/109256/33554432
- step into MultipartUpload.create(container, blobMetadata.getName(), uploadId, blobMetadata, options)
- step into new AutoValue_MultipartUpload(containerName, blobName, id, blobMetadata, putOptions). Here onwards I can't debug any further.
Analysis: I observed that if I use SwiftApi instead of the traditional BlobStore then I get the desired result as it creates only one item of type BLOB inside the container. But since we are evaluating a java based third party library to develop a multi cloud application and so far we found Jclouds is the right choice so we would like to use portable apis e.g BlobStore to perform CRUD operations instead of using provider specific apis e.g SwiftApi.
Any help would be greatly appreciated.