C0urante commented on code in PR #16122:
URL: https://github.com/apache/kafka/pull/16122#discussion_r1622583381
##########
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/AbstractHerderTest.java:
##########
@@ -1116,6 +1118,30 @@ public void testConnectorOffsets() throws Exception {
assertEquals(offsets, cb.get(1000, TimeUnit.MILLISECONDS));
}
+ @Test
+ public void testTaskConfigComparison() {
+ ClusterConfigState snapshot = mock(ClusterConfigState.class);
+
+ when(snapshot.taskCount(CONN1)).thenReturn(TASK_CONFIGS.size());
+ TASK_CONFIGS_MAP.forEach((task, config) ->
when(snapshot.rawTaskConfig(task)).thenReturn(config));
+ // Same task configs, same number of tasks--no change
+ assertFalse(AbstractHerder.taskConfigsChanged(snapshot, CONN1,
TASK_CONFIGS));
+
+ when(snapshot.taskCount(CONN1)).thenReturn(TASK_CONFIGS.size() + 1);
+ // Different number of tasks; should report a change
+ assertTrue(AbstractHerder.taskConfigsChanged(snapshot, CONN1,
TASK_CONFIGS));
+
+ when(snapshot.taskCount(CONN1)).thenReturn(TASK_CONFIG.size());
+ List<Map<String, String>> alteredTaskConfigs = new
ArrayList<>(TASK_CONFIGS);
+ alteredTaskConfigs.set(alteredTaskConfigs.size() - 1,
Collections.emptyMap());
+ // Last task config is different; should report a change
+ assertTrue(AbstractHerder.taskConfigsChanged(snapshot, CONN1,
alteredTaskConfigs));
+
+ // Make sure we used exclusively raw task configs and never attempted
transformation
+ // See KAFKA-16837
Review Comment:
Ack, done 👍
##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java:
##########
@@ -124,7 +124,7 @@
*/
public abstract class AbstractHerder implements Herder, TaskStatus.Listener,
ConnectorStatus.Listener {
- private final Logger log = LoggerFactory.getLogger(AbstractHerder.class);
+ private static final Logger log =
LoggerFactory.getLogger(AbstractHerder.class);
Review Comment:
We use both, but the lowercase variant is more common in Connect:
```shell
> find connect/runtime/src/main/java -type f -name '*.java' -exec grep -F
'Logger log =' {} + | wc -l
60
> find connect/runtime/src/main/java -type f -name '*.java' -exec grep -F
'Logger LOG =' {} + | wc -l
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]