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

Remove useless random translog directory selection #10589

Merged
merged 1 commit into from Apr 14, 2015

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented Apr 14, 2015

Using ThreadLocalRandom only prevents reproducibilty but doesn't buy us
anything. In production different datapaths won't have the same since
anyway or at least with a low likelyhood.

@@ -237,7 +236,7 @@ public void newTranslog(long id) throws TranslogException, IOException {
if (currentFree < size) {
size = currentFree;
location = file;
} else if (currentFree == size && ThreadLocalRandom.current().nextBoolean()) {
} else if (currentFree == size) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need the else condition at all now? Could we just keep the first if block (meaning we take the first location instead of the last if they are all equal?)

@rjernst
Copy link
Member

rjernst commented Apr 14, 2015

LGTM, just left one small question.

@s1monw
Copy link
Contributor Author

s1monw commented Apr 14, 2015

good point @rjernst I removed it

Using ThreadLocalRandom only prevents reproducibilty but doesn't buy us
anything. In production different datapaths won't have the same since
anyway or at least with a low likelyhood.
@s1monw s1monw merged commit 210f6c7 into elastic:master Apr 14, 2015
@clintongormley clintongormley changed the title [TRANSLOG] Remove useless random translog directory selection Remove useless random translog directory selection May 29, 2015
@clintongormley clintongormley added :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. and removed :Translog :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. 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 v1.6.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants