You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Marco Crivellaro <ma...@gmail.com> on 2013/01/11 15:26:22 UTC

GenericFileProducer ISSUE - target deletion with eagerdeletefile set to false

Hi all,
I just noticed an issue related to deleting the target file when writing
using temporary file names and eagerDeleteTargetFile is set to false.

the producer first checks if target file exists, it than writes the
temporary file. Once temporary file is written the target file is deleted in
case the test performed before writing tmp file was positive.

The final file might be deleted while temporary file is written and the
producer would throw an exception in such situation; it is possible for the
target file to be deleted while writing temporary file especially when
writing large files or using FTP component.

I would suggest to check target file existence (and delete it) before
writing temporary file only when eagerDeleteTargetFile is set to true;
when not eagerly deleting target file I would suggest to check target file
existence (and in case delete it) only after temporary file have been
deployed, right before renaming it.



an improvement would be avoiding the target file deletion by simply renaming
temporary file to target once it has been written (this would save a LIST
which might take a long time using FTP). This should be possible when using
FTP producer. This could be a new fileExists option name
'OptimisticOvveride' where target file is not deleted in case it exists
already.


Looking forward for a feedback from the community.
Please let me know if I should open a JIRA ticket (possibly 2 separate
tickets?).


Regards,
Marco



--
View this message in context: http://camel.465427.n5.nabble.com/GenericFileProducer-ISSUE-target-deletion-with-eagerdeletefile-set-to-false-tp5725390.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: GenericFileProducer ISSUE - target deletion with eagerdeletefile set to false

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jan 11, 2013 at 3:26 PM, Marco Crivellaro <ma...@gmail.com> wrote:
> Hi all,
> I just noticed an issue related to deleting the target file when writing
> using temporary file names and eagerDeleteTargetFile is set to false.
>
> the producer first checks if target file exists, it than writes the
> temporary file. Once temporary file is written the target file is deleted in
> case the test performed before writing tmp file was positive.
>
> The final file might be deleted while temporary file is written and the
> producer would throw an exception in such situation; it is possible for the
> target file to be deleted while writing temporary file especially when
> writing large files or using FTP component.
>
> I would suggest to check target file existence (and delete it) before
> writing temporary file only when eagerDeleteTargetFile is set to true;
> when not eagerly deleting target file I would suggest to check target file
> existence (and in case delete it) only after temporary file have been
> deployed, right before renaming it.
>
>
>
> an improvement would be avoiding the target file deletion by simply renaming
> temporary file to target once it has been written (this would save a LIST
> which might take a long time using FTP). This should be possible when using
> FTP producer. This could be a new fileExists option name
> 'OptimisticOvveride' where target file is not deleted in case it exists
> already.
>
>
> Looking forward for a feedback from the community.
> Please let me know if I should open a JIRA ticket (possibly 2 separate
> tickets?).
>

Its probably easier if your work on a patch, then code + this text is
easier to understand what you say.


>
> Regards,
> Marco
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/GenericFileProducer-ISSUE-target-deletion-with-eagerdeletefile-set-to-false-tp5725390.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen