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


##########
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:
   Another option could be to catch and turn the 
ConcurrentModificationException into a CheckedException so that callers are 
forced to handle it.  If two (or more) separate processes are trying to set the 
same properties, a retry could effectively allow the last one to always "win".  
If the catcher just wraps the CheckedException in a retry that's what would 
happen anyway - but it would be done explicitly. 
   
   If the retry allows different, non-overlapping changes, that might be the 
"best" case.  P1 sets A, B, and P2 sets C, D then the final result should be A, 
B, C and D. The "worst" case would be if the final values were A,B or C,D 
   
   If the sets are overlapping then the result would be non-determinant P1 sets 
A, deletes B and P2 sets B and C, then B could be set or deleted.  Changing the 
same property should be much less frequent than modifying non-overlapping sets.
   
   Currently we do not guarantee that a process will see a given set of 
properties anyway - say for example a scan - it will execute with whatever it 
happens to find - if you set a property you need to allow it to propagate to 
the tservers, but something could change it before the scan actually starts and 
we do not specify otherwise.



-- 
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-unsubscr...@accumulo.apache.org

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

Reply via email to