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

Make modifying operations durable by default. #11011

Merged
merged 1 commit into from May 7, 2015

Conversation

s1monw
Copy link
Contributor

@s1monw s1monw commented May 6, 2015

This commit makes create, update and delete operations on an index durable
by default. The user has the option to opt out to use async translog flushes
on a per-index basis by settings index.translog.durability=request.

Initial benchmarks running on SSDs have show that indexing is about 7% - 10% slower
with bulk indexing compared to async translog flushes. This change is orthogonal to
the transaction log sync interval and will only sync the transaction log if the operation
has not yet been concurrently synced. Ie. if multiple indexing requests are submitted and
one operations sync call already persists the operations of others only one sync call is executed.

Relates to #10933

*/
public void setDurable(boolean durable) {
this.durable = durable;
}
Copy link
Member

Choose a reason for hiding this comment

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

existing getters in this class use the non getter getters convention and settters return this. Don't want to start the whole discussion here but maybe at least in the same class we should follow one single convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

setters are the way to go I will fix all the others but not in this PR

Copy link
Member

Choose a reason for hiding this comment

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

you mean you will fix every getter and setter in the java api? I didnt know we finally made a decision around this... would love to have a single way to do things throughout the codebase though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah we should just do what every java project does and use setters and getters

@s1monw
Copy link
Contributor Author

s1monw commented May 6, 2015

@rmuir I pushed a new commit and replied to your comment

@kimchy
Copy link
Member

kimchy commented May 6, 2015

@s1monw +1, looks great. As a follow up to this change, we need to think about an index level setting for it (or maybe adapt the "sync" config to do this automatically when set to 0), and have more benchmarks on more adventurous environments so we can help explain the tradeoffs

@s1monw
Copy link
Contributor Author

s1monw commented May 6, 2015

@kimchy after thinking about this I think we should go only with an index level setting and drop the entire per request thing. The reason is that with per-request settings you need to change an application to change the value while with index level settings we can do this via the API which is more flexible and safer, opinions?

@kimchy
Copy link
Member

kimchy commented May 6, 2015

@s1monw that was my reasoning towards having an index level setting for it, I tend to prefer it, we can always add per request later if needed

@s1monw
Copy link
Contributor Author

s1monw commented May 6, 2015

ok moving towards index level setting

@rmuir
Copy link
Contributor

rmuir commented May 6, 2015

thanks for improving the loop with asserts/comments!

@s1monw
Copy link
Contributor Author

s1monw commented May 6, 2015

@kimchy I think it's ready now with an index level setting

@kimchy
Copy link
Member

kimchy commented May 6, 2015

@s1monw this looks great

This commit makes create, update and delete operations on an index durable
by default. The user has the option to opt out to use async translog flushes
on a per-index basis by settings `index.translog.durability=request`.

Initial benchmarks running on SSDs have show that indexing is about 7% - 10% slower
with bulk indexing compared to async translog flushes. This change is orthogonal to
the transaction log sync interval and will only sync the transaction log if the operation
has not yet been concurrently synced. Ie. if multiple indexing requests are submitted and
one operations sync call already persists the operations of others only one sync call is executed.

Relates to elastic#10933
@jpountz
Copy link
Contributor

jpountz commented May 7, 2015

Should we document this new setting and add a note to the resiliency status page?

@s1monw
Copy link
Contributor Author

s1monw commented May 7, 2015

@jpountz I don't think we are done yet. I want to open a documentation issue once we are setted with all thte things - the more important issue where we fix the translog corruption is still coming

@jpountz
Copy link
Contributor

jpountz commented May 7, 2015

Sounds great. Just wanted to make sure it doesn't get forgotten. :)

s1monw added a commit to s1monw/elasticsearch that referenced this pull request May 13, 2015
Today we are almost intentionally corrupt the translog if we loose
a node due to powerloss or similary disasters. In the translog reading
code we simply read until we hit an EOF exception ignoring the rest of the
translog file once hit. There is no information stored how many records
we are expecting or what the last written offset was.

This commit restructures the translog to add checkpoints that are written
with every sync operation recording the number of synced operations as well
as the last synced offset. These checkpoints are also used to identify the actual
transaction log file to open instead of relying on directory traversal.

This change adds a significant amount of additional checks and pickyness to the translog
code. For instance is the translog now associated with a specific engine via a UUID that is
written to each translog file as part of it's header. If an engine opens a translog file it
was not associated with the operation will fail.

Closes to elastic#10933
Relates to elastic#11011
s1monw added a commit that referenced this pull request May 18, 2015
Add translog checkpoints to prevent translog corruption

Closes to #10933
Relates to #11011
@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 PITA resiliency v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants