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

    https://github.com/apache/accumulo/pull/253#discussion_r119182922
  
    --- Diff: 
server/base/src/main/java/org/apache/accumulo/server/fs/PerTableVolumeChooser.java
 ---
    @@ -67,86 +69,67 @@ public String choose(VolumeChooserEnvironment env, 
String[] options) throws Accu
         return chooser.choose(env, options);
       }
     
    -  private VolumeChooser getVolumeChooserForTable(VolumeChooserEnvironment 
env, ServerConfigurationFactory localConf) {
    +  private VolumeChooser getVolumeChooserForTable(VolumeChooserEnvironment 
env, ServerConfigurationFactory localConf) throws AccumuloException {
         VolumeChooser chooser;
         if (log.isTraceEnabled()) {
           log.trace("Table id: " + env.getTableId());
         }
         final TableConfiguration tableConf = 
localConf.getTableConfiguration(env.getTableId());
         String clazz = tableConf.get(Property.TABLE_VOLUME_CHOOSER);
    -    if (null == clazz || clazz.isEmpty()) {
    -      chooser = fallbackVolumeChooser;
    -    } else {
    -      chooser = tableSpecificChooser.get(env.getTableId());
    -      if (chooser == null) {
    -        VolumeChooser temp = 
Property.createTableInstanceFromPropertyName(tableConf, 
Property.TABLE_VOLUME_CHOOSER, VolumeChooser.class, fallbackVolumeChooser);
    -        chooser = tableSpecificChooser.putIfAbsent(env.getTableId(), 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 table id: " + env.getTableId());
    -        }
    -        // the configuration for this table'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 = 
Property.createTableInstanceFromPropertyName(tableConf, 
Property.TABLE_VOLUME_CHOOSER, VolumeChooser.class, fallbackVolumeChooser);
    -        VolumeChooser last = 
tableSpecificChooser.replace(env.getTableId(), temp);
    -        if (chooser.equals(last)) {
    -          chooser = temp;
    -        } else {
    -          // Someone else beat us to updating; use theirs.
    -          chooser = last;
    -        }
    -      }
    -    }
    -    return chooser;
    +
    +    return createVolumeChooser(clazz, 
Property.TABLE_VOLUME_CHOOSER.getKey(), env.getTableId(), tableSpecificChooser);
       }
     
    -  private VolumeChooser 
getVolumeChooserForNonTable(VolumeChooserEnvironment env, 
ServerConfigurationFactory localConf) {
    +  private VolumeChooser 
getVolumeChooserForNonTable(VolumeChooserEnvironment env, 
ServerConfigurationFactory localConf) throws AccumuloException {
         VolumeChooser chooser;
    -    final String customProperty = 
Property.GENERAL_ARBITRARY_PROP_PREFIX.getKey() + env.getScope() + 
".volume.chooser";
    +    String property = VOLUME_CHOOSER_SCOPED_KEY(env.getScope());
     
         if (log.isTraceEnabled()) {
           log.trace("Scope: " + env.getScope());
    -      log.trace("Looking up property: " + customProperty);
    +      log.trace("Looking up property: " + property);
         }
     
         AccumuloConfiguration systemConfiguration = 
localConf.getConfiguration();
    -    String clazz = systemConfiguration.get(customProperty);
    +    String clazz = systemConfiguration.get(property);
    +    // only if the custom property is not set to we fallback to the table 
volumn chooser setting
    +    if (null == clazz) {
    --- End diff --
    
    @matthpeterson  I'm not sure I follow. The implementation logic for 
`PerTableVolumeChooser` is basically:
    
    ```
    if (per-table-scope) {
      delegate = getTableConfig(table).getTableChooser()
    } else { // non-table scope
      delegate = getSystemConfiguration().getScopeChooser(scope)
    }
    delegate.choose()
    ```
    
    If resolving the delegate chooser fails, we should simply report the error. 
Is that not what we're doing? What have I overlooked?
    
    As for the property name, etc. ... I don't think we should add new baked-in 
properties which possibly only apply to the implementation of one specific 
chooser. I'm still not sold 100% on the `table.volume.chooser` property being 
baked-in rather than a custom property(1). It was modeled after the per-table 
balancer, which did that, so there was some precedent. At least it is still 
marked "experimental", so we have some flexibility to change things if we can 
agree on something better that is consistent with all the implementation 
configs (per-table and per-non-table scopes).
    
    (1): because it only applies to choosers who not only behave differently on 
different tables, but specifically those who do so by loading a different 
delegate chooser from per-table configs


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to