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
Read segment info from latest commit whenever possible #11361
Read segment info from latest commit whenever possible #11361
Conversation
@mikemccand can you take a look at this? |
@@ -152,7 +152,7 @@ public SegmentInfos readLastCommittedSegmentsInfo() throws IOException { | |||
*/ | |||
private static SegmentInfos readSegmentsInfo(IndexCommit commit, Directory directory) throws IOException { | |||
try { |
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.
Maybe remove Directory directory
arg here? Or assert that directory == commit.getDirectory()
?
LGTM, thanks @dakrone! |
41c9a61
to
6646881
Compare
Instead of listing the directory to file the latest segments_N file, we should re-use the generation/filename from the last commit. This allows us to avoid potential race conditions on the filesystem as well as reduce the number of directory listings performed.
I don't think I'm going to backport this, the Lucene API is different and I think I will work on an alternative to avoid upgrading Lucene 3.x segments when not needed, which is when the race condition usually occurs. |
fails In the event that reading from the latest commit fails, we should fall back to reading from the `Store` using the traditional `Directory.listAll()` Related to elastic#11361
fails In the event that reading from the latest commit fails, we should fall back to reading from the `Store` using the traditional `Directory.listAll()` Related to elastic#11361
fails In the event that reading from the latest commit fails, we should fall back to reading from the `Store` using the traditional `Directory.listAll()` Related to elastic#11361
Instead of listing the directory to file the latest segments_N file, we
should re-use the generation/filename from the last commit. This allows
us to avoid potential race conditions on the filesystem as well as
reduce the number of directory listings performed.