accumulo-dev mailing list archives

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

    https://github.com/apache/accumulo/pull/253#discussion_r119166010
  
    --- 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 --
    
    I like that idea.  Perhaps in addition to table.volume.chooser we have a tserver.nontable.volume.chooser.
 Any other thoughts as to 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