Skip to content

Bug in MetadataMigrateToDataTiersRoutingService - _tier_preference could be incorrect #81633

@romain-chanu

Description

@romain-chanu

Elasticsearch version (bin/elasticsearch --version): 7.16.0

(but the problem was likely present since the introduction of this service in #73689).

Plugins installed: []

JVM version (java -version):

OS version (uname -a if on a Unix-like system):

Description of the problem including expected versus actual behavior:

  • MetadataMigrateToDataTiersRoutingService is assuming that if an index is configured with a _tier_preference then it is the right data tier index allocation (c.f code):
        // look at the value, get the correct tiers config and update the settings
        if (currentIndexSettings.keySet().contains(TIER_PREFERENCE)) {
            newSettingsBuilder.remove(attributeBasedRoutingSettingName);
            logger.debug("index [{}]: removed setting [{}]", indexName, attributeBasedRoutingSettingName);
        } else {
            // parse the custom attribute routing into the corresponding tier preference and configure it
            String attributeValue = currentIndexSettings.get(attributeBasedRoutingSettingName);
            String convertedTierPreference = convertAttributeValueToTierPreference(attributeValue);

Steps to reproduce:

We have seen in the field indices configured with the following settings:

  • Example 1:
        "routing" : {
          "allocation" : {
            "include" : {
              "_tier_preference" : "data_hot"
            },
            "require" : {
              "data" : "warm"
            }
          }
        },
  • Example 2:
        "routing" : {
          "allocation" : {
            "include" : {
              "_tier_preference" : "data_content"
            },
            "require" : {
              "data" : "warm"
            }
          }
        },

In both examples, these indices were actually in the warm phase (confirmed with the ILM explain API results). As a user, if I were to run the _ilm/migrate_to_data_tiers API when migrating from nodes types to nodes roles, this would result in an incorrect allocation. These indices will then be allocated to the hot and content and data tier - instead of the warm data tier.

The only way to recover from this is to identify the corresponding ILM phase for the affected indices and set the data tier index allocation accordingly. As a user, it is impossible to do so out of the box (i.e it requires some scripting to cross check information from the list of indices, index settings and ILM explain results of each index).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions