gnodet opened a new pull request, #31241:
URL: https://github.com/apache/camel/pull/31241

   ## Summary
   
   Fix `readBufferSize`, `writeBufferSize`, and `bulkRequests` having no effect 
on SFTP
   transfers in `camel-mina-sftp`.
   
   ## Root Cause
   
   `MinaSftpOperations.configureBufferSizes()` was calling
   `SftpModuleProperties.READ_BUFFER_SIZE.set(session, ...)` and
   `SftpModuleProperties.WRITE_BUFFER_SIZE.set(session, ...)`. These session 
properties
   are only consulted by `SftpFileSystemProvider` (the NIO2 `FileSystem`-based 
API), not
   by `SftpClient.read()` / `SftpClient.write()` — the stream methods that this 
component
   actually uses for transfers.
   
   As a result, all four transfer call sites used zero-arg overloads
   (`read(name)`, `write(name, modes)`) regardless of configuration, silently
   transferring files in Apache MINA SSHD's own default chunk size.
   
   ## Fix
   
   Store the computed effective buffer sizes in two new fields 
(`effectiveReadBufferSize`,
   `effectiveWriteBufferSize`) on `MinaSftpOperations`, and pass them directly 
to the
   four transfer call sites:
   
   - `SftpClient.read(name, effectiveReadBufferSize)` — in 
`retrieveFileToStreamInBody`
     and `retrieveFileToFileInLocalWorkDirectory`
   - `SftpClient.write(name, effectiveWriteBufferSize, modes)` — in 
`doStoreFile`
   - `SftpClient.write(name, effectiveWriteBufferSize)` — in `storeFileDirectly`
   
   Passing `0` is equivalent to the previous behaviour (MINA SSHD picks its own 
default),
   so users who have not configured these options are unaffected.
   
   The broken `SftpModuleProperties.set(session, ...)` calls are removed.
   
   The `@UriParam` descriptions for `readBufferSize` and `writeBufferSize` are 
updated —
   they previously said "this option currently has no effect", which accurately 
described
   the bug but would be confusing after the fix.
   
   ## Tests
   
   `MinaSftpOperationsBufferSizeTest` (new, unit test, no SFTP server required) 
verifies
   that `configureBufferSizes()` correctly populates `effectiveReadBufferSize` 
and
   `effectiveWriteBufferSize` for all configuration combinations:
   - explicit `readBufferSize` / `writeBufferSize`
   - default (unconfigured) → 0 (MINA SSHD default)
   - deprecated `bulkRequests` → converted to buffer sizes (32 KB × N, capped 
at ~126 KB)
   - explicit size takes precedence over `bulkRequests`
   
   This is the core regression: before the fix, these fields did not exist and 
the
   configured sizes were silently discarded.
   
   Fixes CAMEL-27915
   
   ---
   _Hermes Agent (Claude Sonnet 4.6) on behalf of Guillaume Nodet_
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to