Github user ctubbsii commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/253#discussion_r113297684
  
    --- Diff: 
server/base/src/main/java/org/apache/accumulo/server/fs/PerTableVolumeChooser.java
 ---
    @@ -68,10 +100,107 @@ public String choose(VolumeChooserEnvironment env, 
String[] options) {
               chooser = last;
             }
           }
    +    }
    +    return chooser;
    +  }
    +
    +  private VolumeChooser 
getVolumeChooserForNonTable(VolumeChooserEnvironment env, 
ServerConfigurationFactory localConf) {
    +    VolumeChooser chooser;
    +    final String customProperty = 
Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + env.getScope() + 
".volume.chooser";
    +
    +    if (log.isTraceEnabled()) {
    +      log.trace("Scope: " + env.getScope());
    +      log.trace("Looking up property: " + customProperty);
    +    }
    +
    +    AccumuloConfiguration systemConfiguration = 
localConf.getConfiguration();
    +    String clazz = systemConfiguration.get(customProperty);
    +    if (null == clazz || clazz.isEmpty()) {
    +      log.debug("Property not found: " + customProperty + " using fallback 
chooser.");
    +      return fallbackVolumeChooser;
         } else {
    -      chooser = fallbackVolumeChooser;
    +      chooser = scopeSpecificChooser.get(env.getScope());
    +      if (chooser == null) {
    +        VolumeChooser temp;
    +        try {
    +          temp = loadClassForCustomProperty(clazz);
    +        } catch (Exception e) {
    +          log.error("Failed to create instance for " + env.getScope() + " 
configured to use " + clazz + " via " + customProperty);
    +          return fallbackVolumeChooser;
    +        }
    +        chooser = scopeSpecificChooser.putIfAbsent(env.getScope(), temp);
    +        if (chooser == null) {
    +          chooser = temp;
    +          // Otherwise, someone else beat us to initializing; use theirs.
    +        }
    +      } else if (!(chooser.getClass().getName().equals(clazz))) {
    +        if (log.isTraceEnabled()) {
    +          log.trace("change detected for scope: " + env.getScope());
    +        }
    +        // the configuration for this scope's chooser has been updated. In 
the case of failure to instantiate we'll repeat here next call.
    +        // TODO stricter definition of when the updated property is used, 
ref ACCUMULO-3412
    +        VolumeChooser temp;
    +        try {
    +          temp = loadClassForCustomProperty(clazz);
    +        } catch (Exception e) {
    +          log.error("Failed to create instance for " + env.getScope() + " 
configured to use " + clazz + " via " + customProperty);
    +          return fallbackVolumeChooser;
    --- End diff --
    
    I think we should fail-hard here instead of the current behavior. Matt's 
original code was to fall back, but we can simplify this, because I don't think 
that's necessary.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to