You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/09/26 20:28:00 UTC

[GitHub] [accumulo] DomGarguilo commented on a diff in pull request #2965: Use TableOperations.modifyProperties in more places

DomGarguilo commented on code in PR #2965:
URL: https://github.com/apache/accumulo/pull/2965#discussion_r980471355


##########
core/src/main/java/org/apache/accumulo/core/clientImpl/TableOperationsHelper.java:
##########
@@ -56,10 +57,12 @@ public void attachIterator(String tableName, IteratorSetting setting,
     for (IteratorScope scope : scopes) {
       String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX,
           scope.name().toLowerCase(), setting.getName());
-      for (Entry<String,String> prop : setting.getOptions().entrySet()) {
-        this.setProperty(tableName, root + ".opt." + prop.getKey(), prop.getValue());
-      }
-      this.setProperty(tableName, root, setting.getPriority() + "," + setting.getIteratorClass());
+
+      Map<String,String> propsToAdd = setting.getOptions().entrySet().stream()
+          .collect(Collectors.toMap(prop -> root + ".opt." + prop.getKey(), Entry::getValue));
+      propsToAdd.put(root, setting.getPriority() + "," + setting.getIteratorClass());
+
+      this.modifyProperties(tableName, props -> props.putAll(propsToAdd));

Review Comment:
   > If no one else is working on it or opposed to it, I would like to try creating a PR for the new modifyProperties method to make it retry automatically instead of throwing the ConcurrentModificationException. If that was done, then this PR could stay as is and not have to handle that condition.
   
   Sounds good to me :+1: 



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org