On Fri, Jan 11, 2013 at 3:26 PM, Marco Crivellaro <marco.cr...@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: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen