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

Use more specific name for mandatory plugin check selectively #446

Merged

Conversation

dliappis
Copy link
Contributor

Commit 7a051f3 reverted the use of a
more specific plugin name for the mandatory plugin
check (e.g. specifying mandatory.plugin=x-pack instead of
``mandatory.plugin=x-pack-security`), however, more specific names are
still required for benchmarking release versions <6.3.

Selectively use a more specific name for the mandatory plugin check
depending on the Elasticsearch version.

Also add test cases for both scenarios.

Relates: 7a051f3
Relates: elastic/elasticsearch#28710

Commit 7a051f3 reverted the use of a
more specific plugin name for the mandatory plugin
check (e.g. specifying `mandatory.plugin=x-pack` instead of
``mandatory.plugin=x-pack-security`), however, more specific names are
still required for benchmarking release versions <6.3.

Selectively use a more specific name for the mandatory plugin check
depending on the Elasticsearch version.

Also add test cases for both scenarios.

Relates: 7a051f3
Relates: elastic/elasticsearch#28710
@dliappis dliappis added the bug Something's wrong label Mar 26, 2018
@dliappis dliappis added this to the 0.10.0 milestone Mar 26, 2018
Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I left a few questions and suggestions.

(versions.major_version(self.distribution_version) < 6)):
mandatory_plugins.append(installer.sub_plugin_name)
else:
raise NameError
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand the need to raise NameError here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is so that that if the version of Elasticsearch is >=6.3, the non-specific plugin name is applied (inside the exception code) i.e. force the execution inside the exception block.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, but I mean it's not really an error condition if the version is >= 6.3? We could just set the plugin name with mandatory_plugins.append(installer.plugin_name) instead of raising an error which seems more straightforward to read to me.

mandatory_plugins.append(installer.plugin_name)
# For Elasticsearch < 6.3 more specific plugin names are required for mandatory plugin check
# Details in: https://github.com/elastic/elasticsearch/pull/28710
try:
Copy link
Member

Choose a reason for hiding this comment

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

I understand that it is a necessity at the moment but I think we should try to be version-agnostic in provisioner code. When earlier 6.x versions are not in use anymore I think we should remove this again to stay version-agnostic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree with you. I was hesitant to add this conditional here and wasn't 100% sure in which place to define the constraints themselves. Should I add a TODO: to remove this when <6.3 is EOL?

Copy link
Member

Choose a reason for hiding this comment

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

yes, please add a TODO.

# For Elasticsearch < 6.3 more specific plugin names are required for mandatory plugin check
# Details in: https://github.com/elastic/elasticsearch/pull/28710
try:
if ((versions.major_version(self.distribution_version) == 6 and
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively you could use major, minor, _, _ = versions.components(self.distribution_version). Then there would also be no need for a new helper function minor_version in the versions module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes good suggestion! I felt like simplifying the code inside the _provisioner_variables() method with no need to assign temporary variables but there are ways around it and I agree let's not add another helper function.

mandatory_plugins.append(installer.sub_plugin_name)
else:
raise NameError
except (NameError, TypeError, exceptions.InvalidSyntax):
Copy link
Member

Choose a reason for hiding this comment

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

I think a TypeError should not occur at this point? If the individual components of the version string are not int they would not match the regex.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup it was added because the integration tests raise this, if not present:

[ERROR] Cannot race. expected string or bytes-like object
	Traceback (most recent call last):
  File "/home/dl/source/elastic/dliappis_forks/rally/.tox/py36/lib/python3.6/site-packages/esrally/mechanic/mechanic.py", line 516, in receiveMsg_StartNodes
    nodes = self.mechanic.start_engine()
  File "/home/dl/source/elastic/dliappis_forks/rally/.tox/py36/lib/python3.6/site-packages/esrally/mechanic/mechanic.py", line 645, in start_engine
    node_configs.append(p.prepare(binaries))
  File "/home/dl/source/elastic/dliappis_forks/rally/.tox/py36/lib/python3.6/site-packages/esrally/mechanic/provisioner.py", line 164, in prepare
    provisioner_vars = self._provisioner_variables()
  File "/home/dl/source/elastic/dliappis_forks/rally/.tox/py36/lib/python3.6/site-packages/esrally/mechanic/provisioner.py", line 192, in _provisioner_variables
    if ((versions.major_version(self.distribution_version) == 6 and
  File "/home/dl/source/elastic/dliappis_forks/rally/.tox/py36/lib/python3.6/site-packages/esrally/utils/versions.py", line 25, in major_version
    major, _, _, _ = components(version)
  File "/home/dl/source/elastic/dliappis_forks/rally/.tox/py36/lib/python3.6/site-packages/esrally/utils/versions.py", line 49, in components
    matches = versions_pattern.match(version)
TypeError: expected string or bytes-like object

@dliappis
Copy link
Contributor Author

dliappis commented Apr 3, 2018

@danielmitterdorfer I addressed the comments, could you please have a look again?

Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

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

LGTM

@danielmitterdorfer danielmitterdorfer added the :Benchmark Candidate Management Anything affecting how Rally sets up Elasticsearch label Apr 3, 2018
@dliappis dliappis merged commit b6fdad8 into elastic:master Apr 3, 2018
@dliappis dliappis deleted the selective-use-of-mandatory-plugin-name branch April 3, 2018 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Benchmark Candidate Management Anything affecting how Rally sets up Elasticsearch bug Something's wrong
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants