accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [accumulo] 01/01: Merge branch '1.8'
Date Fri, 26 Jan 2018 01:00:45 GMT
This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit 86f8db4deff0b05b23c42b0de2914eae9650ab91
Merge: d99de2c 40f6672
Author: Keith Turner <kturner@apache.org>
AuthorDate: Thu Jan 25 20:00:03 2018 -0500

    Merge branch '1.8'

 .../accumulo/core/client/impl/ClientContext.java   |  6 ++
 .../core/client/mock/MockConfiguration.java        |  5 ++
 .../accumulo/core/conf/AccumuloConfiguration.java  | 28 +++++++
 .../accumulo/core/conf/ConfigurationCopy.java      |  5 ++
 .../accumulo/core/conf/DefaultConfiguration.java   |  5 ++
 .../accumulo/core/conf/SiteConfiguration.java      |  9 ++
 .../apache/accumulo/fate/zookeeper/ZooCache.java   | 97 ++++++++++++++++------
 .../accumulo/server/conf/ZooConfiguration.java     | 15 +++-
 .../java/org/apache/accumulo/master/Master.java    |  4 +-
 .../org/apache/accumulo/tserver/TabletServer.java  |  4 +-
 .../main/java/org/apache/accumulo/shell/Shell.java |  4 +-
 .../start/classloader/vfs/ContextManager.java      | 11 +--
 12 files changed, 154 insertions(+), 39 deletions(-)

diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
index 831779c,b388f77..ee3c1af
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
@@@ -172,6 -174,12 +172,12 @@@ public class ClientContext 
      final AccumuloConfiguration defaults = DefaultConfiguration.getInstance();
  
      return new AccumuloConfiguration() {
+ 
+       @Override
+       protected String getArbitrarySystemPropertyImpl(String property) {
 -        return config.getString(property, null);
++        return config.getString(property);
+       }
+ 
        @Override
        public String get(Property property) {
          final String key = property.getKey();
diff --cc core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
index 832bebd,7e0db72..4de7252
--- a/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
@@@ -30,13 -34,107 +30,41 @@@ import org.apache.accumulo.core.util.Pa
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
+ import com.google.common.base.Preconditions;
 -import com.google.common.base.Predicate;
 -import com.google.common.base.Predicates;
+ 
  /**
   * A configuration object.
   */
  public abstract class AccumuloConfiguration implements Iterable<Entry<String,String>>
{
  
 -  /**
 -   * A filter for properties, based on key.
 -   *
 -   * @deprecated since 1.7.0; use {@link Predicate} instead.
 -   */
 -  @Deprecated
 -  public interface PropertyFilter {
 -    /**
 -     * Determines whether to accept a property based on its key.
 -     *
 -     * @param key
 -     *          property key
 -     * @return true to accept property (pass filter)
 -     */
 -    boolean accept(String key);
 -  }
 -
 -  /**
 -   * A filter that accepts properties whose keys are an exact match.
 -   */
 -  public static class MatchFilter implements Predicate<String> {
 -
 -    private String match;
 -
 -    /**
 -     * Creates a new filter.
 -     *
 -     * @param match
 -     *          prefix of property keys to accept
 -     */
 -    public MatchFilter(String match) {
 -      this.match = match;
 -    }
 -
 -    @Override
 -    public boolean apply(String key) {
 -      return Objects.equals(match, key);
 -    }
 -  }
 -
 -  /**
 -   * A filter that accepts properties whose keys begin with a prefix.
 -   */
 -  public static class PrefixFilter implements Predicate<String> {
 -
 -    private String prefix;
 -
 -    /**
 -     * Creates a new filter.
 -     *
 -     * @param prefix
 -     *          prefix of property keys to accept
 -     */
 -    public PrefixFilter(String prefix) {
 -      this.prefix = prefix;
 -    }
 -
 -    @Override
 -    public boolean apply(String key) {
 -      return key.startsWith(prefix);
 -    }
 -  }
 -
    private static final Logger log = LoggerFactory.getLogger(AccumuloConfiguration.class);
  
+   protected String getArbitrarySystemPropertyImpl(AccumuloConfiguration parent, String property)
{
+     return parent.getArbitrarySystemPropertyImpl(property);
+   }
+ 
+   /**
+    * This method is not called with sensitive or per table properties.
+    */
+   protected String getArbitrarySystemPropertyImpl(String property) {
+     throw new UnsupportedOperationException();
+   }
+ 
+   /**
+    * This method was created because {@link #get(String)} is very slow. However this method
does not properly handle everything that {@link #get(String)} does.
+    * For example it does not properly handle table or sensitive properties.
+    *
+    * <p>
+    * This method has a whitelist of prefixes it handles. To see the whitelist, check the
implementation. When adding to the whitelist, ensure that all
+    * configurations can properly handle.
+    */
+   public String getArbitrarySystemProperty(Property prefix, String property) {
+     Preconditions.checkArgument(prefix == Property.VFS_CONTEXT_CLASSPATH_PROPERTY);
+ 
+     String key = prefix.getKey() + property;
+     return getArbitrarySystemPropertyImpl(key);
+   }
+ 
    /**
     * Gets a property value from this configuration.
     *
diff --cc core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
index cf3eb92,df43557..d315809
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
@@@ -63,9 -64,14 +63,14 @@@ public class ConfigurationCopy extends 
    }
  
    @Override
+   protected String getArbitrarySystemPropertyImpl(String property) {
+     return copy.get(property);
+   }
+ 
+   @Override
    public void getProperties(Map<String,String> props, Predicate<String> filter)
{
      for (Entry<String,String> entry : copy.entrySet()) {
 -      if (filter.apply(entry.getKey())) {
 +      if (filter.test(entry.getKey())) {
          props.put(entry.getKey(), entry.getValue());
        }
      }
diff --cc core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
index 756e241,994d960..370283f
--- a/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
@@@ -47,6 -54,13 +47,11 @@@ public class DefaultConfiguration exten
  
    @Override
    public void getProperties(Map<String,String> props, Predicate<String> filter)
{
 -    for (Entry<String,String> entry : resolvedProps.entrySet())
 -      if (filter.apply(entry.getKey()))
 -        props.put(entry.getKey(), entry.getValue());
 +    resolvedProps.entrySet().stream().filter(p -> filter.test(p.getKey())).forEach(e
-> props.put(e.getKey(), e.getValue()));
    }
+ 
+   @Override
+   protected String getArbitrarySystemPropertyImpl(String property) {
+     return null;
+   }
  }
diff --cc core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
index 4135de0,32b2564..682edec
--- a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
@@@ -153,17 -129,20 +153,26 @@@ public class SiteConfiguration extends 
    }
  
    @Override
+   protected String getArbitrarySystemPropertyImpl(String property) {
+     String val = staticConfigs.get(property);
+     if (val == null) {
+       val = parent.getArbitrarySystemPropertyImpl(property);
+     }
+     return val;
+   }
+ 
+   @Override
    public void getProperties(Map<String,String> props, Predicate<String> filter)
{
 -    parent.getProperties(props, filter);
 +    getProperties(props, filter, true);
 +  }
 +
 +  public void getProperties(Map<String,String> props, Predicate<String> filter,
boolean useDefaults) {
 +    if (useDefaults) {
 +      parent.getProperties(props, filter);
 +    }
  
      for (Entry<String,String> entry : getXmlConfig())
 -      if (filter.apply(entry.getKey()))
 +      if (filter.test(entry.getKey()))
          props.put(entry.getKey(), entry.getValue());
  
      // CredentialProvider should take precedence over site
diff --cc server/base/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
index 1648c9b,2817ba0..0341834
--- a/server/base/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/conf/ZooConfiguration.java
@@@ -108,10 -120,10 +119,10 @@@ public class ZooConfiguration extends A
    public void getProperties(Map<String,String> props, Predicate<String> filter)
{
      parent.getProperties(props, filter);
  
-     List<String> children = propCache.getChildren(ZooUtil.getRoot(instanceId) + Constants.ZCONFIG);
+     List<String> children = propCache.getChildren(propPathPrefix);
      if (children != null) {
        for (String child : children) {
 -        if (child != null && filter.apply(child)) {
 +        if (child != null && filter.test(child)) {
            String value = getRaw(child);
            if (value != null)
              props.put(child, value);

-- 
To stop receiving notification emails like this one, please contact
kturner@apache.org.

Mime
View raw message