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

[WIP] Improve repository registration #31070

Closed
wants to merge 1 commit into from

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented Jun 4, 2018

This is a work in progress pull request, I opened it to gather @ywelsch's opinion on it.

The current RepositoriesService has some issues, the most notable being that repository instances are created and started on the cluster state update thread (reported in #9488). Another one is that repository can fail to be created on non-master nodes and today the instance is just abruptly closed. Another one is that a repository is closed when it is unregistered but there is no control if the instance is used somewhere else.

I think that the respository registration could be improved when it registers a repository. It could first check if the repository is used and fails directly in this case, without executing a cluster state update. Same thing if the repository metadata are unchanged, no need to trigger another cluster state update.

It could also create the repository and starts it first on the master node, and only adds it to the cluster state if everything is ok. If something goes wrong the newly created repository instance is just closed and an error is reported to the listener. This way the cluster state update is a light operation - it replaces the repository instance in a in memory map and puts the old repository (in case of an update) to a list of repository to be closed once the cluster state is applied. On non-master node, we can always create the repository instance and also keep around the previous repository instance to close it later. If the repository failed to be created, the error is logged and the in memory repository becomes a FailedRepository instance that throws UnsupportedException every time it is used. The repository must be deleted and recreated in this case.

In addition to this pull request (but not implemented here) I think that Repository could be a RefCounted so everything that uses a Repository instance could use incRef()/decRef() and we could close the repository is a cleaner way that is done today.

@tlrx tlrx added WIP :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v7.0.0 labels Jun 4, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@tlrx tlrx closed this Aug 16, 2018
@jpountz jpountz removed the v7.0.0 label Jan 29, 2019
@tlrx tlrx deleted the repositories-registration branch February 12, 2019 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants