Github user uce commented on a diff in the pull request:
https://github.com/apache/flink/pull/1451#discussion_r47482606
--- Diff:
flink-streaming-connectors/flink-connector-kafka/src/main/java/org/apache/flink/streaming/connectors/kafka/internals/ZookeeperOffsetHandler.java
---
@@ -98,30 +97,42 @@ public void
seekFetcherToInitialOffsets(List<KafkaTopicPartitionLeader> partitio
@Override
public void close() throws IOException {
- zkClient.close();
+ curatorClient.close();
}
//
------------------------------------------------------------------------
// Communication with Zookeeper
//
------------------------------------------------------------------------
- public static void setOffsetInZooKeeper(ZkClient zkClient, String
groupId, String topic, int partition, long offset) {
- TopicAndPartition tap = new TopicAndPartition(topic, partition);
- ZKGroupTopicDirs topicDirs = new ZKGroupTopicDirs(groupId,
tap.topic());
- ZkUtils.updatePersistentPath(zkClient,
topicDirs.consumerOffsetDir() + "/" + tap.partition(), Long.toString(offset));
+ public static void setOffsetInZooKeeper(CuratorFramework curatorClient,
String groupId, String topic, int partition, long offset) throws Exception {
+ ZKGroupTopicDirs topicDirs = new ZKGroupTopicDirs(groupId,
topic);
+ String path = topicDirs.consumerOffsetDir() + "/" + partition;
+ ensureExists(curatorClient, path);
+ byte[] data = Long.toString(offset).getBytes();
--- End diff --
Depending on how often this is called, we could replace it with another way
of converting it to the original bytes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---