redpanda icon indicating copy to clipboard operation
redpanda copied to clipboard

transactions: Support transaction coordinator leadership transfer

Open bharathv opened this issue 3 years ago • 2 comments

Cover letter

The patch supports graceful leadership transfer scenario for transaction coordinator (tm_stm). High level approach is as follows.

  • Adds a transferring flag to tm_transaction state. Defaults to false but is true for transfer-in-progress txns.
  • Upon receiving a leadership transfer request, flip this flag and flush ongoing txns to log
  • New leader applies them in-memory and lazily resets the flag upon access but before updating their state.
  • If the flag is set and the term does not match, new leader expires them so that we don't read any dirty uncommitted txns.

A side effect of this refactoring is that the transactions can now appear in log/mem state, so the patch refactors to lookup in both places wherever needed.

Fixes #6214

Backport Required

  • [x] not a bug fix
  • [ ] issue does not exist in previous branches
  • [ ] papercut/not impactful enough to backport
  • [x] v22.2.x
  • [ ] v22.1.x
  • [ ] v21.11.x

UX changes

  • none

Release notes

  • none

Improvements

  • Transactions can now span leadership changes of transaction coordinator.

bharathv avatar Aug 27 '22 00:08 bharathv

Put * none for UX changes and Release notes

VadimPlh avatar Aug 30 '22 11:08 VadimPlh

Do we need to add some chaos test for it?

VadimPlh avatar Aug 30 '22 11:08 VadimPlh

/ci-repeat 5

bharathv avatar Oct 04 '22 23:10 bharathv

Test failure #6601

bharathv avatar Oct 05 '22 04:10 bharathv