You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2019/03/05 18:07:54 UTC

[accumulo] branch master updated: Support isPropSet for table config (#1012)

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


The following commit(s) were added to refs/heads/master by this push:
     new 04d7b96  Support isPropSet for table config (#1012)
04d7b96 is described below

commit 04d7b96e0477295f5caaa1ec26a99a4bb596b018
Author: Keith Turner <kt...@apache.org>
AuthorDate: Tue Mar 5 13:07:49 2019 -0500

    Support isPropSet for table config (#1012)
    
    This fixes a bug introduced by #1008 which attempted to call isPropSet
    for a table config object.  Table config did not implement that method
    before this change.
---
 .../apache/accumulo/server/conf/NamespaceConfiguration.java  | 12 ++++++++++++
 .../org/apache/accumulo/server/conf/TableConfiguration.java  | 12 ++++++++++++
 .../accumulo/server/conf/ZooCachePropertyAccessor.java       |  4 ++++
 3 files changed, 28 insertions(+)

diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java b/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java
index ff4b713..50c15ea 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java
@@ -88,6 +88,18 @@ public class NamespaceConfiguration extends ObservableConfiguration {
   }
 
   @Override
+  public boolean isPropertySet(Property prop, boolean cacheAndWatch) {
+    if (!cacheAndWatch)
+      throw new UnsupportedOperationException(
+          "Namespace configuration only supports checking if a property is set in cache.");
+
+    if (getPropCacheAccessor().isPropertySet(prop, getPath()))
+      return true;
+
+    return parent.isPropertySet(prop, cacheAndWatch);
+  }
+
+  @Override
   public String get(Property property) {
     String key = property.getKey();
     AccumuloConfiguration getParent;
diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java b/server/base/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
index 085acfa..7652604 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/conf/TableConfiguration.java
@@ -120,6 +120,18 @@ public class TableConfiguration extends ObservableConfiguration {
   }
 
   @Override
+  public boolean isPropertySet(Property prop, boolean cacheAndWatch) {
+    if (!cacheAndWatch)
+      throw new UnsupportedOperationException(
+          "Table configuration only supports checking if a property is set in cache.");
+
+    if (getPropCacheAccessor().isPropertySet(prop, getPath()))
+      return true;
+
+    return parent.isPropertySet(prop, cacheAndWatch);
+  }
+
+  @Override
   public String get(Property property) {
     return getPropCacheAccessor().get(property, getPath(), parent);
   }
diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessor.java b/server/base/src/main/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessor.java
index 44f486e..7d528e0 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessor.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/conf/ZooCachePropertyAccessor.java
@@ -85,6 +85,10 @@ public class ZooCachePropertyAccessor {
     return propCache;
   }
 
+  boolean isPropertySet(Property property, String path) {
+    return propCache.get(path + "/" + property.getKey()) != null;
+  }
+
   /**
    * Gets a property. If the property is not in ZooKeeper or is present but an invalid format for
    * the property type, the parent configuration is consulted (if provided).