EdColeman commented on code in PR #3620:
URL: https://github.com/apache/accumulo/pull/3620#discussion_r1276830283


##########
server/base/src/main/java/org/apache/accumulo/server/conf/util/ZooPropEditor.java:
##########
@@ -118,9 +126,27 @@ private void setProperty(final ServerContext context, 
final PropStoreKey<?> prop
       throw new IllegalArgumentException(
           "Invalid set property format. Requires name=value, received " + 
opts.setOpt);
     }
-    String[] tokens = opts.setOpt.split("=");
-    Map<String,String> propValue = Map.of(tokens[0].trim(), tokens[1].trim());
-    PropUtil.setProperties(context, propKey, propValue);
+    String targetName = "'invalid'";
+    try {
+      targetName = getDisplayName(propKey, context.getInstanceID(), 
context.getZooReader());
+
+      Map<String,String> prev = context.getPropStore().get(propKey).asMap();
+      String[] tokens = opts.setOpt.split("=");
+      String propName = tokens[0].trim();
+      String propVal = tokens[1].trim();
+      Map<String,String> propMap = Map.of(propName, propVal);
+      PropUtil.setProperties(context, propKey, propMap);
+
+      if (prev.containsKey(propName)) {
+        LOG.info("{}: modified {} from {} to {}", targetName, propName, 
prev.get(propName),
+            propVal);
+      } else {
+        LOG.info("{}: set {}={}", targetName, propName, propVal);
+      }
+    } catch (Exception ex) {
+      throw new IllegalStateException(
+          "Failed to set property for " + targetName + " (id: " + 
propKey.getId() + ")", ex);

Review Comment:
   The called methods are throwing Runtime exceptions (Illegal Argument,...) 
The goal was to include what failed in the exception message to help 
troubleshoot what was being changed in the message.  It could be done with a 
log message and a re-throw, but catching any exception, wrapping with the 
IllegalStateException with the augmented exception message seemed the most 
comprehensive and likely to provide consistent feedback.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to