You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ju...@apache.org on 2018/05/26 00:12:15 UTC
[kafka] branch 1.1 updated: Minor: Fixed ConsumerOffset#path (#5060)
This is an automated email from the ASF dual-hosted git repository.
junrao pushed a commit to branch 1.1
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/1.1 by this push:
new a346590 Minor: Fixed ConsumerOffset#path (#5060)
a346590 is described below
commit a346590895f1702799d2c165c1a301de90a1d649
Author: maytals <32...@users.noreply.github.com>
AuthorDate: Sat May 26 03:10:59 2018 +0300
Minor: Fixed ConsumerOffset#path (#5060)
consumer offset path in zookeeper should be /consumers/${group}/offsets/${topic}/${partition} instead of /consumers/${group}/offset/${topic}/${partition}. Added `s` to the word `offset`.
Reviewers: Ismael Juma <is...@juma.me.uk>, Manikumar Reddy O <ma...@gmail.com>, Jun Rao <ju...@gmail.com>
---
core/src/main/scala/kafka/zk/ZkData.scala | 2 +-
.../src/test/scala/unit/kafka/zk/KafkaZkClientTest.scala | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/core/src/main/scala/kafka/zk/ZkData.scala b/core/src/main/scala/kafka/zk/ZkData.scala
index b6352fa..24f65a4 100644
--- a/core/src/main/scala/kafka/zk/ZkData.scala
+++ b/core/src/main/scala/kafka/zk/ZkData.scala
@@ -408,7 +408,7 @@ object PreferredReplicaElectionZNode {
}
object ConsumerOffset {
- def path(group: String, topic: String, partition: Integer) = s"/consumers/${group}/offset/${topic}/${partition}"
+ def path(group: String, topic: String, partition: Integer) = s"/consumers/${group}/offsets/${topic}/${partition}"
def encode(offset: Long): Array[Byte] = offset.toString.getBytes(UTF_8)
def decode(bytes: Array[Byte]): Option[Long] = Option(bytes).map(new String(_, UTF_8).toLong)
}
diff --git a/core/src/test/scala/unit/kafka/zk/KafkaZkClientTest.scala b/core/src/test/scala/unit/kafka/zk/KafkaZkClientTest.scala
index a6c0956..1aeca22 100644
--- a/core/src/test/scala/unit/kafka/zk/KafkaZkClientTest.scala
+++ b/core/src/test/scala/unit/kafka/zk/KafkaZkClientTest.scala
@@ -1043,4 +1043,20 @@ class KafkaZkClientTest extends ZooKeeperTestHarness {
assertTrue(zkClient.deleteDelegationToken(tokenId))
assertEquals(None, zkClient.getDelegationTokenInfo(tokenId))
}
+
+ @Test
+ def testConsumerOffsetPath(): Unit = {
+ def getConsumersOffsetsZkPath(consumerGroup: String, topic: String, partition: Int): String = {
+ s"/consumers/$consumerGroup/offsets/$topic/$partition"
+ }
+
+ val consumerGroup = "test-group"
+ val topic = "test-topic"
+ val partition = 2
+
+ val expectedConsumerGroupOffsetsPath = getConsumersOffsetsZkPath(consumerGroup, topic, partition)
+ val actualConsumerGroupOffsetsPath = ConsumerOffset.path(consumerGroup, topic, partition)
+
+ assertEquals(expectedConsumerGroupOffsetsPath, actualConsumerGroupOffsetsPath)
+ }
}
--
To stop receiving notification emails like this one, please contact
junrao@apache.org.