GitHub user pnowojski opened a pull request:
https://github.com/apache/flink/pull/4955
[FLINK-7978][kafka] Ensure that transactional ids will never clash
## What is the purpose of the change
Previously transactional ids to use and to abort could clash between
subtasks. This could lead to a race condition between initialization and
writting the data, where one subtask is still initializing/aborting some
transactional id while different subtask is already trying to write the data
using the same transactional id.
## Brief change log
First commit extracts `TransactionalIdsGenerator` logic and is a pure
refactor, without any functional change. Second one is the actual fix. I would
like to merge those two commits as they are, without squashing, so that a bug
fix is actually easier to understand/read in the commit history.
## Verifying this change
This fixes a bug and adds test coverage (`TransactionalIdsGeneratorTest`)
for future regressions.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (yes / **no**)
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: (yes / **no**)
- The serializers: (yes / **no** / don't know)
- The runtime per-record code paths (performance sensitive): (yes /
**no** / don't know)
- Anything that affects deployment or recovery: JobManager (and its
components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
- The S3 file system connector: (yes / **no** / don't know)
## Documentation
- Does this pull request introduce a new feature? (yes / **no**)
- If yes, how is the feature documented? (**not applicable** / docs /
JavaDocs / not documented)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/pnowojski/flink f7978
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/4955.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4955
----
commit 54c1729fed93e51f416d365c65cbd64f67c27321
Author: Piotr Nowojski <[email protected]>
Date: 2017-11-06T13:03:16Z
[hotfix][kafka] Extract TransactionalIdsGenerator class from
FlinkKafkaProducer011
This is pure refactor without any functional changes.
commit 96bb26e5d9289fb8393f0807936792d89138a744
Author: Piotr Nowojski <[email protected]>
Date: 2017-11-06T13:14:01Z
[FLINK-7978][kafka] Ensure that transactional ids will never clash
Previously transactional ids to use and to abort could clash between
subtasks. This could lead to a race condition between initialization
and writting the data, where one subtask is still initializing/aborting
some transactional id while different subtask is already trying to write
the data using the same transactional id.
----
---