Skip to content

KAFKA-9807; Protect LSO reads from concurrent high-watermark updates#8418

Merged
hachikuji merged 2 commits into
apache:trunkfrom
hachikuji:KAFKA-9807
Apr 3, 2020
Merged

KAFKA-9807; Protect LSO reads from concurrent high-watermark updates#8418
hachikuji merged 2 commits into
apache:trunkfrom
hachikuji:KAFKA-9807

Conversation

@hachikuji

Copy link
Copy Markdown
Contributor

If the high-watermark is updated in the middle of a read with the read_committed isolation level, it is possible to return data above the LSO. In the worst case, this can lead to the read of an aborted transaction. The root cause is that the logic depends on reading the high-watermark twice. We fix the problem by reading it once and caching the value.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Comment thread core/src/test/scala/unit/kafka/log/LogTest.scala
Comment thread core/src/test/scala/unit/kafka/log/LogTest.scala Outdated

@mumrah mumrah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @hachikuji. :shipit:

@guozhangwang guozhangwang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @hachikuji

@hachikuji
hachikuji merged commit d4eb406 into apache:trunk Apr 3, 2020
hachikuji added a commit that referenced this pull request Apr 3, 2020
…8418)

If the high-watermark is updated in the middle of a read with the `read_committed` isolation level, it is possible to return data above the LSO. In the worst case, this can lead to the read of an aborted transaction. The root cause is that the logic depends on reading the high-watermark twice. We fix the problem by reading it once and caching the value.

Reviewers: David Arthur <mumrah@gmail.com>, Guozhang Wang <wangguoz@gmail.com>, Ismael Juma <ismael@juma.me.uk>
hachikuji added a commit that referenced this pull request Apr 3, 2020
…8418)

If the high-watermark is updated in the middle of a read with the `read_committed` isolation level, it is possible to return data above the LSO. In the worst case, this can lead to the read of an aborted transaction. The root cause is that the logic depends on reading the high-watermark twice. We fix the problem by reading it once and caching the value.

Reviewers: David Arthur <mumrah@gmail.com>, Guozhang Wang <wangguoz@gmail.com>, Ismael Juma <ismael@juma.me.uk>
qq619618919 pushed a commit to qq619618919/kafka that referenced this pull request May 12, 2020
…pache#8418)

If the high-watermark is updated in the middle of a read with the `read_committed` isolation level, it is possible to return data above the LSO. In the worst case, this can lead to the read of an aborted transaction. The root cause is that the logic depends on reading the high-watermark twice. We fix the problem by reading it once and caching the value.

Reviewers: David Arthur <mumrah@gmail.com>, Guozhang Wang <wangguoz@gmail.com>, Ismael Juma <ismael@juma.me.uk>
andrey-klochkov-liftoff pushed a commit to liftoffio/kafka that referenced this pull request Aug 17, 2020
…pache#8418)

If the high-watermark is updated in the middle of a read with the `read_committed` isolation level, it is possible to return data above the LSO. In the worst case, this can lead to the read of an aborted transaction. The root cause is that the logic depends on reading the high-watermark twice. We fix the problem by reading it once and caching the value.

Reviewers: David Arthur <mumrah@gmail.com>, Guozhang Wang <wangguoz@gmail.com>, Ismael Juma <ismael@juma.me.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants