Skip to content

Commit

Permalink
Use more specific name for mandatory plugin check selectively
Browse files Browse the repository at this point in the history
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, this was 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.

Relates: 7a051f3
Relates: elastic/elasticsearch#28710
  • Loading branch information
dliappis committed Mar 24, 2018
1 parent 7aad2e8 commit b1b57fa
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
21 changes: 17 additions & 4 deletions esrally/mechanic/provisioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
import jinja2

from esrally import exceptions
from esrally.utils import io, console, process, modules
from esrally.utils import io, console, process, modules, versions

logger = logging.getLogger("rally.provisioner")


def local_provisioner(cfg, car, plugins, cluster_settings, all_node_ips, target_root, node_id):
distribution_version = cfg.opts("mechanic", "distribution.version", mandatory=False)
ip = cfg.opts("provisioning", "node.ip")
http_port = cfg.opts("provisioning", "node.http.port")
node_name_prefix = cfg.opts("provisioning", "node.name.prefix")
Expand All @@ -24,7 +25,7 @@ def local_provisioner(cfg, car, plugins, cluster_settings, all_node_ips, target_
es_installer = ElasticsearchInstaller(car, node_name, node_root_dir, all_node_ips, ip, http_port)
plugin_installers = [PluginInstaller(plugin) for plugin in plugins]

return BareProvisioner(cluster_settings, es_installer, plugin_installers, preserve)
return BareProvisioner(cluster_settings, es_installer, plugin_installers, distribution_version, preserve)


def no_op_provisioner():
Expand Down Expand Up @@ -143,11 +144,12 @@ class BareProvisioner:
of the benchmark candidate to the appropriate place.
"""

def __init__(self, cluster_settings, es_installer, plugin_installers, preserve, apply_config=_apply_config):
def __init__(self, cluster_settings, es_installer, plugin_installers, distribution_version, preserve, apply_config=_apply_config):
self.preserve = preserve
self._cluster_settings = cluster_settings
self.es_installer = es_installer
self.plugin_installers = plugin_installers
self.distribution_version = distribution_version
self.apply_config = apply_config

def prepare(self, binary):
Expand Down Expand Up @@ -184,7 +186,13 @@ def _provisioner_variables(self):
plugin_variables = {}
mandatory_plugins = []
for installer in self.plugin_installers:
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
if (versions.major_version(self.distribution_version) < 7 and
versions.minor_version(self.distribution_version) < 3):
mandatory_plugins.append(installer.sub_plugin_name)
else:
mandatory_plugins.append(installer.plugin_name)
plugin_variables.update(installer.variables)

cluster_settings = {}
Expand Down Expand Up @@ -373,6 +381,11 @@ def config_source_paths(self):
def plugin_name(self):
return self.plugin.name

@property
def sub_plugin_name(self):
# if a plugin consists of multiple plugins (e.g. x-pack) we're interested in that name
return self.variables.get("plugin_name", self.plugin_name)


class NoOpProvisioner:
def __init__(self, *args):
Expand Down
6 changes: 1 addition & 5 deletions esrally/mechanic/team.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import logging
import configparser

import tabulate

from esrally import exceptions, PROGRAM_NAME
Expand Down Expand Up @@ -302,8 +301,7 @@ def load_plugin(self, name, config_names, plugin_params={}):
known_config_bases.add(base)

if "variables" in config.sections():
for k, v in config["variables"].items():
variables[k] = v
variables = {k:v for k,v in config["variables"].items()}
# add all plugin params here to override any defaults
variables.update(plugin_params)

Expand Down Expand Up @@ -341,5 +339,3 @@ def __hash__(self):

def __eq__(self, other):
return isinstance(other, type(self)) and (self.name, self.config, self.core_plugin) == (other.name, other.config, other.core_plugin)


11 changes: 11 additions & 0 deletions esrally/utils/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ def major_version(version):
return major


def minor_version(version):
"""
Determines the minor version of a given version string.
:param version: A version string in the format major.minor.path-suffix (suffix is optional)
:return: The minor version (as int). In case the version string is invalid, an ``exceptions.InvalidSyntax`` is raised.
"""
_, minor, _, _ = components(version)
return minor


def components(version, strict=True):
"""
Determines components of a version string.
Expand Down

0 comments on commit b1b57fa

Please sign in to comment.