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 exception message when shard has a partial commit (segments_N file) due to prior disk full #11539

Merged
merged 1 commit into from Jun 8, 2015

Conversation

mikemccand
Copy link
Contributor

ES checks the latest segments_N file to see if it was written by Lucene 3.x and upgrade if so, but if that file is truncated (e.g. 0 bytes) due prior disk full, we now give a confusing "failed to upgrade 3x segments" exception when you likely don't have 3.x segments_N nor segments.

This change just breaks apart the exception handling so we do a better job separating "I could not read the latest segments_N file" from "I did read it and it was ancient (Lucene 3.x) and then when I tried to upgrade it, bad things happened".

Closed #11249

@mikemccand mikemccand added >bug :Core/Infra/Core Core issues without another label v1.6.0 labels Jun 8, 2015
@mikemccand mikemccand self-assigned this Jun 8, 2015
try (IndexInput input = directory.openInput(si, IOContext.READONCE)) {
public static boolean indexNeeds3xUpgrading(Directory directory) throws IOException {
final String segmentsFile = SegmentInfos.getLastCommitSegmentsFileName(directory);
if (segmentsFile != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

thank you for renaming this.

@rmuir
Copy link
Contributor

rmuir commented Jun 8, 2015

looks good

mikemccand pushed a commit that referenced this pull request Jun 8, 2015
Improve exception message when shard has a partial commit (segments_N file) due to prior disk full
@mikemccand mikemccand merged commit a4e3d1f into elastic:1.x Jun 8, 2015
@mikemccand mikemccand mentioned this pull request Jun 8, 2015
@clintongormley clintongormley added :Exceptions and removed :Core/Infra/Core Core issues without another label labels Jun 12, 2015
@lcawl lcawl added :Core/Infra/Core Core issues without another label and removed :Exceptions labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Core Core issues without another label v1.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants