Skip to content
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

Improve safety when deleting files from the store #9801

Merged
merged 1 commit into from Feb 24, 2015

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented Feb 20, 2015

Today if we delete files from the index directory we never acquire the
write lock. Yet, for safety reasons we should get the write lock before
we modify / delete any files. Where we can we should leave the deletion
to the index writer and only delete that are necessary to delete ourself.

@s1monw s1monw changed the title Acquire write.lock before pruning segments files [STORE] Improve safety when deleting files from the store Feb 24, 2015
@s1monw
Copy link
Contributor Author

s1monw commented Feb 24, 2015

I updated this to fix other places as well where we need the write lock and added more safety. @mikemccand @rmuir can you take a look please

@rmuir
Copy link
Contributor

rmuir commented Feb 24, 2015

+1

}
try {
dir.deleteFile(reason, existingFile);
} catch (FileNotFoundException | NoSuchFileException ex) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm if we have the write lock on this dir, why would we hit FNFE/NSFE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question - I will remove

@mikemccand
Copy link
Contributor

Left a couple comments, otherwise LGTM!

Today if we delete files from the index directory we never acquire the
write lock. Yet, for safety reasons we should get the write lock before
we modify / delete any files. Where we can we should leave the deletion
to the index writer and only delete that are necessary to delete ourself.
@s1monw s1monw merged commit c54bd2f into elastic:master Feb 24, 2015
@clintongormley clintongormley added :Distributed/Store Issues around managing unopened Lucene indices. If it touches Store.java, this is a likely label. and removed review labels Mar 19, 2015
@clintongormley clintongormley changed the title [STORE] Improve safety when deleting files from the store Improve safety when deleting files from the store Jun 7, 2015
@clintongormley clintongormley added :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. and removed :Distributed/Store Issues around managing unopened Lucene indices. If it touches Store.java, this is a likely label. labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Engine Anything around managing Lucene and the Translog in an open shard. >enhancement resiliency v1.5.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants