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

Return empty CommitID from ShadowEngine#flush #11554

Merged
merged 1 commit into from
Jun 10, 2015

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented Jun 9, 2015

this change removes CommitID reading for 1.x indices to prevent raceconditions on shared FS for shadow engines where null is returned if a race happens. We now simply return an empty commit ID which is not needed on shadow engines anyway.

@s1monw
Copy link
Contributor Author

s1monw commented Jun 9, 2015

}
// we have to read this in a loop since there is a potential race-condition between reading
// the segment info and reading the commit ID/
}
Copy link
Contributor

Choose a reason for hiding this comment

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

while(true) doesn't seem right. Should this be done in a FindSegmentsFile block to remove the race?

Copy link
Member

Choose a reason for hiding this comment

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

I think doing it in a FindSegmentsFile block would be better, but there is still going to be a race condition on actually reading the segments file, so it will still need to be in a loop?

@s1monw
Copy link
Contributor Author

s1monw commented Jun 9, 2015

@dakrone @rmuir I am happy to remove the loop and just return an empty CommitID here it doesn't make a difference anyway? Thoughs

@dakrone
Copy link
Member

dakrone commented Jun 9, 2015

@s1monw that sounds fine to me, if we don't need the CommitID why even read it at all then? Why not always return an empty one?

@bleskes
Copy link
Contributor

bleskes commented Jun 9, 2015

+1 on an empty commit ID all the time. The only use case for it now is the synced flush which isn't supported anyway on ShadowEngines.

@s1monw
Copy link
Contributor Author

s1monw commented Jun 10, 2015

@bleskes @rmuir @dakrone I pushed a new commit - I think it's ready

@s1monw s1monw changed the title Retry reading commit ID on shared FS when shadow engine flushes Return empty CommitID from ShadowEngine#flush Jun 10, 2015
@@ -155,7 +158,9 @@ public CommitId flush(boolean force, boolean waitIfOngoing) throws EngineExcepti
} finally {
store.decRef();
}
return id;
// We can just return an empty commit ID since this is a read only engine that
// doesn't modify anything so the content of this ID doesn't really matter
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a little note about avoiding race conditions between read and writes on a shared FS ? I think this will people we not see why we opted to EMPTY_COMMIT_ID

@bleskes
Copy link
Contributor

bleskes commented Jun 10, 2015

LGTM. Left one trivial comment

@s1monw s1monw force-pushed the make_commit_id_mandatory branch 2 times, most recently from 9aba2e2 to 72acf7b Compare June 10, 2015 10:32
This change removes CommitID reading for 1.x indices to prevent
raceconditions on shared FS for shadow engines where null is
returned if a race happens. We now simply return an empty
commit ID which is not needed on shadow engines anyway.
@s1monw s1monw merged commit 72acf7b into elastic:1.x Jun 10, 2015
@s1monw s1monw removed the review label Jun 10, 2015
@s1monw s1monw deleted the make_commit_id_mandatory branch June 10, 2015 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants