Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. If no producerId/epoch is provided, the producer is initializing for the first time. We  
    1. If there is no current producerId/epoch, generate a new producerId and set epoch=0. 
    2. Otherwise, we need to bump the epoch, which could mean overflow
    .
    1. :
      1. No overflow: Bump the epoch and return the current producerId with the bumped epoch. The last producerId/epoch will be set to empty.
      2. Overflow: Initialize a new producerId with epoch=0 and return it. The last producerId/epoch will be set to empty.
  2. If producerId/epoch is provided, then the producer is re-initializing after a failure. There are three cases:
    1. The provided producerId/epoch matches the existing producerId/epoch, so we need to bump the epoch. As above, we may need to generate a new producer producerId if there would be overflow bumping the epoch.
      1. No overflow: bump the epoch and return the current producerId with the bumped epoch. The last producerId/epoch will be set to the previous producerId/epoch.
      2. Overflow: generate a new producerId with epoch=0. The last producerId/epoch will be set to the old producerId/epoch.
    2. The provided producerId/epoch matches the last producerId/epoch. The current producerId/epoch will be returned.
    3. Else return INVALID_PRODUCER_EPOCH

...