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

Handle truncated translog gracefully #9797

Merged
merged 1 commit into from Mar 3, 2015

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented Feb 20, 2015

We used to handle truncated translogs in a better manner (assuming that
the node was killed halfway through writing an operation and discarding
the last operation). This brings back that behavior by catching an
EOFException during the stream reading and throwing a
TruncatedTranslogException which can be safely ignored in
IndexShardGateway.

Fixes #9699

@kimchy
Copy link
Member

kimchy commented Feb 20, 2015

@dakrone this looks good, I wonder if in the test we should write a translog and then munge it to remove the last few bytes to simulate transactions? that way we don't have a file that might eventually not support backward comp. on written ops?

I think its a good change since it restores the previous behavior, would be good to work on the per op better translog handling as well eventually that will make this more resilient (can't find the issue now)

@dakrone
Copy link
Member Author

dakrone commented Feb 23, 2015

@kimchy sounds good, I added another test that tests truncated translog files (for a non-pre-generated translog)

@kimchy
Copy link
Member

kimchy commented Mar 3, 2015

@dakrone it looks great, I would consider adding another test, that reads the data in a similar manner that the gateway does (reading it one by one, not based on locations), and seeing that we get a truncated exception once we work no a truncated translog? other than that, LGTM

We used to handle truncated translogs in a better manner (assuming that
the node was killed halfway through writing an operation and discarding
the last operation). This brings back that behavior by catching an
`EOFException` during the stream reading and throwing a
`TruncatedTranslogException` which can be safely ignored in
`IndexShardGateway`.

Fixes elastic#9699
@dakrone dakrone merged commit 94a74dd into elastic:master Mar 3, 2015
@dakrone dakrone added the v1.4.5 label Mar 3, 2015
@dakrone dakrone deleted the truncated-translog branch June 1, 2015 22:34
@clintongormley clintongormley changed the title [CORE] Handle truncated translog gracefully Handle truncated translog gracefully Jun 7, 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
blocker :Distributed/Engine Anything around managing Lucene and the Translog in an open shard. >enhancement v1.4.5 v1.5.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Elasticsearch translog corruption if process is killed
3 participants