Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-4822] Ensure that the Kafka 0.8 connector is compatible with k… #5050

Closed
wants to merge 2 commits into from
Closed

[FLINK-4822] Ensure that the Kafka 0.8 connector is compatible with k… #5050

wants to merge 2 commits into from

Conversation

taizilongxu
Copy link

What is the purpose of the change

When we deploy the taskmanager in docker of our cluster, it's hard to locate which taskmanager cosnume the right partition of kafka except looking up the log in docker, so I just add the owner in zk path when PeriodOffsetCommitter the offset.

Brief change log

  • add the registerPartitionOwnership when commit the offset to zookeeper, and store the info like : /consumers/[group_id]/owner/[topic]/[partition_id]

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving):no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not documented

@zentol
Copy link
Contributor

zentol commented Nov 22, 2017

Don't you need a unique ID for this to work properly? (The task name is not unique)

@taizilongxu
Copy link
Author

the prefix is the same as kafka high level api, contain the uuid string, so it could be unique

Copy link
Contributor

@tzulitai tzulitai left a comment

Choose a reason for hiding this comment

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

Thanks for the work @taizilongxu.
I have left some comments after a first pass of the changes.

PeriodicOffsetCommitter(ZookeeperOffsetHandler offsetHandler,
List<KafkaTopicPartitionState<TopicAndPartition>> partitionStates,
ExceptionProxy errorHandler,
long commitInterval) {
long commitInterval, String taskId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please list this parameter on a separate new line for consistently code style.

try {
hostName = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
LOG.error("Can not get host name!");
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add the exception to the log also.

@@ -64,6 +71,20 @@ public ZookeeperOffsetHandler(Properties props) {
int backoffBaseSleepTime = Integer.valueOf(props.getProperty("flink.zookeeper.base-sleep-time.ms", "100"));
int backoffMaxRetries = Integer.valueOf(props.getProperty("flink.zookeeper.max-retries", "10"));

// set consumerId to register ownership in zookeeper, just like kafka high level API
UUID uuid = UUID.randomUUID();
String hostName = "Unkonw";
Copy link
Contributor

Choose a reason for hiding this comment

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

type: Unknown

curatorClient.create().creatingParentContainersIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(path, info.getBytes());
}
} catch (KeeperException.NodeExistsException e) {
LOG.warn("NodeExists for {}", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

How about simply: Node exists for {}, instead of the camel case?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, shouldn't the log arguments be be ("Node exists for {}", consumerId, e)?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks to review, I will edit them

@taizilongxu
Copy link
Author

Hi, is there any thing to edit or change?

@aljoscha
Copy link
Contributor

I'm closing this as "Abandoned", since there is no more activity and the code base has moved on quite a bit. Please re-open this if you feel otherwise and work should continue.

It's Kafka 0.8...

@aljoscha aljoscha closed this Oct 18, 2019
@aljoscha aljoscha self-assigned this Oct 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants