Claus Ibsen created CAMEL-27802:
-----------------------------------
Summary: camel-smb: readLock=rename never retries, renameUsingCopy
copies twice per lock attempt, a round trip per written buffer
Key: CAMEL-27802
URL: https://issues.apache.org/jira/browse/CAMEL-27802
Project: Camel
Issue Type: Bug
Components: camel-smb
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-smb for CAMEL-23832
(pull request https://github.com/apache/camel/pull/31138).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. readLock=rename does not wait up to readLockTimeout
In {{SmbOperations.renameFile}}, {{share.openFile}} throws a raw
SMBApiException (for example a sharing violation). {{atomicRenameFile}} wraps
it in a GenericFileOperationFailedException whose cause is an
SMBRuntimeException, not an IOException, and
{{GenericFileRenameExclusiveReadLockStrategy}} retries only on an IOException
cause. So it rethrows on the first failure and the file is skipped with a WARN
until the next poll.
Proposed change: wrap SMBApiException from the open and the rename with an
IOException cause, or catch it in the read lock.
h4. 2. readLock=rename with renameUsingCopy copies the whole file twice per
lock attempt
With renameUsingCopy=true (or the copyAndDeleteOnRenameFail fallback) each lock
attempt copies the file on the server and back.
h4. 3. A server round trip per written buffer
{{SmbOperations.writeToFile}} calls {{getFileInformation}} for every buffer to
find the offset; it could track the offset itself, reading it once for Append.
h4. 4. readLock=changed uses ChangeTime
{{SmbExclusiveReadLockCheck}} compares the file's ChangeTime, not its
LastWriteTime, and readLockMinAge compares the server clock with the local
clock.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)