Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ public void checkIteratorConflicts(String namespace, IteratorSetting setting,
throw new NamespaceNotFoundException(null, namespace, null);
}
var props = this.getNamespaceProperties(namespace);
IteratorConfigUtil.checkIteratorConflicts("namespace:" + namespace, props, setting, scopes,
true);
IteratorConfigUtil.checkIteratorConflicts("namespace:" + namespace, props, setting, scopes);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public static void checkIteratorConflicts(Map<String,String> props, IteratorSett
EnumSet<IteratorScope> scopes) throws AccumuloException {
checkArgument(setting != null, "setting is null");
checkArgument(scopes != null, "scopes is null");
IteratorConfigUtil.checkIteratorConflicts("", props, setting, scopes, true);
IteratorConfigUtil.checkIteratorConflicts("", props, setting, scopes);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,9 @@ public static void checkIteratorPriorityConflicts(String errorContext,
// properties.
if (iterProps.stream()
.anyMatch(iterProp -> newProperties.containsKey(iterProp.getProperty()))) {
log.warn("For {}, newly set property introduced an iterator priority conflict : {}",
errorContext, iterProps);
throw new IllegalArgumentException(String.format(
"For %s, newly set property introduced an iterator priority conflict : %s",
errorContext, iterProps));
}
}
});
Expand All @@ -298,8 +299,7 @@ public static void checkIteratorPriorityConflicts(String errorContext,

public static void checkIteratorConflicts(String logContext, IteratorSetting iterToCheck,
EnumSet<IteratorScope> iterScopesToCheck,
Map<IteratorScope,List<IteratorSetting>> existingIters, boolean shouldThrow)
throws AccumuloException {
Map<IteratorScope,List<IteratorSetting>> existingIters) throws AccumuloException {
// The reason for the 'shouldThrow' var is to prevent newly added 2.x checks from breaking
// existing user code. Just log the problem and proceed. Major version > 2 will always throw
for (var scope : iterScopesToCheck) {
Expand All @@ -316,28 +316,20 @@ public static void checkIteratorConflicts(String logContext, IteratorSetting ite
String msg =
String.format("%s iterator name conflict at %s scope. %s conflicts with existing %s",
logContext, scope, iterToCheck, existingIter);
if (shouldThrow) {
throw new AccumuloException(new IllegalArgumentException(msg));
} else {
log.warn(msg + WARNING_MSG);
}
throw new AccumuloException(new IllegalArgumentException(msg));
}
if (iterToCheck.getPriority() == existingIter.getPriority()) {
String msg = String.format(
"%s iterator priority conflict at %s scope. %s conflicts with existing %s",
logContext, scope, iterToCheck, existingIter);
if (shouldThrow) {
throw new AccumuloException(new IllegalArgumentException(msg));
} else {
log.warn(msg + WARNING_MSG);
}
throw new AccumuloException(new IllegalArgumentException(msg));
}
}
}
}

public static void checkIteratorConflicts(String logContext, Map<String,String> props,
IteratorSetting iterToCheck, EnumSet<IteratorScope> iterScopesToCheck, boolean shouldThrow)
IteratorSetting iterToCheck, EnumSet<IteratorScope> iterScopesToCheck)
throws AccumuloException {
// parse the props map
Map<IteratorScope,Map<String,IteratorSetting>> iteratorSettings = new HashMap<>();
Expand Down Expand Up @@ -368,11 +360,7 @@ public static void checkIteratorConflicts(String logContext, Map<String,String>
String msg = String.format(
"%s iterator name conflict at %s scope. %s conflicts with existing %s", logContext,
iterProp.getScope(), iterToCheck, iterProp);
if (shouldThrow) {
throw new AccumuloException(new IllegalArgumentException(msg));
} else {
log.warn(msg + WARNING_MSG);
}
throw new AccumuloException(new IllegalArgumentException(msg));
}
} else {
iterSetting.addOption(iterProp.getOptionKey(), iterProp.getOptionValue());
Expand All @@ -381,6 +369,6 @@ public static void checkIteratorConflicts(String logContext, Map<String,String>
}

// check if the given iterator conflicts with any existing iterators
checkIteratorConflicts(logContext, iterToCheck, iterScopesToCheck, existingIters, shouldThrow);
checkIteratorConflicts(logContext, iterToCheck, iterScopesToCheck, existingIters);
}
}
Loading