Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-17691

FlinkKafkaProducer transactional.id too long when using Semantic.EXACTLY_ONCE

    XMLWordPrintableJSON

Details

    Description

      When sink to Kafka using the Semantic.EXACTLY_ONCE mode.

      The flink Kafka Connector Producer will auto set the transactional.id, and the user - defined value are ignored.

       

      When the job operator name too long, will send failed

      transactional.id is exceeds the kafka  coordinator_key limit

       

      The flink Kafka Connector policy for automatic generation of transaction.id is as follows

       

      1. use the taskName + "-" + operatorUniqueID as transactional.id prefix (may be too long)

        getRuntimeContext().getTaskName() + "-" + ((StreamingRuntimeContext)    getRuntimeContext()).getOperatorUniqueID()

      2. Range of available transactional ids 

      [nextFreeTransactionalId, nextFreeTransactionalId + parallelism * kafkaProducersPoolSize)

       

       

      The Kafka transaction.id check policy as follows:

       

      string bytes.length can't larger than Short.MAX_VALUE (32767)

       

      To reproduce this bug, the following conditions must be met:

       

      1. send msg to kafka with exactly once mode
      2. the task TaskName' length + TaskName's length is lager than the 32767 (A very long line of SQL or window statements can appear)

      I suggest a solution:

       

           1.  Allows users to customize transactional.id 's prefix

      or

           2. Do md5 on the prefix before returning the real transactional.id

       

       

       

      Attachments

        1. image-2020-05-14-20-43-57-414.png
          319 kB
          freezhan
        2. image-2020-05-14-20-45-24-030.png
          290 kB
          freezhan
        3. image-2020-05-14-20-45-59-878.png
          130 kB
          freezhan
        4. image-2020-05-14-21-09-01-906.png
          213 kB
          freezhan
        5. image-2020-05-14-21-16-43-810.png
          119 kB
          freezhan
        6. image-2020-05-14-21-17-09-784.png
          107 kB
          freezhan

        Issue Links

          Activity

            People

              jmathews3773 John Mathews
              freezhan freezhan
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: