-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File locked during deletion - fix #14
Conversation
state.deleteCompletedFile(file.fileName); | ||
} | ||
else{ | ||
log.info("Unable to obtain lock"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add file name to message.
Also, should this be WARN?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
log.warn("Unable to delete ingested file {}", e); | ||
// We can continue on this error. It will be retried on the next iteration. | ||
log.warn("Unable to delete ingested file {}", e.getMessage()); | ||
log.warn("File is locked by another process. Will retry deletion."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This log line will be written for any exception not just when file is locked.
This is not correct we should have this message only when it is really locked by other process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified it.
log.warn("Unable to delete ingested file {}", e); | ||
// We can continue on this error. It will be retried on the next iteration. | ||
log.warn("Unable to delete ingested file {}", e.getMessage()); | ||
log.warn("File is locked by another process. Will retry deletion."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified it.
This update will obtain a lock on the file before triggering deletion. If the lock is not acquired, file deletion will be skipped and retried.
Testing:
Tested using a python script to lock the file. The file was ingested and deleted after the lock was released.