[
https://issues.apache.org/jira/browse/CAMEL-27738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27738:
--------------------------------
Fix Version/s: 4.25.0
(was: 4.24.0)
> camel-minio: moveAfterRead range copy, content headers as user metadata,
> deleteObjects errors
> ---------------------------------------------------------------------------------------------
>
> Key: CAMEL-27738
> URL: https://issues.apache.org/jira/browse/CAMEL-27738
> Project: Camel
> Issue Type: Bug
> Components: camel-minio
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-minio for CAMEL-23832
> (commit
> https://github.com/apache/camel/commit/b82eef5b59e581059179cfd3aa240e1194ec9c8c).
> These are separate problems of the component; the descriptions commit only
> documents the current behavior.
> h4. 1. moveAfterRead with offset or length moves only part of the object and
> deletes the original
> {{MinioConsumer.copyObject()}} applies the {{offset}} and {{length}} options
> to the {{SourceObject}} of the copy. The MinIO client then copies only that
> byte range (via compose object), and {{MinioConsumer.processCommit()}}
> deletes the source object afterwards. The user who reads only a range of each
> object loses the rest of it.
> Do not apply {{offset}} and {{length}} to the source of the move.
> h4. 2. The producer stores the content headers as user metadata, not as HTTP
> headers of the object
> {{MinioProducer.determineMetadata()}} puts {{CamelMinioContentType}},
> {{CamelMinioContentControl}}, {{CamelMinioContentDisposition}},
> {{CamelMinioContentEncoding}}, {{CamelMinioContentMD5}} and the content
> length into the map passed to {{PutObjectArgs.Builder.userMetadata()}}. The
> SDK prefixes each key with {{x-amz-meta-}}, so the object gets
> {{x-amz-meta-Content-Type}} and keeps the content type
> {{application/octet-stream}}; Cache-Control, Content-Disposition and
> Content-Encoding are not set either.
> Pass these values as headers ({{PutObjectArgs.Builder.headers()}} /
> {{contentType()}}) instead of user metadata.
> h4. 3. deleteObjects ignores failures
> {{MinioProducer.deleteObjects()}} calls
> {{minioClient.removeObjects(...).iterator().hasNext()}} and sets the body to
> {{true}}. The SDK reports failed deletes, and a failed request, as {{Result}}
> items of that iterator, which the producer never reads. After the first batch
> (1000 objects) that has an error, the following batches are not sent. The
> route sees {{true}} in all cases.
> Iterate the results and fail the exchange (or return the errors) when there
> are any.
> h4. 4. moveAfterRead without destinationBucketName only logs a warning
> {{MinioConsumer.doStart()}} logs "invalid destinationBucketName found" and
> starts. On completion, {{MinioConsumer.copyObject()}} throws an
> {{IllegalArgumentException}}, which {{processCommit()}} does not catch (it
> catches only {{MinioException}}). The object is neither moved nor deleted, so
> every poll consumes it again.
> Fail the start of the consumer when {{moveAfterRead}} is true and
> {{destinationBucketName}} is not set.
> h4. 5. autoCloseBody=false never closes the stream of the object
> {{MinioConsumer.processBatch()}} reads the object stream into a byte array
> with {{IOUtils.toByteArray()}} and closes the stream on completion only when
> {{autoCloseBody}} is true. The route never sees the stream, so with {{false}}
> nothing closes it.
> Close the stream right after reading it, and deprecate {{autoCloseBody}}.
> h4. 6. includeVersions and includeUserMetadata have no effect on the messages
> With {{includeVersions}}, {{MinioConsumer.createExchanges()}} uses only
> {{Item.objectName()}}: the version ID of the listed item is not used, so the
> consumer gets each name once per poll in the current version (or the one
> fixed {{versionId}}). With {{includeUserMetadata}}, the listed user metadata
> is not put on the message. In addition, {{ListObjectsArgs}} rejects
> {{includeUserMetadata}} together with {{useVersion1}} or {{includeVersions}},
> so every poll fails with that combination.
> Use the listed version ID and user metadata, or deprecate the options, and
> reject the invalid combination at startup.
> h4. 7. pojoRequest overrides the expiry and method of a presigned URL request
> {{MinioProducer.createPresignedUrl()}} calls {{expiry()}} and {{method()}} on
> the {{GetPresignedObjectUrlArgs.Builder}} of the body, so the expiry set in
> the builder is replaced by 3600 seconds or the
> {{CamelMinioPresignedURLExpirationTime}} header.
> Keep the values of the builder when {{pojoRequest}} is true.
> h4. 8. maxConnections does nothing
> The option ({{MinioConfiguration.maxConnections}}, default 60) is never read:
> it is not passed to the MinIO client or its {{OkHttpClient}}.
> Deprecate it, or apply it to the connection pool of the HTTP client that the
> component creates.
> h4. 9. Header metadata
> * {{CamelMinioLastModified}} has {{javaType = "java.util.Date"}}, but
> {{MinioEndpoint.getObjectStat()}} sets the raw {{last-modified}} header
> value, a String.
> * {{CamelMinioStorageClass}} has {{label = "producer"}}, but the consumer
> also sets it.
> * Headers that only the consumer sets have no label:
> {{CamelMinioBucketName}}, {{CamelMinioLastModified}},
> {{CamelMinioServerSideEncryption}}, {{CamelMinioExpirationTime}},
> {{CamelMinioReplicationStatus}}. Headers that only the producer reads have no
> label: {{CamelMinioOverrideBucketName}}, {{CamelMinioContentMD5}}.
> h4. 10. proxyPort is the port of the server
> {{proxyPort}} is passed to {{MinioClient.Builder.endpoint(endpoint, port,
> secure)}}: it is the port of the MinIO server, not of a proxy. The name
> misleads users who look for a proxy setting (that needs {{customHttpClient}}).
> Consider a {{port}} alias or a rename in a major version.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)