accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject accumulo git commit: ACCUMULO-3536 Add deprecation warning when not using instance.volumes
Date Fri, 06 Feb 2015 16:52:03 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master d7bb9ac17 -> 7527ce108


ACCUMULO-3536 Add deprecation warning when not using instance.volumes

Update configuration template to include instance.volumes so users can
appropriately respond to the warning, and remove nonsensical runtime sanity
check on default configuration and move it to a unit test.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7527ce10
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7527ce10
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7527ce10

Branch: refs/heads/master
Commit: 7527ce108b9deb423c39de8e3ed9898b111946cd
Parents: d7bb9ac
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Thu Feb 5 19:04:11 2015 -0500
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Fri Feb 6 11:48:21 2015 -0500

----------------------------------------------------------------------
 assemble/conf/templates/accumulo-site.xml           |  6 ++++++
 .../accumulo/core/conf/ConfigSanityCheck.java       | 16 ++++++++++++++--
 .../accumulo/core/conf/DefaultConfiguration.java    |  1 -
 .../core/conf/DefaultConfigurationTest.java         |  5 +++++
 4 files changed, 25 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/7527ce10/assemble/conf/templates/accumulo-site.xml
----------------------------------------------------------------------
diff --git a/assemble/conf/templates/accumulo-site.xml b/assemble/conf/templates/accumulo-site.xml
index def9fa0..0e4f016 100644
--- a/assemble/conf/templates/accumulo-site.xml
+++ b/assemble/conf/templates/accumulo-site.xml
@@ -22,6 +22,12 @@
     you are simply testing at your workstation, you will most definitely need to change the
three entries below. -->
 
   <property>
+    <name>instance.volumes</name>
+    <value></value>
+    <description>comma separated list of URIs for volumes. example: hdfs://localhost:9000/accumulo</description>
+  </property>
+
+  <property>
     <name>instance.zookeeper.host</name>
     <value>localhost:2181</value>
     <description>comma separated list of zookeeper servers</description>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7527ce10/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java b/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
index 99e3920..294c991 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
@@ -27,6 +27,10 @@ public class ConfigSanityCheck {
 
   private static final Logger log = Logger.getLogger(ConfigSanityCheck.class);
   private static final String PREFIX = "BAD CONFIG ";
+  @SuppressWarnings("deprecation")
+  private static final Property INSTANCE_DFS_URI = Property.INSTANCE_DFS_URI;
+  @SuppressWarnings("deprecation")
+  private static final Property INSTANCE_DFS_DIR = Property.INSTANCE_DFS_DIR;
 
   /**
    * Validates the given configuration entries. A valid configuration contains only valid
properties (i.e., defined or otherwise valid) that are not prefixes
@@ -39,8 +43,8 @@ public class ConfigSanityCheck {
    *           if a fatal configuration error is found
    */
   public static void validate(Iterable<Entry<String,String>> entries) {
-    String instanceZkTimeoutKey = Property.INSTANCE_ZK_TIMEOUT.getKey();
     String instanceZkTimeoutValue = null;
+    boolean usingVolumes = false;
     for (Entry<String,String> entry : entries) {
       String key = entry.getKey();
       String value = entry.getValue();
@@ -54,14 +58,22 @@ public class ConfigSanityCheck {
       else if (!prop.getType().isValidFormat(value))
         fatal(PREFIX + "improperly formatted value for key (" + key + ", type=" + prop.getType()
+ ")");
 
-      if (key.equals(instanceZkTimeoutKey)) {
+      if (key.equals(Property.INSTANCE_ZK_TIMEOUT.getKey())) {
         instanceZkTimeoutValue = value;
       }
+
+      if (key.equals(Property.INSTANCE_VOLUMES.getKey())) {
+        usingVolumes = value != null && !value.isEmpty();
+      }
     }
 
     if (instanceZkTimeoutValue != null) {
       checkTimeDuration(Property.INSTANCE_ZK_TIMEOUT, instanceZkTimeoutValue, new CheckTimeDurationBetween(1000,
300000));
     }
+
+    if (!usingVolumes) {
+      log.warn("Use of " + INSTANCE_DFS_URI + " and " + INSTANCE_DFS_DIR + " are deprecated.
Consider using " + Property.INSTANCE_VOLUMES + " instead.");
+    }
   }
 
   private interface CheckTimeDuration {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7527ce10/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java b/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
index 09dc0c9..17364a7 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/DefaultConfiguration.java
@@ -33,7 +33,6 @@ public class DefaultConfiguration extends AccumuloConfiguration {
         m.put(prop.getKey(), prop.getDefaultValue());
       }
     }
-    ConfigSanityCheck.validate(m.entrySet());
     resolvedProps = Collections.unmodifiableMap(m);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/7527ce10/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
b/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
index 3823dda..e21db3d 100644
--- a/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/conf/DefaultConfigurationTest.java
@@ -43,4 +43,9 @@ public class DefaultConfigurationTest {
     c.getProperties(p, new AllFilter());
     assertEquals(Property.MASTER_CLIENTPORT.getDefaultValue(), p.get(Property.MASTER_CLIENTPORT.getKey()));
   }
+
+  @Test
+  public void testSanityCheck() {
+    ConfigSanityCheck.validate(c);
+  }
 }


Mime
View raw message