Grant Henke created KAFKA-4746:
----------------------------------

             Summary: Offsets can be committed for the offsets topic
                 Key: KAFKA-4746
                 URL: https://issues.apache.org/jira/browse/KAFKA-4746
             Project: Kafka
          Issue Type: Bug
          Components: core
    Affects Versions: 0.9.0.0
            Reporter: Grant Henke


Though this is likely rare and I don't suspect to many people would try to do 
this, we should prevent users from committing offsets for the offsets topic 
into the offsets topic. This would essentially create an infinite loop in any 
consumer consuming from that topic. Also committing offsets for a compacted 
topic doesn't likely make sense anyway. 

Here is a quick failing test I wrote to see if this guard exists:

{code:title=OffsetCommitTest.scala|borderStyle=solid}
 @Test
  def testOffsetTopicOffsetCommit() {
    val topic1 = "__consumer_offsets"
    // Commit an offset
    val expectedReplicaAssignment = Map(0  -> List(1))
    val commitRequest = OffsetCommitRequest(
      groupId = group,
      requestInfo = immutable.Map(TopicAndPartition(topic1, 0) -> 
OffsetAndMetadata(offset=42L)),
      versionId = 2
    )
    val commitResponse = simpleConsumer.commitOffsets(commitRequest)

    assertEquals(Errors.INVALID_TOPIC_EXCEPTION.code, 
commitResponse.commitStatus.get(TopicAndPartition(topic1, 0)).get)
  }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to