accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matthpeterson <...@git.apache.org>
Subject [GitHub] accumulo pull request #253: ACCUMULO-4086 Improve volume chooser fallback
Date Tue, 30 May 2017 16:20:44 GMT
Github user matthpeterson commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/253#discussion_r119147394
  
    --- 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 --
    
    Now that we're failing on missing or bad configurations, it seems odd to assume that a
missing wa logger volume manager should automatically use the system-level table volume manager.
 It seems we should fail if this configuration is missing.  In terms of documenting the required
properties for PerTableVolumeChooser, it should require both the table property and one for
the logger.  Given that there is only one non-table scope at the moment, perhaps it makes
sense to just have the single non-table property instead of including a scope in the property
name.


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

Mime
View raw message