Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport] [v23.3.x] rm_stm: fix fence_pid_epoch cleanup #17880 #17900

Merged
merged 3 commits into from
Apr 17, 2024

Conversation

bharathv
Copy link
Contributor

fence_pid_epoch maps a producer id to its latest epoch. Current cleanup code does not do a epoch check before cleaning up the pid state. This can result in removing the state related to the latest epoch. Consider the following series of events..

[x, y] = pid[id=x, epoch=y]

[1, 0] begin_tx - fence_pid_epoch[1] = 0
[1, 1] begin_tx - fence_pid_epoch[1] = 1
evict [1, 0]
erase(fence_pid[1]) ==> removes (1)

This results in a messed up state stalling the state of the transaction because the partition cannot make progress until it verifies the epoch.

This is a long pending bug that was exposed by racy evictions.

note: this whole code is going to be revamped soon and the plan is to add a self contained unit test fixture that supports transactions end-to-end, that should have better test coverage.

Fixes #17891

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x

Release Notes

Bug Fixes

  • fix a race between eviction and producer registration that results in an invalid transaction state.

fence_pid_epoch maps a producer id to its latest epoch. Current cleanup
code does not do a epoch check before cleaningup the pid state. This can
result in removing the state related to the latest epoch. Consider the
following series of events..

[x, y] = pid[id=x, epoch=y]

[1, 0] begin_tx - fence_pid_epoch[1] = 0
[1, 1] begin_tx - fence_pid_epoch[1] = 1
evict [1, 0]
erase(fence_pid[1]) ==> removes (1)

This results in a messed up state stalling the state of the transaction
because the partition cannot make progress until it verifies the epoch.

This is a long pending bug that was exposed by racy evictions.

(cherry picked from commit 996e138)
@piyushredpanda
Copy link
Contributor

Expected failures #12897 and #16198

@piyushredpanda piyushredpanda merged commit 001e63f into redpanda-data:v23.3.x Apr 17, 2024
14 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants