jsancio commented on a change in pull request #10253:
URL: https://github.com/apache/kafka/pull/10253#discussion_r587664832
##########
File path:
metadata/src/test/java/org/apache/kafka/controller/FeatureControlManagerTest.java
##########
@@ -101,32 +101,55 @@ public void testUpdateFeaturesErrorCases() {
SnapshotRegistry snapshotRegistry = new SnapshotRegistry(new
LogContext());
FeatureControlManager manager = new FeatureControlManager(
rangeMap("foo", 1, 5, "bar", 1, 2), snapshotRegistry);
- assertEquals(new ControllerResult<>(Collections.
- singletonMap("foo", new ApiError(Errors.INVALID_UPDATE_VERSION,
- "Broker 5 does not support the given feature range."))),
- manager.updateFeatures(rangeMap("foo", 1, 3),
+
+ assertEquals(
+ ControllerResult.of(
+ Collections.emptyList(),
+ Collections.singletonMap(
+ "foo",
+ new ApiError(
+ Errors.INVALID_UPDATE_VERSION,
+ "Broker 5 does not support the given feature range."
+ )
+ )
+ ),
+ manager.updateFeatures(
+ rangeMap("foo", 1, 3),
new HashSet<>(Arrays.asList("foo")),
Review comment:
Yep. Fixed throughout the file.
##########
File path:
metadata/src/main/java/org/apache/kafka/controller/FeatureControlManager.java
##########
@@ -69,7 +69,12 @@
results.put(entry.getKey(), updateFeature(entry.getKey(),
entry.getValue(),
downgradeables.contains(entry.getKey()), brokerFeatures,
records));
}
- return new ControllerResult<>(records, results);
+
+ if (records.isEmpty()) {
Review comment:
I don't have a good reason. I felt it was consistent that an empty set
of records was by definition not atomic. I removed the conditional and always
create an atomic `ControllerResult`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]