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

Docs: We should have examples of allocate_empty_primary and allocate_stale_primary #33069

Closed
nik9000 opened this issue Aug 22, 2018 · 5 comments
Labels
:Distributed/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) >docs General docs changes

Comments

@nik9000
Copy link
Member

nik9000 commented Aug 22, 2018

On this page we describe a few cluster reroute commands but we don't have examples of allocate_empty_primary and allocate_stale_primary. i know they are dangerous APIs that intentionally lose data, but if the disk that has the data on it is gone you want to run them and it'd be really nice to have a written out example on the page.

@nik9000 nik9000 added :Distributed/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) :Docs labels Aug 22, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs

@nik9000 nik9000 added >docs General docs changes and removed :Docs labels Aug 22, 2018
@nik9000
Copy link
Member Author

nik9000 commented Aug 22, 2018

It turns out we've talked about this in the past and thought that it was safer not to have examples of these APIs because we really, really, really don't want folks copying and pasting them and losing data. Because these APIs lose data. That is the whole point. But my point stands: when you need them, you need them. And it is nice to have an example of the structure.

I wonder if we could document them with the allow_data_loss flag set to false so if anyone copies and pastes them then they won't work. I really just want them documented so you see the structure, and the structure is still there if you set that flag to false.

@vladimirdolzhenko
Copy link
Contributor

It will appear indirectly due to work of another dangerous piece: #31389

it requires put a new allocation id and therefore provide command on how to allocate_stale_primary or in the worst scenario even allocate_empty_primary

@nik9000
Copy link
Member Author

nik9000 commented Aug 23, 2018

A small group of us talked about this and ended up pretty split but ultimately decided that the documentation that we have now is what we're going to stick with. The argument went like this:

We consider these command dangerous to copy and paste and execute.

But we consider these commands genuinely useful in certain circumstances: when you know you've lost data and there is no way to get it back, these commands put the index back into a state where you can write to them. Then you can work on getting the data base. If you have a recent backup then it is almost certainly better to restore the backup, flip an alias, and delete the broken index. But if you can't do that, then these commands are useful.

But we document how to send these command already. We just don't give examples. Knowing that you need these commands probably means that you are familiar enough with Elasticsearch to construct the command from the documentation.

But when you need these commands it means you've lost some data. Which probably means something catastrophic has happened and you are having a bad day. I know when I'm having a bad day I have a ton more trouble building commands from prose. Having an actual example will really help in these cases.

But when you are frustrated and having a bad day you are much more prone to making mistakes. This is exactly when you should slow down, read the prose a few times, then build the command. That makes triple sure that you understand the consequences of losing data.

@nik9000 nik9000 closed this as completed Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) >docs General docs changes
Projects
None yet
Development

No branches or pull requests

4 participants