Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-9876 Implement Raft Protocol for Metadata Quorum
  3. KAFKA-12333

KafkaMetadataLog and MockLock should validate that appended epochs are monotonically

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • replication
    • None

    Description

      Both the MockLog and KafkaMetadataLog should only allow appendAsLeader and appendAsFollower with monotonically increasing epochs. In other words the following test in KafkaMetadataLogTest should fail:

        @Test
        def testOutOfOrderEpoch(): Unit = {
          val topicPartition = new TopicPartition("cluster-metadata", 0)
          val log = buildMetadataLog(tempDir, mockTime, topicPartition)    val recordFoo = new SimpleRecord("foo".getBytes())
          val currentEpoch = 3
          val initialOffset = log.endOffset().offset    log.appendAsLeader(
            MemoryRecords.withRecords(initialOffset, CompressionType.NONE, currentEpoch, recordFoo),
            currentEpoch
          )    // Out order epoch should throw an exception
          log.appendAsLeader(
            MemoryRecords.withRecords(
              initialOffset + 1, CompressionType.NONE, currentEpoch - 1, recordFoo
            ),
            currentEpoch - 1
          )
          log.appendAsFollower(
            MemoryRecords.withRecords(
              initialOffset + 2, CompressionType.NONE, currentEpoch - 2, recordFoo
            )
          )
        } 

      The same for MockLogTest.

      Attachments

        Issue Links

          Activity

            People

              zhaohaidao HaiyuanZhao
              jsancio José Armando García Sancio
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: