Skip to content

KAFKA-3459: Returning zero task configurations from a connector does not properly clean up existing tasks#1248

Closed
Ishiihara wants to merge 9 commits into
apache:trunkfrom
Ishiihara:kafka-3459
Closed

KAFKA-3459: Returning zero task configurations from a connector does not properly clean up existing tasks#1248
Ishiihara wants to merge 9 commits into
apache:trunkfrom
Ishiihara:kafka-3459

Conversation

@Ishiihara
Copy link
Copy Markdown
Contributor

@hachikuji @ewencp Can you take a look when you have time?

@hachikuji
Copy link
Copy Markdown
Contributor

@Ishiihara How much trouble would it be to add a unit test?

@Ishiihara
Copy link
Copy Markdown
Contributor Author

@hachikuji Unit test added. Please take another look.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: maybe move this to initialization?

int newTaskCount = configs.size();

@Ishiihara
Copy link
Copy Markdown
Contributor Author

@hachikuji Updated to public void putTaskConfigs(String connector, List<Map<String, String>> configs).

*
* @param configs map containing task configurations
* @param connector the connector to write task configuration
* @param configs map containing task configurations for the connector
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: this parameter is no longer a map

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

}

private static Map<ConnectorTaskId, Map<String, String>> taskConfigListAsMap(String connName, List<Map<String, String>> configs) {
private static Map<Integer, Map<String, String>> taskConfigListAsMap(List<Map<String, String>> configs) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method used anymore?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch and ack.

@hachikuji
Copy link
Copy Markdown
Contributor

@Ishiihara Left a couple minor comments, but mostly LGTM. Thanks for trying to push through the refactor I suggested. It looks like it worked out well for DistributedHerder, but maybe a little awkward for StandaloneHerder. Considering the complexity of the former, that might be a good trade.

// update of all tasks that are expected based on the number of tasks in the commit message.
Map<String, Set<Integer>> updatedConfigIdsByConnector = taskIdsByConnector(deferred);
Set<Integer> taskIdSet = updatedConfigIdsByConnector.get(connectorName);
Set<Integer> taskIdSet = taskIds(deferred);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can no longer return null based on the current implementation, so the subsequent check no longer makes sense. Although it looks like it was already impossible with the taskIdsByConnector code. I can't remember the exact context of KAFKA-3321 (I know we added this to help @gwenshap debug a transient system test failure). We might want to figure out if we can get rid of the check for a null taskIdSet now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will follow up with @gwenshap to see whether we can remove or not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it can't return null, what's the harm in checking?

completeTaskIdSet will still NPE if taskIdSet is null, so I think that being sure is very important.

@ewencp
Copy link
Copy Markdown
Contributor

ewencp commented Apr 29, 2016

@Ishiihara Same as @hachikuji, few minor comments but mostly LGTM.

@Ishiihara
Copy link
Copy Markdown
Contributor Author

@ewencp Addressed review comments. PTAL.

@ewencp
Copy link
Copy Markdown
Contributor

ewencp commented Apr 29, 2016

LGTM, thanks @Ishiihara!

@asfgit asfgit closed this in d0dedc6 Apr 29, 2016
gfodor pushed a commit to AltspaceVR/kafka that referenced this pull request Jun 3, 2016
…not properly clean up existing tasks

hachikuji ewencp Can you take a look when you have time?

Author: Liquan Pei <liquanpei@gmail.com>

Reviewers: Jason Gustafson <jason@confluent.io>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes apache#1248 from Ishiihara/kafka-3459
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants