code: private void checkTieredLocality() {
      // Check that any custom tiers set by alluxio.locality.{custom_tier}=value are also defined in
      // the tier ordering defined by alluxio.locality.order.
      Set<String> tiers = Sets.newHashSet(getList(PropertyKey.LOCALITY_ORDER, ","));
      Set<PropertyKey> predefinedKeys = new HashSet<>(PropertyKey.defaultKeys());
      for (PropertyKey key : mProperties.keySet()) {
        if (predefinedKeys.contains(key)) {
          // Skip non-templated keys.
          continue;
        }
        Matcher matcher = Template.LOCALITY_TIER.match(key.toString());
        if (matcher.matches() && matcher.group(1) != null) {
          String tierName = matcher.group(1);
          if (!tiers.contains(tierName)) {
            throw new IllegalStateException(
                String.format("Tier %s is configured by %s, but does not exist in the tier list %s "
                    + "configured by %s", tierName, key, tiers, PropertyKey.LOCALITY_ORDER));
          }
        }
      }
    }
docs: Checks that tiered locality configuration is consistent.
  
  @throws IllegalStateException if invalid tiered locality configuration is encountered