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
Add current translog ID to commit meta before closing #8245
Conversation
LGTM. |
currentIndexWriter().close(false); | ||
{ // commit and close the current writer - we write the current tanslog ID just in case | ||
final long translogId = translog.currentId(); | ||
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)).map()); |
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.
Asking for my own information here, but would it be more efficient to use new HashMap<String, String>(1)
because we always know the capacity for the HashMap? The default constructor has an initialCapacity
of 16, does it save much to manually lower it?
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.
almost certainly - I just copy pasted this feel free to cut over the other places ;)
Today we simply close the IW when we have to open a new one if ie. we change merge settings. Yet, the API is deprecated and under the hood it commits the IW. For safety we should add the current translog ID and use rollback instead to not wait for merges.
e5e1321
to
31db8cc
Compare
@dakrone I pushed another commit that fixes the map builder too |
LGTM |
Today we simply close the IW when we have to open a new one if ie.
we change merge settings. Yet, the API is deprecated and under the hood
it commits the IW. For safety we should add the current translog ID and
use rollback instead to not wait for merges.