ctubbsii commented on code in PR #3620:
URL: https://github.com/apache/accumulo/pull/3620#discussion_r1281599914
##########
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:
I don't know. Given the fact that the exception would immediately fall out
from a command the user initiated, I think most of these kinds of errors are
probably informative enough, and it's just cleaner to let them continue to fall
through.
--
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]