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

Move file-based discovery to core/server #33030

Closed
ywelsch opened this issue Aug 21, 2018 · 11 comments
Closed

Move file-based discovery to core/server #33030

ywelsch opened this issue Aug 21, 2018 · 11 comments
Assignees
Labels
:Delivery/Build Build or test infrastructure :Distributed Coordination/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure Team:Delivery Meta label for Delivery team v6.4.1 v6.5.0 v7.0.0-beta1

Comments

@ywelsch
Copy link
Contributor

ywelsch commented Aug 21, 2018

Some of our integration tests as well as the REST tests currently use the unicast hosts list setting for node discovery. This list is statically defined at node startup, which makes it very inflexible. For the AbstractDisruptionTestCases, for example, we do port scanning to find free ports in order to fix the ports used by each node so that we can properly setup the unicast hosts list before starting the nodes. This port scanning does not always work reliably.. For our REST tests, we have to wait for the first node to be started up and bound to a port before we can start up the other nodes, as we need to put the address:port of the first node into the unicast hosts list of the other nodes. If we had something more flexible to achieve the same, this could really simplify our test infrastructure while also making it more resilient. Fortunately, such a more flexible node discovery already exists: it's the file-based discovery which is currently packaged as a plugin. The proposal here is to move the file-based discovery to the server project, so that it can be readily used in the testing framework for both AbstractDisruptionTestCase as well as all REST tests.

/cc: @franekrichardson

@ywelsch ywelsch added :Delivery/Build Build or test infrastructure :Distributed Coordination/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure v7.0.0 v6.5.0 v6.4.1 labels Aug 21, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@DaveCTurner
Copy link
Contributor

DaveCTurner commented Aug 21, 2018

The issue here is that we should not simply drop the file-based discovery plugin, because this would be a breaking change to any scripts that provision ES nodes with this plugin installed. I propose:

  • in 6.x, move the implementation of FileBasedUnicastHostsProvider into server, but leave the discovery-file plugin in existence as an empty plugin that logs a deprecation warning if used.

  • in 7.0, remove the now-empty discovery-file plugin.

This means that setting discovery.zen.hosts_provider: file will continue to work as it does now with the plugin installed; furthermore it will also start to work if the plugin is not installed. Installing the plugin will become a no-op in 6.x (except for the deprecation warning) so can be removed from provisioning scripting at leisure. @franekrichardson does this plan work for you?

@franekrichardson
Copy link

@DaveCTurner yes thats very manageable for us 👍

@rjernst
Copy link
Member

rjernst commented Aug 27, 2018

@ywelsch What about adding file based discovery as a dependency of the test framework? It would slightly complicate the file based discovery unit tests, but we didn't add it to server in the first place for a reason right?

@jasontedor
Copy link
Member

That’s not enough, it needs to be available as production code for external-to-us reasons.

@rjernst
Copy link
Member

rjernst commented Aug 27, 2018

it needs to be available as production code for external-to-us reasons.

That was not in this issue description? I only see test uses.

@jasontedor
Copy link
Member

@rjernst I will reach out to discuss.

@DaveCTurner
Copy link
Contributor

I was not aware of a non-test-related reason for doing this. I am also not aware of the reasons why we kept it out of server. Moving it in seems benign - it's a small piece of code and does nothing unless configured - but that is not a convincing argument if there are other ways to achieve the same ends.

Are there other plugins that are available to integ and REST tests? I ask so I can look at the plumbing involved.

@jasontedor
Copy link
Member

jasontedor commented Aug 28, 2018

I was not aware of a non-test-related reason for doing this.

There are non-test production use-cases, for example cloud providers and Docker. One of the big advantages of file-based discovery is that we reload the file when discovery is needed so that hosts can be dynamically added. This is unlike the unicast host list which is not dynamic. That it is a file is also convenient for deployment.

I am also not aware of the reasons why we kept it out of server.

I am not either. And I do not see a compelling reason to keep it out of server. I think it can go directly in server but if that is unsatisfactory to some then we can make it a lib (I think the overhead is not worth it, and the isolation buys us very little).

Are there other plugins that are available to integ and REST tests?

We make the elasticsearch-nio library available, but not the transport-nio plugin. There is not precedence for making plugins available to the test framework.

Let us go with the simple approach of moving to server.

@DaveCTurner
Copy link
Contributor

Makes sense, thanks @jasontedor.

DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this issue Aug 29, 2018
Today we support a static list of seed hosts in core Elasticsearch, and allow a
dynamic list of seed hosts to be provided via a file using the `discovery-file`
plugin. In fact the ability to provide a dynamic list of seed hosts is
increasingly useful in containerized environments, so this change moves this
functionality to core Elasticsearch to avoid the need for a plugin.

For BWC purposes the plugin still exists, but does nothing more than issue a
warning when it is used.

Furthermore, in order to start up nodes in integration tests we currently
assign a known port to each node before startup, which unfortunately sometimes
fails if another process grabs the selected port in the meantime. By moving the
`discovery-file` functionality into the core product we can use it to avoid
this race.

Relates elastic#29244
Closes elastic#33030
DaveCTurner added a commit that referenced this issue Aug 30, 2018
Today we support a static list of seed hosts in core Elasticsearch, and allow a
dynamic list of seed hosts to be provided via a file using the `discovery-file`
plugin. In fact the ability to provide a dynamic list of seed hosts is
increasingly useful, so this change moves this functionality to core
Elasticsearch to avoid the need for a plugin.

Furthermore, in order to start up nodes in integration tests we currently
assign a known port to each node before startup, which unfortunately sometimes
fails if another process grabs the selected port in the meantime. By moving the
`discovery-file` functionality into the core product we can use it to avoid
this race.

This change also moves the expected path to the file from
`$ES_PATH_CONF/discovery-file/unicast_hosts.txt` to
`$ES_PATH_CONF/unicast_hosts.txt`. An example of this file is not included in
distributions.

For BWC purposes the plugin still exists, but does nothing more than create the
example file in the old location, and issue a warning when it is used. We also
continue to support the old location for the file, but warn about its
deprecation.

Relates #29244
Closes #33030
DaveCTurner added a commit that referenced this issue Aug 30, 2018
Today we support a static list of seed hosts in core Elasticsearch, and allow a
dynamic list of seed hosts to be provided via a file using the `discovery-file`
plugin. In fact the ability to provide a dynamic list of seed hosts is
increasingly useful, so this change moves this functionality to core
Elasticsearch to avoid the need for a plugin.

Furthermore, in order to start up nodes in integration tests we currently
assign a known port to each node before startup, which unfortunately sometimes
fails if another process grabs the selected port in the meantime. By moving the
`discovery-file` functionality into the core product we can use it to avoid
this race.

This change also moves the expected path to the file from
`$ES_PATH_CONF/discovery-file/unicast_hosts.txt` to
`$ES_PATH_CONF/unicast_hosts.txt`. An example of this file is not included in
distributions.

For BWC purposes the plugin still exists, but does nothing more than create the
example file in the old location, and issue a warning when it is used. We also
continue to support the old location for the file, but warn about its
deprecation.

Relates #29244
Closes #33030
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure :Distributed Coordination/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure Team:Delivery Meta label for Delivery team v6.4.1 v6.5.0 v7.0.0-beta1
Projects
None yet
Development

No branches or pull requests

8 participants