This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch single-node-props
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/single-node-props by this push:
     new 363a281d17 Remove isPropertySet option for caching
363a281d17 is described below

commit 363a281d17bb9b13c1123751dd2f30a3d712453b
Author: Christopher Tubbs <ctubb...@apache.org>
AuthorDate: Tue Apr 26 15:53:32 2022 -0400

    Remove isPropertySet option for caching
    
    This is an incremental change from the single-node property changes
---
 .../accumulo/core/conf/AccumuloConfiguration.java  |  8 ++++----
 .../accumulo/core/conf/ConfigurationCopy.java      |  2 +-
 .../accumulo/core/conf/DefaultConfiguration.java   |  2 +-
 .../accumulo/core/conf/SiteConfiguration.java      |  4 ++--
 .../accumulo/core/util/ConfigurationImpl.java      |  2 +-
 .../util/compaction/CompactionServicesConfig.java  | 11 +++++------
 .../core/conf/AccumuloConfigurationTest.java       |  2 +-
 .../org/apache/accumulo/server/ServerContext.java  |  2 +-
 .../server/conf/NamespaceConfiguration.java        | 11 ++---------
 .../accumulo/server/conf/TableConfiguration.java   | 13 ++-----------
 .../accumulo/server/conf/ZooConfiguration.java     | 22 ++++++++--------------
 .../accumulo/tserver/tablet/CompactableImpl.java   |  2 +-
 .../accumulo/tserver/tablet/CompactableUtils.java  |  2 +-
 13 files changed, 30 insertions(+), 53 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java 
b/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
index b86e3481a8..84043937c0 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
@@ -97,7 +97,7 @@ public abstract class AccumuloConfiguration implements 
Iterable<Entry<String,Str
    * Given a property and a deprecated property determine which one to use 
base on which one is set.
    */
   public Property resolve(Property property, Property deprecatedProperty) {
-    if (isPropertySet(property, true) || !isPropertySet(deprecatedProperty, 
true)) {
+    if (isPropertySet(property) || !isPropertySet(deprecatedProperty)) {
       return property;
     } else {
       return deprecatedProperty;
@@ -405,7 +405,7 @@ public abstract class AccumuloConfiguration implements 
Iterable<Entry<String,Str
     }
   }
 
-  public boolean isPropertySet(Property prop, boolean cacheAndWatch) {
+  public boolean isPropertySet(Property prop) {
     throw new UnsupportedOperationException();
   }
 
@@ -428,14 +428,14 @@ public abstract class AccumuloConfiguration implements 
Iterable<Entry<String,Str
       return null;
     }
 
-    if (!isPropertySet(prop, true) && isPropertySet(deprecatedProp, true)) {
+    if (!isPropertySet(prop) && isPropertySet(deprecatedProp)) {
       if (!depPropWarned) {
         depPropWarned = true;
         log.warn("Property {} is deprecated, use {} instead.", 
deprecatedProp.getKey(),
             prop.getKey());
       }
       return Integer.valueOf(get(deprecatedProp));
-    } else if (isPropertySet(prop, true) && isPropertySet(deprecatedProp, 
true) && !depPropWarned) {
+    } else if (isPropertySet(prop) && isPropertySet(deprecatedProp) && 
!depPropWarned) {
       depPropWarned = true;
       log.warn("Deprecated property {} ignored because {} is set", 
deprecatedProp.getKey(),
           prop.getKey());
diff --git 
a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java 
b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
index 975016bc77..a08808573f 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
@@ -122,7 +122,7 @@ public class ConfigurationCopy extends 
AccumuloConfiguration {
   }
 
   @Override
-  public boolean isPropertySet(Property prop, boolean cacheAndWatch) {
+  public boolean isPropertySet(Property prop) {
     return copy.containsKey(prop.getKey());
   }
 }
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 fe08e5a3b3..f8d958a34d 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
@@ -56,7 +56,7 @@ public class DefaultConfiguration extends 
AccumuloConfiguration {
   }
 
   @Override
-  public boolean isPropertySet(Property prop, boolean cacheAndWatch) {
+  public boolean isPropertySet(Property prop) {
     return false;
   }
 }
diff --git 
a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java 
b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
index 63c5c28334..fb97876fb6 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/SiteConfiguration.java
@@ -251,8 +251,8 @@ public class SiteConfiguration extends 
AccumuloConfiguration {
   }
 
   @Override
-  public boolean isPropertySet(Property prop, boolean cacheAndWatch) {
-    return config.containsKey(prop.getKey()) || parent.isPropertySet(prop, 
cacheAndWatch);
+  public boolean isPropertySet(Property prop) {
+    return config.containsKey(prop.getKey()) || parent.isPropertySet(prop);
   }
 
   @Override
diff --git 
a/core/src/main/java/org/apache/accumulo/core/util/ConfigurationImpl.java 
b/core/src/main/java/org/apache/accumulo/core/util/ConfigurationImpl.java
index 15a31fdd87..7637a026f8 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/ConfigurationImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/ConfigurationImpl.java
@@ -46,7 +46,7 @@ public class ConfigurationImpl implements Configuration {
   public boolean isSet(String key) {
     Property prop = Property.getPropertyByKey(key);
     if (prop != null) {
-      return acfg.isPropertySet(prop, false);
+      return acfg.isPropertySet(prop);
     } else {
       return acfg.get(key) != null;
     }
diff --git 
a/core/src/main/java/org/apache/accumulo/core/util/compaction/CompactionServicesConfig.java
 
b/core/src/main/java/org/apache/accumulo/core/util/compaction/CompactionServicesConfig.java
index 0dfcfe8dd2..e95d80cbdf 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/util/compaction/CompactionServicesConfig.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/util/compaction/CompactionServicesConfig.java
@@ -49,7 +49,7 @@ public class CompactionServicesConfig {
 
   @SuppressWarnings("removal")
   private long getDefaultThroughput(AccumuloConfiguration aconf) {
-    if (aconf.isPropertySet(Property.TSERV_MAJC_THROUGHPUT, true)) {
+    if (aconf.isPropertySet(Property.TSERV_MAJC_THROUGHPUT)) {
       return aconf.getAsBytes(Property.TSERV_MAJC_THROUGHPUT);
     }
 
@@ -64,7 +64,7 @@ public class CompactionServicesConfig {
         
aconf.getAllPropertiesWithPrefix(Property.TSERV_COMPACTION_SERVICE_PREFIX);
 
     // check if deprecated properties for compaction executor are set
-    if (aconf.isPropertySet(Property.TSERV_MAJC_MAXCONCURRENT, true)) {
+    if (aconf.isPropertySet(Property.TSERV_MAJC_MAXCONCURRENT)) {
 
       String defaultServicePrefix =
           Property.TSERV_COMPACTION_SERVICE_PREFIX.getKey() + 
DEFAULT_SERVICE.canonical() + ".";
@@ -72,7 +72,7 @@ public class CompactionServicesConfig {
       // check if any properties for the default compaction service are set
       boolean defaultServicePropsSet = configs.keySet().stream()
           .filter(key -> 
key.startsWith(defaultServicePrefix)).map(Property::getPropertyByKey)
-          .anyMatch(prop -> prop == null || aconf.isPropertySet(prop, true));
+          .anyMatch(prop -> prop == null || aconf.isPropertySet(prop));
 
       if (defaultServicePropsSet) {
 
@@ -130,8 +130,7 @@ public class CompactionServicesConfig {
         planners.put(tokens[0], val);
       } else if (tokens.length == 3 && tokens[1].equals("rate") && 
tokens[2].equals("limit")) {
         var eprop = Property.getPropertyByKey(prop);
-        if (eprop == null || aconf.isPropertySet(eprop, true)
-            || !isDeprecatedThroughputSet(aconf)) {
+        if (eprop == null || aconf.isPropertySet(eprop) || 
!isDeprecatedThroughputSet(aconf)) {
           rateLimits.put(tokens[0], 
ConfigurationTypeHelper.getFixedMemoryAsBytes(val));
         }
       } else {
@@ -152,7 +151,7 @@ public class CompactionServicesConfig {
 
   @SuppressWarnings("removal")
   private boolean isDeprecatedThroughputSet(AccumuloConfiguration aconf) {
-    return aconf.isPropertySet(Property.TSERV_MAJC_THROUGHPUT, true);
+    return aconf.isPropertySet(Property.TSERV_MAJC_THROUGHPUT);
   }
 
   public long getRateLimit(String serviceName) {
diff --git 
a/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
 
b/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
index d03e1a8383..5fb3cfa375 100644
--- 
a/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
+++ 
b/core/src/test/java/org/apache/accumulo/core/conf/AccumuloConfigurationTest.java
@@ -155,7 +155,7 @@ public class AccumuloConfigurationTest {
     }
 
     @Override
-    public boolean isPropertySet(Property prop, boolean cacheAndWatch) {
+    public boolean isPropertySet(Property prop) {
       return props.containsKey(prop.getKey());
     }
 
diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java 
b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
index 4dc56a6a37..418e199a71 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
@@ -399,7 +399,7 @@ public class ServerContext extends ClientContext {
       String key = entry.getKey();
       log.info("{} = {}", key, (Property.isSensitive(key) ? "<hidden>" : 
entry.getValue()));
       Property prop = Property.getPropertyByKey(key);
-      if (prop != null && conf.isPropertySet(prop, false)) {
+      if (prop != null && conf.isPropertySet(prop)) {
         if (prop.isDeprecated()) {
           Property replacedBy = prop.replacedBy();
           if (replacedBy != null) {
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 b81cf919e8..1e7586eeff 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
@@ -89,15 +89,8 @@ public class NamespaceConfiguration extends 
AccumuloConfiguration {
   }
 
   @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);
+  public boolean isPropertySet(Property prop) {
+    return getPropCacheAccessor().isPropertySet(prop, getPath()) || 
parent.isPropertySet(prop);
   }
 
   @Override
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 2819c70181..01ae607493 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
@@ -116,17 +116,8 @@ public class TableConfiguration extends 
AccumuloConfiguration {
   }
 
   @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);
+  public boolean isPropertySet(Property prop) {
+    return getPropCacheAccessor().isPropertySet(prop, getPath()) || 
parent.isPropertySet(prop);
   }
 
   @Override
diff --git 
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
index b611a6e0b5..82129128cc 100644
--- 
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
@@ -96,26 +96,20 @@ public class ZooConfiguration extends AccumuloConfiguration 
{
   }
 
   @Override
-  public boolean isPropertySet(Property prop, boolean cacheAndWatch) {
+  public boolean isPropertySet(Property prop) {
     if (fixedProps.containsKey(prop.getKey())) {
       return true;
     }
-    if (cacheAndWatch) {
-      if (getRaw(prop.getKey()) != null) {
+    ZooReader zr = context.getZooReaderWriter();
+    String zPath = propPathPrefix + "/" + prop.getKey();
+    try {
+      if (zr.exists(zPath)) {
         return true;
       }
-    } else {
-      ZooReader zr = context.getZooReaderWriter();
-      String zPath = propPathPrefix + "/" + prop.getKey();
-      try {
-        if (zr.exists(zPath)) {
-          return true;
-        }
-      } catch (KeeperException | InterruptedException e) {
-        throw new IllegalStateException(e);
-      }
+    } catch (KeeperException | InterruptedException e) {
+      throw new IllegalStateException(e);
     }
-    return parent.isPropertySet(prop, cacheAndWatch);
+    return parent.isPropertySet(prop);
   }
 
   private String getRaw(String key) {
diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
index b2b1eedfdf..dd0e94b5ba 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableImpl.java
@@ -1064,7 +1064,7 @@ public class CompactableImpl implements Compactable {
 
   @SuppressWarnings("removal")
   private boolean isCompactionStratConfigured() {
-    return 
tablet.getTableConfiguration().isPropertySet(Property.TABLE_COMPACTION_STRATEGY,
 true);
+    return 
tablet.getTableConfiguration().isPropertySet(Property.TABLE_COMPACTION_STRATEGY);
   }
 
   @Override
diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableUtils.java
 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableUtils.java
index 742180f5f6..ec6df776dd 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableUtils.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactableUtils.java
@@ -483,7 +483,7 @@ public class CompactableUtils {
 
       CompactionStrategyConfig stratCfg = null;
 
-      if (cselCfg == null && 
tconf.isPropertySet(Property.TABLE_COMPACTION_STRATEGY, true)) {
+      if (cselCfg == null && 
tconf.isPropertySet(Property.TABLE_COMPACTION_STRATEGY)) {
         var stratClassName = tconf.get(Property.TABLE_COMPACTION_STRATEGY);
 
         try {

Reply via email to